Vertx Module .jar running as Windows Service with Procrun Deamon

759 views
Skip to first unread message

Ryan Conrad

unread,
Dec 6, 2013, 3:47:32 PM12/6/13
to ve...@googlegroups.com
Hello All,

I am trying to use this: http://commons.apache.org/proper/commons-daemon/procrun.html

To have my Vertx Web Server Module run as a Windows Service, using the StartMode's of jvm/java and specifying the StartClass path.

In the documentation of Procrun though, it says that those modes can only be used with a "static void" starting method, that takes in (String args[]), so basically like a static void main(String args[]).


My Dilemma:

I need to know if there is any way to have a static Verticle so I can place it in a 'static void' method like this.  I really do not and probably will not embed it in there, with Vertx vertx = Vertx.newVertx(); because that is not how vertx should be used.

Has anyone had success making a verticle into a windows service?  Using procrun or any other tool?

-Ryan C.

Tim Fox

unread,
Dec 7, 2013, 3:05:11 AM12/7/13
to ve...@googlegroups.com
You could build your module as a fat jar (see docs). All executable jars have a class (FatJatStarter) with a main() method.

Or you could create your own starter class with a main() create a platform manager and deploy your verticle programmatically (see embedding guide - embedding the platform)
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ryan Conrad

unread,
Dec 12, 2013, 1:20:47 PM12/12/13
to ve...@googlegroups.com
Does version 2.0.2-final have the fatjar commands?  I tried running vertx fatjar <modname> and it just pops up with the man page text for the command 'vertx'.

Finn Bock

unread,
Dec 12, 2013, 2:11:09 PM12/12/13
to ve...@googlegroups.com
[Ryan Conrad]:
Does version 2.0.2-final have the fatjar commands?  I tried running vertx fatjar <modname> and it just pops up with the man page text for the command 'vertx'.

No, you need at least 2.1M1 for fatjar support.

regards,
Finn

Ryan Conrad

unread,
Dec 12, 2013, 2:42:15 PM12/12/13
to ve...@googlegroups.com
Thanks Finn,

I got success with the fatjar!  Since it does have a main start point the Procrun Daemon worked well with it, so I can have my server up as a windows service which is very cool.

Here is the .bat file if anyone is interested:

prunsrv.exe //IS/VertxMod ^
    --DisplayName="Vertx Manager Server" ^
    --Description="Starts and manages the manager webserver." ^
    --LogLevel=Debug ^
    --LogPath=%CD% ^
    --Classpath=%CD%\mod-web-server-2.0.0-final-fat.jar ^
    --StartMode=java ^
    --StartClass=org.vertx.java.platform.impl.FatJarStarter ^
    --Startup=auto ^
    --StdOutput=auto ^
    --StdError=auto ^
    --StopMode=jvm ^
    --StopClass=io.vertx.mod.StopWebServerService ^
    --StopMethod=stop 
goto End

Ryan Conrad

unread,
Dec 12, 2013, 3:58:38 PM12/12/13
to ve...@googlegroups.com
One last thing to finish this Windows Service off.  I need to know some fatjar specifics.

I need to knoww hen a FatJar end its execution, since I am making a windows service, I must be able to stop it.  If I undeployed all my verticles on the module running, will it end execution and delete the temporary directory where it unzipped itself?

Basically if I dont have any executing code (program is dead), will it end itself?

-RC

Quinn Đức

unread,
Jun 2, 2015, 11:14:14 PM6/2/15
to ve...@googlegroups.com
Have you successed on this requirement, Ryan?
I'm stucking with the same issue as yours, I would very appreciate with your help.

Stephan Wissel

unread,
Mar 3, 2016, 8:26:40 AM3/3/16
to vert.x
Kind of an old thread.... Do you have the sample commands/configs/steps published somewhere for reference?
Reply all
Reply to author
Forward
0 new messages