I want to run a Java application as a daemon/service on a Linux machine and someone suggested using the Jakarta commons library. I downloaded the commons-daemon-1.0.tar.gz from http://jakarta.apache.org/commons/daemon/
and installed it on the target machine. I followed the instructions to create the jsvc file, moved it into my application directory and created the script:
./jsvc -debug -verbose -outfile logs/myDaemon.log -errfile '&1' -pidfile myDaemon.pid -cp lib/commons-daemon.jar:lib
This all appears to work correctly until the following error is displayed:
eption from /opt/java/j2sdk1.4.1_01/jr
eption: Class org.apache.commons.daemon.
can not access a member of class myDaemon.GCIGlobal with modifiers "protected"
t from /opt/java/j2sdk1.4.1_01/jr
jsvc.exec error: An error was detected checking the myDaemon.GCIGlobal daemon
jsvc.exec error: Service exit with a return value of 2
I am new to Java but I understand that the JSVC can not access a method in the class because it is protected and only available to other methods and sub-methods of that class. However, according to the daemon instructions it only needs to employ the following methods:
void init(String[ ] arguments)
Which it does and they are all public. It is the constructor that is protected in order to maintain only one instance of the application.
I know this is quite vague, but if anyone could provide me with more information or explain how I need to modify the application to run I would be grateful. Thanks.