Summer goes by pretty quickly! We have been tackling this Karaf issue for the past 2-3 weeks now. Finally I found a solution to it and I hope my solution can help you.
Basically we have an application running under JDK 7 and Karaf 3.04 smoothly. We would like to wrap the application under a Windows’ service. Karaf has service-wrapper which runs as:
wrapper:install -n MyService -d “MyWindowService”
The above script in Karaf runs fine and creates these three files: MyService-service.bat, MyService-service.exe, MyService-service.conf
According to Karaf instruction, under Windows command line:
MyService install should install the Windows service and you should be able to start the Windows service.
But … we kept getting this error:
Error: Could not find or load main class org.apache.karaf.wrapper.internal.Main
It actually points to a missing Class file. It turns out there is some bug in Karaf 3’s Service-Wrapper. When it creates the MyService-service.conf file, it misses one CLASSPATH line as below Classpath line 3.
After manually download the wrapper-core jar file from maven (I modified the jar file name after download, an unnecessary step).
With the 3rd Classpath line in the conf file, and the downloaded jar file in Karaf’s lib folder, the windows service runs perfectly as we expected!
Be well and do quality coding!