It's all about the answers!

Ask a question

Why am I getting Exception in thread "main" java.lang.NoClassDefFoundError when Running JBE in JSL debug mode?


Des Nunan (623) | asked Jan 04 '16, 12:12 p.m.
I am trying to configure JBE as a Windows Service using Java Service Launcher [0.99.o] on a Windows 7 system. I have followed the steps outlined here:

https://jazz.net/wiki/bin/view/Main/JbeAsAWindowsService

JAVA_HOME is set to the location of the JDK that ships with the 32bit RTC client that is installed on the system [v5.0.2].
C:\Program Files (x86)\IBM\TeamConcert\jdk

I can run JBE via java.exe rather than jbe.exe and the build engine processes requests successfully.  I edited the jsl.ini file in the bin directory (not the one in the parent) and commented out the sections as indicated. I ran jsl.exe -debug to test this configuration. The console output on first run in debug mode told me that the jvmtype (which was set to "server") could not be found. I found that changing this property to classic or j9vm gets around this.

The next attempt at running JSL in debug mode threw up another error.  This time I see "ControlHandler registered after JVM start" followed by the following exception and the service stops.  I am not sure why this happens or how I can resolve this.  Any help would be appreciated: 


ControlHandler registered after JVM start
:1451925100: java starting 4.4
:52991532652: java starting 5
Exception in thread "main" java.lang.NoClassDefFoundError: java
Caused by: java.lang.ClassNotFoundException: java
        at java.net.URLClassLoader.findClass(URLClassLoader.java:665)
        at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:760)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:728)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:707)
:52991532652: java starting 10
:52991532652: java starting 12
Main Thread has exited. Now making DestroyJavaVM() call. DestroyJavaVM() will bl
ock so the JVM will keep running until all daemon threads have terminated.
:31855155411066476: Exit hook called
Exit code 0
:31855155411066476: Cleanup complete
:31855155411066476: Service stop status set.

One answer



permanent link
sam detweiler (12.5k6186201) | answered Jan 04 '16, 12:58 p.m.
As I recall, the path and other environment variables are not used by services. (for security purposes)..
that is why the ini file is critical.

so I think the claspath in the ini file is wrong

Comments
Des Nunan commented Jan 04 '16, 1:40 p.m.

Thanks for your response.
I tried changing the [java] section to point to the actual path to the jdk location used instead of JAVA_HOME as follows, but still no luck:


[java]
;Path to the java runtime used
;If this option is not used the default from the registry will be used
;jrepath=......\jdk16
;jrepath=%JAVA_HOME%
jrepath="C:\Program Files (x86)\IBM\TeamConcert\jdk"


Anything else it could be? Could stringbuffer size be relevant?


sam detweiler commented Jan 04 '16, 1:51 p.m.

You might also want to try the pathname without the spaces..

if you do a dir program* /x from the root you will get its shortnme (usually progra~2)

also, things installed in program files get extra security requirements (to prevent hackers from stuffing things into the system path from services)..  so, you might want to try a different location too.

and u are running the 32 bit be, right? "Program Files (x86)" means 32 bit.


Des Nunan commented Jan 06 '16, 9:13 a.m.

Tried using path shortname to no avail.  I also tried using a JDK installed to a different location (C:\Java), changed the ini to point jrepath to that location instead but this did not work for me either. I am still getting the same error.


Des Nunan commented Jan 06 '16, 12:29 p.m.

I got JSL running in debug mode. It was my mistake.

I set the cmdline setting to
java
-jar path_to_buildsystem\buildengine\eclipse\plugins\org.eclipse.equinox.launcher_ pluginVersion.jar -repository https://localhost:9443/jazz -userId ADMIN -pass ADMIN -engineId engine1 -sleeptime 10

I should have omitted the "java" part of the parameter list. Now it works.

Your answer


Register or to post your answer.