Glassfish v3 as Windows Service

That’s is something simple but I’ve taken a long time to figure out how to set my Glassfish v3 server as a Windows Service.

After a long time doing google searching, I came across a simple solution. All that you need to do is enter in your Glassfish v3 bin directory and run the command:

c:\glassfishv3\bin\asadmin create-service

Yeah! Just it will work!

I hope this tip be useful for you too!

See you . . .

29 comments so far

  1. Adeon on

    A quick google search brought this up and you saved me countless headaches. Thanks. 🙂

  2. Steven on

    For this simple answer i googled and searched the sun and oracle pages, with no result.
    perhaps they are considering this as beta-information, but the solution given here is very relevant. Thanks 😉

  3. Thomas on

    This saved me a lot of time! Thanks a lot. 🙂

  4. Dave on

    You just saved me a ton of work. Cheers!

  5. Vagner on

    Very good, I had try other ways that don’t worked, but this time worked fine. Thank’s.

  6. elpdrino on

    Why i don’t enter to this site first?
    thank you, i lost a lot of time finding and now you save my ass

  7. Elton Garcia on

    Vlw cara ajudou d+!!!
    u rocks!!

  8. Bjørn Stenfeldt on

    Didn’t work at first, but after running command prompt as administrator, it did.

  9. James on

    so i got the service installed but when i start i get this error: Windows could not start the domain1 GlassFish Server service on Local Computer. Error 1067: The process terminated unexpectedly. I’m using glassfish 3.0.1 and windows 7.

    Wondering if anyone knows what’s up…

    • Leonardo on

      Hi James, I’ve never tested this on Windows 7. I believe for Windows 7 you should use another process

      • James on

        Thanks for the response. Any chance u would know what the windows 7 process is? The process described here is for windows xp/2003 server? I’m wondering if it was necessary to have set the JAVA_HOME system variable to my jdk root for the service to start correctly. Thanks for any help u can offer. 😉

      • Leonardo on

        Yeah! That was for Windows XP/2003 server. You can try to set the JAVA_HOME, but to work on Windows XP/2003 server that is not necessary. I don’t have a Windows 7 here to test. Try that. Good luck

      • Radu on

        I am on windows vista, I have the exactly same problem. But in my case. restarting didn’t fixed it. Any help?

  10. James on

    Okay found the issue… just have to restart the computer 🙂

    Cheers all!!!

  11. Radu on

    Ok, I managed to fix this. It’s actually a fix I didn’t find anywhere, so I hope it will help others. It was a spaces problem. So I edited the doimain1Service.xml and added quotes in the path parameters, like so
    “C:/Program Files/glassfish-3.0.1/glassfish/domains”
    same for

  12. Elly on

    You can’t imagine how long I’ve searched for this solution. Can’t believe it was this simple, thanks a lot. You’ve saved me a lot of trouble.

  13. nerses on

    Radu u r great!!!!!!!!! thanks!!!

  14. nat on

    well i have window 2003 server.
    i can create it but when i stop, it is hanging.
    error like service does not stop in time fashion way.
    then it hang, i have to kill process “java.exe” so i can restart it backup.
    Any suggestion?

    • Leonardo on

      Hi, sorry but I have not tested this on window 2003 server.

      • nat on

        find a way around if some one like
        using
        domain1Service.exe stop
        taskkill /f /im java.exe

        and it work!!!

  15. Nelma on

    Thanks a lot!

    We’ve been googling and doing scripts for this one with no results. This is a big help. The easiest way.

    Thumbs up!

  16. Femo on

    Thanks ! You just made my day

  17. Hari Prasad on

    how to deploy web service ..i created the service on command prompt ,,while deploying it says SEVERE: Shutting down v3 due to startup exception : Address already in use: bind: 8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler@1132e76 please help

  18. Gavin W on

    Has anyone tried running a GF3 service not as the Local System account? I.e. a non-priviledged user…

    I’m struggling to get it working with GF3, whereas GF2 was a piece of cake…

    Have created a user, given that use modify permissions on the entire GF3 folder, and set-up the service to logon as the created user…
    However just get the generic ‘the service on local computer started and then stopped’.

    Trying to run on Server 2003 R2.

    Any info appreciated.

    Gav

  19. geeky on

    Does glassfish service run also in client side? like windows xp pro??? ..
    if so how to run it?

  20. tmpsa on

    Thanks man, you rock! Quite simple. Works fine on Win7 x64 with GF 3.1.2.2 . For those who want to RTFM, it’s all documented in the GF Reference Manual. 🙂

  21. Barna on

    So many thanks for the info!

  22. Manjunath on

    Was very useful 🙂

  23. Carlos Ceja on

    Really useful, thanks a lot.


Leave a reply to Leonardo Cancel reply