Sign in to follow this  
Jarwulf

IDE=runs Jar File=hangs

Recommended Posts

Jarwulf    223
A program runs fine through the Eclipse IDE but hangs when run through a Jar and JNLP. The Jar has been signed and I've run similar jars through the same process. The problem occurs as shown below using txt msgs to track. INPUT is a file chosen by the user with a file browser. The functions that take INPUT are in jar libraries so I can't get any deeper without massively rearranging the code.

[code]
selectedFile = jfileChooser.getSelectedFile();

final FileConversion task = new FileConversion(selectedFile, txtArea);

//Conversion Function

FileConversion(File INPUT, JTextArea innerTextArea) {
//initialize
this.INPUT = INPUT;
this.innerTextArea = innerTextArea;

}

@Override
public File doInBackground() {
File convertedFile = new File("convertedFile.txt");
int convertstepcounter=0, convertstepcounter2=0;

publish( 1 );
IoUtil.assertFileIsReadable(INPUT);//hangs here
publish( 2 );
final SAMFileReader reader = new SAMFileReader(INPUT);//or here if above line is disabled.
publish ( 3 );
[/code]

Share this post


Link to post
Share on other sites
Bruno Sofiato    407
Do you have provided the required permissions on the JNLP descriptor ? Seems like a sandbox permission problem to me. Try running with [i]<all-permissions/>[/i] first to pinpoint if it's indeed a security problem.

Share this post


Link to post
Share on other sites
Jarwulf    223
[quote name='Bubsy' timestamp='1354471248' post='5006330']
Do you have provided the required permissions on the JNLP descriptor ? Seems like a sandbox permission problem to me. Try running with [i]<all-permissions/>[/i] first to pinpoint if it's indeed a security problem.
[/quote]

All permissions is already set in the jnlp

Share this post


Link to post
Share on other sites
Bruno Sofiato    407
Try to put a try catch block(catching Throwable) encapsulating the method call, this block should call ex.printStackTrace(), sometimes a RuntimeError can lurk and unwind the entire stack.

P.S. Does anything get printed on the Webstart console ?

Share this post


Link to post
Share on other sites
Jarwulf    223
[quote name='Bubsy' timestamp='1354548239' post='5006627']
Try to put a try catch block(catching Throwable) encapsulating the method call, this block should call ex.printStackTrace(), sometimes a RuntimeError can lurk and unwind the entire stack.

P.S. Does anything get printed on the Webstart console ?
[/quote]

Thanks for your help so far I tried


[CODE]

try{
publish( 1 );
IoUtil.assertFileIsReadable(INPUT);
publish( 2 );
}
catch(Throwable ex)
{
ex.printStackTrace();
}
[/CODE]

in the code posted and I get the same as before...the '1' prints out and then nothing happens. meanwhile its happily chugging on the IDE with the exact same code. I don't know exactly what you mean by the webstart console. After the prompts its just the program thats running.

Share this post


Link to post
Share on other sites
Bruno Sofiato    407
Hmmm to turn the console on type on the prompt javaws -viewer, on the last tab there's a node which is called java console. Turn it on and see if something pop on it.

You can also try turning the debugger on the webstart application by using the Java's remote debugging facility. I never had to used it, but I know it is feasible.

Share this post


Link to post
Share on other sites
Jarwulf    223
[quote name='Bubsy' timestamp='1354583896' post='5006882']
Hmmm to turn the console on type on the prompt javaws -viewer, on the last tab there's a node which is called java console. Turn it on and see if something pop on it.

You can also try turning the debugger on the webstart application by using the Java's remote debugging facility. I never had to used it, but I know it is feasible.
[/quote]

Aite, looks like we have a something here finally...

[CODE]
java.lang.NoClassDefFoundError: net/sf/picard/io/IoUtil

at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: net.sf.picard.io.IoUtil
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
[/CODE]

I have the relevant jars packed into my jar file I open the net/sf/picard/io/ directory in the jar and I see the classes they're whining about so I don't know why they can't be detected. Edited by Jarwulf

Share this post


Link to post
Share on other sites
Jarwulf    223
[quote name='Bubsy' timestamp='1354716375' post='5007397']
It's all packed in one jar ?
[/quote]

Yeah, the supposedly missing classes run fine from the same jar in the IDE so I dunno why it can't detect them anymore once the files are exported in one big jar. Maybe its the manifest file? But I can't tell from the documentation what I'm doing wrong since it autogenerates during the jar export. Edited by Jarwulf

Share this post


Link to post
Share on other sites
Bruno Sofiato    407
No problem man, glad to help. Referencing multiples jars on the JNLP is easier and it's best at production level, because the JavaWS will only download jars which have been changed (ok, you could use the jardiff protocol, but it's TCO is higher, as you'd need a servlet container and it's harder to setup).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this