I couldn't get Jetty6 run on service wrapper using Jetty5's code (jettysvc.c and Service.c), so I decided to find some alternatives on this, and I found out that
the new Java Service Wrapper, has Listeners for java code, no need for to write native code
based on this I remade the code above, no need for Visual C++ and JNI,
the new code uses Method 3 in Java Service Wrapper's method 3 for configuration
see http://wrapper.tanukisoftware.org/doc/english/integrate.html
In here we org.tanukisoftware.wrapper.WrapperListener in JettyServiceWrapperListener class and handle
controlEvent, start, stop,
in our JettyServiceWrapperListener the java main method is also here, this will be the class where service wrapper calls as main class
WrapperManager.start(new JettyServiceWrapperListener(), newStrArgs);
method implementations:
controlEvent:
handling for windows service shutdown and stop
start:
calls org.mortbay.start.Main.main(args);
stop:
calls server.stop for gracefull exit
so that JettyServiceWrapperListener can have the reference of server
an we need to add a jetty Life cycle class named Win32Service that has a setter for
its server instance and this will set a server to our JettyServiceWrapperListener
when its started,
this Life Cycle is added in jetty-win32-service.xml
I decided to use Java Service Wrapper based since its been used by jetty5.
based on the jetty5's win32 code, ive fould out that we need to compile native c codes.
so the following tasks bellow would be need
tasks:
Create A maven project for jni that compiles both native and java code,
it sould be able to detect if its running on windows platform, to compile
the native code for windows.
create jni files that will be used to interact with java service wrapper
configure the java service wrapper