> From: Andreas Mielke [mailto:andreasmie...@googlemail.com]
> > My problem is to tell the Apache Common Daemon where is my property file.

No, this is not your problem. The Commons Daemon does not care about your 
property file. The Java program that the Commons Daemon will run *does* care. 

> I don't posted the --Classpath, sorry. The complete command is:
> 
> prunsrv //IS --Description="DMSImport" --DisplayName="startImport"
> --Startup=auto --Type=interactiv --Install=java.exe --Jvm=auto
> --StartMode=Java --StopMode=Java --StartClass=dmswrapper.DMSImporter
> --Classpath=%CLASSPATH%;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-
> 1.2\DMSWrapper.jar;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\log4j-
> 1.2.15.jar;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\log4j-
> extensions.jar;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\commons-codec-
> 1.3.jar;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\commons-httpclient-
> 3.1.jar;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\commons-logging-
> 1.1.1.jar;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\commons-net-
> 2.0.jar;C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\EloixClient.jar;
> ++JvmOptions
> -D=C:\Programme\DMS_ImageBrowser\DMSWrapper-binary-1.2\DMSWrapper.properties;
> --LogPath="C:\Programme\commons-daemon-1.0.5-bin-windows\logs"
> --LogLevel=Debug --StdOutput=auto --ServiceUser=********
> --ServicePassword=*******(private ;-) )
> 
> 
> 
> This is the foreign program, I know the principal functions but no lines of
> code.

This is not a problem either. If you do not know how to run a Java program in 
general, that could be a problem.

> > How is that application run when you do not use your wrapper?
> 
> yes. A CMD- File with the command java -cp ... .


Ahh - here is your answer. You must translate every option of the 'java -cp 
...' which is produced by the CMD-File into options that the Commons Daemon 
installer understands.
Try adding an "echo on" just before the 'java -cp ...' command inside the 
CMD-File. When you run it, you will see the entire java command that is 
launched, along with every option that you must translate.
You will also need to add some new information to describe the service itself - 
the service name, description, log files, service user, etc. But, focus on the 
Java-specific pieces first.


For example, here is a result of putting an 'echo on' inside catalina.bat (for 
Tomcat 5.5.31):

Mon 19:17:06>"c:\jdk1.6.0_12\bin\java"  
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.util.logging.config.file="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\conf\logging.properties"
   
-Djava.endorsed.dirs="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\common\endorsed"
 -classpath 
"C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\bin\bootstrap.jar" 
-Dcatalina.base="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31" 
-Dcatalina.home="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31" 
-Djava.io.tmpdir="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\temp" 
org.apache.catalina.startup.Bootstrap  start

To make this command run as a Windows Service started by Apache Commons Daemon, 
you could use the following command to install it (to use prunsrv.exe + 
jvm.dll):


prunsrv //IS ^
--Jvm=c:\jdk1.6.0_12\jre\bin\server.jvm.dll ^
++JvmOptions=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager ^
++JvmOptions=-Djava.util.logging.config.file="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\conf\logging.properties"^
++JvmOptions=-Djava.endorsed.dirs="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\common\endorsed"
 ^
--Classpath="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\bin\bootstrap.jar"
 ^
++JvmOptions=-Dcatalina.base="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31"
 ^
++JvmOptions=-Dcatalina.home="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31"
 ^
++JvmOptions=-Djava.io.tmpdir="C:\work\appservers\tomcat\5.5\apache-tomcat-5.5.31\temp"
 ^
--StartMode=jvm ^
--StartClass=org.apache.catalina.startup.Bootstrap ^
++StartParams start


Next, add options for logging and for stopping the service.


To be more precise (ie - use the JDKs 'default' jvm, as the original command 
does), you would want to use a start mode of Java:

prunsrv //IS ^
--JavaHome=c:\jdk1.6.0_12 ^
--StartMode=Java ^

That would launch c:\jdk1.6.0_12\bin\java.exe as a separate process.

Hopefully this helps.


--
Adam M.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to