Page 1 of 1

jnlp failure "Could not find the main class"

PostPosted: Wed Mar 21, 2012 10:27 pm
by richh
Apologies if this issue has been solved - but my searches of the forums have been unsuccessful.

Scenario: Servoy Application Server 5.2.2 installed shortly after 5.2.2 was released. The server has been rock solid. There is a LAN with 5 sometimes 6 PCs. The PCs have Win XP or 7 (64bit). JRE varies between 6 update 15 and 29. All work fine.

My client has purchased a new machine running Win 7 32bit. On browsing to the app server port 8080 and clicking 'launch servoy client' the jnlp file downloads. Opening the file results in a failure. The failure message reads:
"Could not find the main class:
[C:\Users\path through temporary Internet files to ]\servoy_client.jnlp. Program will exit."

An OK button closes the failure message.

On opening and examining the downloaded jnlp file, it seems to be OK to me. In particular, it has:
Code: Select all
<application-desc main-class="">

Testing using Java check applications from the Oracle website shows that the JRE is working OK.

Has anyone come across this behaviour in the past? Is there a recommended way forward?

Re: jnlp failure "Could not find the main class"

PostPosted: Thu Mar 22, 2012 1:36 pm
by Andrei Costescu
The message makes me think it's trying to use the actual .jnlp file as a class to be run directly... Which obviously it is not.

This might be caused by a wrong file association for .jnlp in his OS.
For example (I think) if he ever right clicked a jnlp file and chose "Open with..." then pointed to java.exe then java.exe would give this error message.
Jnlp files must be associated with javaws.exe (and they are by default).

Re: jnlp failure "Could not find the main class"

PostPosted: Thu Mar 22, 2012 8:42 pm
by richh
Thanks for your suggestion Andrei.

On the PC concerned, .jnlp is associated with 'Java(TM) Platform SE binary'. To check, I used 'Associate a file type or protocol with a specific program', selected .jnlp, browsed to 'javaws.exe', and confirmed the change. The result: no change in behaviour. The same error message occurs.

Any further thoughts?

Re: jnlp failure "Could not find the main class"

PostPosted: Fri Mar 23, 2012 1:11 pm
by Andrei Costescu
It might also be a browser download association that is wrong. First time you download a .jnlp it usually asks what should be used to open it.
But it's unlikely that someone browsed to java.exe instead of using the system default...

Try to run this on the downloaded jnlp file from a command prompt/shell in the download directory:
Code: Select all
javaws servoy_client.jnlp
assumming that is the jnlp's filename.

If this results in the same message, then something else must be causing it.

Re: jnlp failure "Could not find the main class"

PostPosted: Fri Mar 23, 2012 4:38 pm
by richh
Following your suggestion Andrei, I have been able to launch the Servoy client. However, on launching from the now present shortcuts I get errors as shown in the attachments.
java error 1.png
This is the 'Wrapped Exception'. Should the cached launcher be used?
java error 1.png (17.08 KiB) Viewed 6008 times

java error 2.png
This is the 'Exception'.
java error 2.png (14.65 KiB) Viewed 6008 times

Are you able to see the core problem here?

Re: jnlp failure "Could not find the main class"

PostPosted: Mon Mar 26, 2012 9:48 am
by Andrei Costescu
If what I suggested works (you were able to succesfully start and use the client), then it must be a wrong file association. This must be corrected. As you said it's not a OS file association so it must be browser-related. What browser did you use?

The other error messages seem to happen because of a wrong cache (maybe wrong because of the attempts to use the jnlp incorrectly).
Try to clear the java cache from Control panel -> Java -> General -> Settings.

Re: jnlp failure "Could not find the main class" [SOLVED]

PostPosted: Fri Mar 30, 2012 11:02 am
by richh
Further trials and investigations confirmed Andrei's view that the root cause was a wrong file association. Many thanks Andrei for your insightfulness and your generous help.

On this particular PC there was a corruption in the registry which prevented the reassignment of .jnlp with javaws.exe.

To correct the issue, I restored the system to an earlier stage of commissioning. This action eliminated the corruption in the registry. I was then able to make the correct assignment of .jnlp using the Control Panel.

Result: Servoy client can now be launched from the browser and from the Start menu and desktop as normal.

Re: jnlp failure "Could not find the main class"

PostPosted: Fri Mar 30, 2012 2:40 pm
by Andrei Costescu
Yw. I'm glad you made it work.