#22 Running OSGi app as application successful, service fails

open
nobody
None
5
2011-06-27
2011-06-27
Anonymous
No

I'm attempting to run my OSGi (equinox) application as a windows service but am facing various NoClassDefFoundError's and/or UnsatisfiedLinkError's when running as a service. Plain application with embedded jars works as a charm but when I switch to service nothing works regardless of classpath settings

My setup is something like:

# This will be the current directory for the app. It can be relative to your executable.
working.directory=C:/ServiceTest

# Classpath entries. These will be relative to the working directory above. They can be wildcards (eg. *.jar)
classpath.1=C:/ServiceTest/plugins/org.eclipse.osgi*.jar
classpath.2=C:/ServiceTest/plugins/WinRun4J.jar
classpath.3=C:/ServiceTest/plugins/llauncher.jar

# This is the java class that will be run
;main.class=servicetest.Main
...
# This is the java class that will be run (for a service)
service.class=servicetest.Main

The log output I get is:

[info] Module Name: C:\ServiceTest\bin\rm.exe
[info] Module INI: C:\ServiceTest\bin\rm.ini
[info] Module Dir: C:\ServiceTest\bin\ [info] INI Dir: C:\ServiceTest\bin\ [info] Working directory set to: C:\ServiceTest
[info] Displaying embedded splash image
[info] Found VM: C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
[info] Expanding Classpath: C:/ServiceTest/plugins/org.eclipse.osgi*.jar
[info] Expanding Classpath: C:\ServiceTest\plugins/org.eclipse.osgi.services_3.2.100.v20100503.jar
[info] Expanding Classpath: C:\ServiceTest\plugins/org.eclipse.osgi_3.6.1.R36x_v20100806.jar
[info] Expanding Classpath: C:/ServiceTest/plugins/WinRun4J.jar
[info] Expanding Classpath: C:/ServiceTest/plugins/llauncher.jar
[info] Generated Classpath: C:\ServiceTest\plugins\org.eclipse.osgi.services_3.2.100.v20100503.jar;C:\ServiceTest\plugins\org.eclipse.osgi_3.6.1.R36x_v20100806.jar;C:\ServiceTest\plugins\WinRun4J.jar;C:\ServiceTest\plugins\llauncher.jar
[info] VM Args:
[info] vmarg.0=-Declipse.ignoreApp=true
[info] vmarg.1=-Dosgi.noShutdown=true
[info] vmarg.2=-Dosgi.configuration.cascaded=false
[info] vmarg.3=-Dorg.osgi.framework.bootdelegation=*
[info] vmarg.4=-Xmn128M
[info] vmarg.5=-Xms416M
[info] vmarg.6=-Xmx416M
[info] vmarg.7=-XX:+ForceTimeHighResolution
[info] vmarg.8=-Djava.class.path=C:\ServiceTest\plugins\org.eclipse.osgi.services_3.2.100.v20100503.jar;C:\ServiceTest\plugins\org.eclipse.osgi_3.6.1.R36x_v20100806.jar;C:\ServiceTest\plugins\WinRun4J.jar;C:\ServiceTest\plugins\llauncher.jar
[info] Program Args
[info] arg.0=-configuration
[info] arg.1=./configuration
[info] arg.2=-console
[info] arg.3=7777
[info] Main Class: servicetest/launcher/Main
[info] Registering natives for Native class
[info] Registering natives for FFI class
[info] Service startup initiated with 4 INI args and 0 Ctrl Manager args
[info] Service method starting...
Run as svc ([-configuration, ./configuration, -console, 7777])
[info] Service method completed.
java.lang.NoClassDefFoundError: Could not initialize class org.boris.winrun4j.Log
at servicetest.Main.start(Main.java:68)
at servicetest.Main.run(Main.java:230)
at servicetest.Main.serviceMain(Main.java:217)

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks