|
From: Leif M. <le...@ta...> - 2007-03-17 01:51:23
|
Almond,
You need to read the documentation again :-)
http://wrapper.tanukisoftware.org/doc/english/integrate.html
Most likely method #1 will work for you:
http://wrapper.tanukisoftware.org/doc/english/integrate-simple-win.html
There were a few problems with what you said below:
1) You should start with a clean directory and copy the required Wrapper
files into your
application rather than the other way around. There are some things
that you will not
need such as the wrappertest.jar file.
2) You should create your wrapper.conf file based on the template file:
WRAPPER_HOME/src/conf/wrapper.conf.in rather than using
WRAPPER_HOME/conf/wrapper.conf.
3) As specified in the documentation and in the wrapper.conf file,
the wrapper.java.mainclass property is used to specify the main class
passed to the JVM. In most cases however, this is not your application's
main class. The Wrapper has some code which must be initialized in the
JVM first. This is covered clearly in the above documentation. Try this:
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
Your main method is then specified as the first parameter to the above main
class.
wrapper.app.parameter.1=<YourMainClass>
4) From the output that you sent however, it looks like your main class
starts, prints a startup message, a shutdown message and then exits.
Even if you do all of the above correctly, your application will still quit
immediately because your main method does not appear to be designed
to stay running. Running your class standalone in Java would have the
same effect.
The Wrapper works correctly in cases like this. But from your post, it
sounds like you are expecting that the JVM stay running. Your application
needs to start at least one non-daemon thread within the JVM that does not
terminate. When all such threads have terminated, the JVM things the
application has completed and the JVM will exit.
5) When you are still trying to get things working, I suggest running the
application in a console window using TestWrapper.bat rather than running
as a service. It is easier to see what is happening. Once that is all
working,
THEN, you should try it as a service.
6) Not required, but I suggest copying your bat files out of the
WRAPPER_HOME/src/bin and then naming them after your application.
Let me know if you have more questions...After checking out the docs of
course.
Cheers,
Leif
Almond Khan wrote:
> All, I downloaded the source code and made my simple example with help
> of code given on site(jar file is attached). That is very simple
> example. My start method and stop method simply print message and then
> exit.
>
> 1- I created jar file
> 2- I put jar file in lib with wrapper.jar and wrappertest.jar
> 3- I added classpath in conf file
> wrapper.java.classpath.3=../lib/myexample.jar
> 4- I modified Main class in conf file and pointed it to my example
> wrapper.java.mainclass=org.tanukisoftware.wrapper.example.Main
>
> But when I am running , my service starts and stops(I assume). How did
> I figure it out ??
>
> C:\wrapper-delta\wrapper-delta-pack-3.2.3\bin>InstallTestWrapper-NT.bat
> wrapper | Test Wrapper Sample Application installed.
>
> C:\wrapper-delta\wrapper-delta-pack-3.2.3\bin>StartTestWrapper-NT.bat
> wrapper | Starting the Test Wrapper Sample Application service...
> wrapper | Test Wrapper Sample Application started.
>
> C:\wrapper-delta\wrapper-delta-pack-3.2.3\bin>StopTestWrapper-NT.bat
> wrapper | The Test Wrapper Sample Application service was not running.
>
> C:\wrapper-delta\wrapper-delta-pack-3.2.3\bin>UninstallTestWrapper-NT.bat
> wrapper | Test Wrapper Sample Application removed.
>
> So service was started but it stopped itself. I tried to start service
> from windows service controller, it showed it was started but when I
> refreshed service controller, it was not running.
>
> I looked at log and it also says the same thing.(Application is
> started and Application is stopped are my custom messages)
>
> STATUS | wrapper | 2007/03/16 12:53:08 | Test Wrapper Sample
> Application installed.
> STATUS | wrapper | 2007/03/16 12:53:12 | Starting the Test Wrapper
> Sample Application service...
> STATUS | wrapper | 2007/03/16 12:53:12 | --> Wrapper Started as Service
> STATUS | wrapper | 2007/03/16 12:53:12 | Launching a JVM...
> INFO | jvm 1 | 2007/03/16 12:53:12 | Wrapper (Version 3.2.3)
> http://wrapper.tanukisoftware.org
> INFO | jvm 1 | 2007/03/16 12:53:12 | Copyright 1999-2006 Tanuki
> Software, Inc. All Rights Reserved.
> INFO | jvm 1 | 2007/03/16 12:53:12 |
> INFO | jvm 1 | 2007/03/16 12:53:13 |
> INFO | jvm 1 | 2007/03/16 12:53:13 | Application is started!
> INFO | jvm 1 | 2007/03/16 12:53:14 |
> INFO | jvm 1 | 2007/03/16 12:53:14 | Application is stopped!
> STATUS | wrapper | 2007/03/16 12:53:14 | Test Wrapper Sample
> Application started.
> STATUS | wrapper | 2007/03/16 12:53:15 | <-- Wrapper Stopped
>
>
>
> I wonder why stop() method is getting called and why service is
> stopping itself.
>
> Any help would be really appreciated. Please find an attached jar file
> and conf for my code
>
> Thanks,
>
> Khan
>
> */Chuck Williams <ch...@ma...>/* wrote:
>
> Wrapper is great to run your app as either a windows service or
> linux daemon.� To try something quickly, read the Quick Start on
> the project home page at
> http://wrapper.tanukisoftware.org/doc/english/introduction.html
>
> Chuck
>
> Almond Khan wrote on 03/14/2007 01:47 PM:
>> Hi,
>>
>> I googled for converting java application and ended with this
>> project.
>>
>> We have embedded tomcat in our application and we use console to
>> start/stop it.
>>
>> Now we are moving forward and we want to run applictaion as
>> Windows service and I am wondering how can I convert my .class
>> into Windows service.
>>
>> "So question is that how can I convert .class file into windows
>> service"
>>
>> Any help is appreciated
>>
>> Thanks,
>>
>> Noman
>
|