Creating a Glassfish domain and run it as a Windows service

So, my on-going saga of ways to run glassfish as a service progresses to glassfish 3.1.1.

Here are the ant snippets I am using to create the glassfish domain and set it up to run as a windows service:

<exec executable="${glassfish.home}/bin/asadmin.bat" 
      failonerror="true" 
      output="${glassfish.home}/glassfish-create-domain.log"
      inputstring="AS_ADMIN_PASSWORD=${glassfish.admin.password}">   
   <arg value="--user"/>
   <arg value="${glassfish.admin.username}"/>
   <arg value="--passwordfile"/>
   <arg value="-"/>
   <arg value="create-domain"/>
   <arg value="--savelogin"/>
   <arg value="--checkports=false"/>
   <arg value="--adminport"/>
   <arg value="${glassfish.admin.port}"/>
   <arg value="--instanceport"/>
   <arg value="${glassfish.http.port}"/>
   <arg value="--domainproperties=jms.port=7676:domain.jmxPort=8686:orb.listener.port=3700:http.ssl.port=8181:orb.ssl.port=3820:orb.mutualauth.port=3920"/>
   <arg value="myDomain"/>
</exec>
<exec executable="${glassfish.home}/bin/asadmin.bat" 
      failonerror="true"
      output="${glassfish.home}/glassfish-create-service.log">
   <arg value="create-service"/>
   <arg value="--name"/>
   <arg value="MyServiceName"/>
   <arg value="myDomain"/>
</exec>

Leave a Reply

Your email address will not be published. Required fields are marked *