File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Apache foundations' prunsrv.exe issue

 
priyas sakorikar
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am trying to make a windows service with java.I used Apache foundations' prunsrv.exe for the same.The code written is



I compiled this code and tried to run it at commandline with following statement:


MyService1.exe //IS//MyService1 --Install=MyService1.exe --Description="My Java Service" --Classpath= C:\Documents and Settings\Prv --StartMode=java --StartClass=myService1.MyService1 --StartParams=start --StdOutput=auto --StdError=auto --JavaHome=c:\Program Files\Java\jdk1.6.0_21\bin --StartMethod=start --Jvm=C:\Program Files\Java\jre6\bin\client\jvm.dll


I tried to start this from administrative tools -> Service But could not. On command prompt I tried MyService //TS//MyService which is used ot run service from commandline. I am gettting error:
Service 'MyService1' is missing the ImageFile

I googled it. somewhare I found that if I copy msvcr71.dll from jdk/jre/bin to system32 directory the problem will be solved. But it didnot work.
Please do help at the earliest.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must place any parameters that include directories with spaces in their paths within quotes. For example:

. . . "--Jvm=C:\Program Files\Java\jre6\bin\client\jvm.dll"

If you don't it will be interpreted as two different parameters, with "--Jvm=C:\Program" being the first, which is meaningless.
 
priyas sakorikar
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried that.. but now i am not getting any output at console.

I tried to change the name of the exe again and then tried with //TS option directly like

MyService1.exe //TS//MyService1 --Install=MyService1.exe --Description="My Java Service" --Classpath=" C:\Documents and Settings\Prv" --StartMode=java --StartClass=myService1.MyService1 --StartParams=start --StdOutput=auto --StdError=auto --JavaHome="c:\Program Files\Java\jdk1.6.0_21\bin" --StartMethod=start --Jvm="C:\Program Files\Java\jre6\bin\client\jvm.dll"

I am getting following Error message along with one warning :

[2011-07-21 10:04:19] [warn] The system cannot find the Registry key for servic
e 'MyService1'
[2011-07-21 10:04:19] [error] Load configuration failed
[2011-07-21 10:04:19] [error] The system cannot find the file specified.
[2011-07-21 10:04:19] [error] Commons Daemon procrun failed with exit value: 2 (
Failed to load configuration)
[2011-07-21 10:04:19] [error] The system cannot find the file specified.


please give some solution at the earliest..
 
priyas sakorikar
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have done some thing funny.. but it removed previous error/s.But now got ClassnotFoundException
this is what i have done :
I copied prunsrv.exe,prunsrvmgr.exe,msvcr71.dll jvm.dll,rt.jar,java.exe to the same folder where my application is available.Now i executed this with

MyService1.exe //IS//MyService1 --Install=MyService1.exe --Description="My Java Service" --StartMode="java" --StartClass="myService.MyService1" --StartParams="start" --StartMode="java" --Jvm="jvm.dll" --JavaHome= . Classpath= .

This is what I am getting now:
C:\Prv>Service //TS//Service
java.lang.NoClassDefFoundError: myService1/MyService1
Caused by: java.lang.ClassNotFoundException:myService1/MyService1
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: p.Service. Program will exit.
Exception in thread "main"


It is like
unable to solve this. Please ignite my mind.

Thanks!!!
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you point me to some documentation for myservice1.exe, or tell me where to download it from? I am not familiar with it, and thus can be of little help.
 
priyas sakorikar
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
myService1.exe is nothing but prunsrv.exe which is from Apache foundation. prunsrv.exe can be renamed if required. Tomcat.exe which we use is the same prunsrv.exe with name changed to Tomcat.

prunsrv is used to create daemon.I am trying to make my application MyService1.java-> MyService1.class as a windows application.


You can find more information for this on Prunsrv site.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic