0

I have a java application that runs perfectly fine on netbeans and as a stand-alone, but gives an error when I run it using JNLP. Following is a part of the log:

Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
at texttospeech.MainPopup.buttonPlaySpeechActionPerformed(Unknown Source)
at texttospeech.MainPopup.access$100(Unknown Source)
at texttospeech.MainPopup$2.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

This is my JNLP:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080" href="texttospeech.jnlp" version="1">
    <information>
        <title>Text To Speech</title>
        <vendor>Interact</vendor>
        <description>
            Application to convert text to speech
        </description>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="texttospeech.jar" main="true"/>
        <jar href="/lib/freetts.jar"/>
        <jar href="/lib/cmu_time_awb.jar"/>
        <jar href="/lib/cmu_us_kal.jar"/>
        <jar href="/lib/cmulex.jar"/>
        <jar href="/lib/cmutimelex.jar"/>
        <jar href="/lib/en_us.jar"/>
    </resources>
    <application-desc main-class="texttospeech.MainPopup"/>
    <update check="background"/>
</jnlp>

On verifying the logs, I found out that all the JARs are being downloaded and there are no issues with this. All my JARs have been signed using the same certificate (self-signed). I did a lot of googling - nothing helped.

Technical Details

  • I'm running this application using Tomcat server (9.0.8)
  • JDK version: 1.8.0_171

Expected Functionality

The MainPopup class loads - which displays the GUI. There is a button which plays converts the entered text to speech and plays it. It uses freeTTS. This functionality works flawlessly without JNLP.

Actual Behaviour

When running with JNLP, the GUI loads, and all the functionality of the MainPopup class works. But when I click on the Play button (which loads the freeTTS VoiceManager), I get this exception and I don't hear any sound. Maybe JNLP isn't able to locate the classes within other JARs?

Please help me with this. Let me know if you require any more details. Thank you.

  • @GBlodgett It's not a problem with my code. It's something to do with JNLP. I'm not sure how the link suggested by you will help me. – Rishabh Beri Jun 16 '18 at 12:25
  • How does it load voices? More code is needed. VoiceManager can be null or voice can be null. Evaluate values of VoiceManager and Voice before using them. – Pavel Molchanov Jun 16 '18 at 12:36
  • Is that a library with native code? This might require extra guiding via JNLP options if shared libraries / DLLs are needed. – mvw Jun 28 '18 at 17:14

0 Answers0