Running Websphere Liberty as a windows service - websphere-liberty

I know that full Websphere has a utility that allowed you to create a windows service to start and stop a server. But i have not seen anything like that for liberty.
Do i use a 3rd party bridge like http://nssm.cc ? or is there another way.

Add WAS as a windows service (with startup type set to automatically)
Open Command Prompt with Administrator rights (Run as Administrator), then use following command:
sc create WASLibertyV85 binPath="C:\IBM\WebSphere\Liberty\bin\server.bat start simpleServer" DisplayName="IBM WebSphere Liberty V8.5" start=auto
where "simpleServer" is the name of the server.
C:\Users\Administrator>sc create WASLibertyV85 binPath="C:\IBM\WebSphere\Liberty\bin\server.bat start simpleServer" DisplayName="IBM WebSphere
Liberty V8.5" start=auto
[SC] CreateService SUCCESS
Note: WAS Liberty server can be started and stopped using the following commands:
To start it: C:\IBM\WebSphere\Liberty\bin\server.bat start simpleServer
To stop it: C:\IBM\WebSphere\Liberty\bin\server.bat stop simpleServer
ATTENTION:
When Service is started manually (sc start WASLibertyV85) or thru Service interface following problems "can" appear. This error does not impact the server to start.
C:\Users\Administrator>sc start WASLibertyV85
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.

In WebSphere Liberty in 17.0.0.1, there is a new set of options in the "server" command.
server registerWinService <server name>
server unregisterWinService <server name>
server startWinService <server name>
server stopWinService <server name>
The services can also start and stop via the Windows services control panel.

There is no builtin integration with Windows service, so you'll have to find a third party solution.
I have no experience with them, but you might also look at Java Service Launcher or Java Service Wrapper.

I am using below third party tool..
http://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-11.07/

Related

Installing JBOSS EAP 7.4 on Windows Server – Account and Shutdown problems

I´m trying to install JBOSS EAP 7.4 on Windows Server as a service and I´m having trouble with two issues. All batch files where executed from the command line (cmd.exe) in admin mode.
Installation of Service with local system account
I´m using the service.bat to install it as a service. When checking in the properties of the service for the user context, it says it was installed under a Local Service user.This leads to numerous errors in the startup log, as the service is not allowed to access the file system in R/W mode. Manually setting this to “Local System Account” solves the problem, it runs just fine.
So, how do I configure the installation script that the service will use “Local System Account” or, how can I grant R/W access to this “Local Service”?
Shutdown
The manual states, that you must use the parameter /jbossuser (and password) for the installation. If I don´t, it is not possible to shut down the service via the Windows Services Tool, timeout…
If I add a user to the installation, it can be shutdown. As long as it runs in the “Local Service” context. If I change it to Local System Account, it doesn´t shutdown anymore, timeout…
Beside, this is a productive installation on a virtual server. It will not be possible to have a permanent, dedicated user on such a machine.
How do I configure this correctly?
Current installation params, generated by the service.bat:
"D:\jboss-eap-7.4.6\jboss-eap-7.4\bin\prunsrv.exe" install MyApp
--DisplayName=MyApp
--Description="JBoss Enterprise Application Platform 7"
--LogLevel=INFO
--LogPath="D:\jboss-eap-7.4.6\jboss-eap-7.4\standalone\log"
--LogPrefix=service
--StdOutput=auto
--StdError=auto
--StartMode=exe
--Startup=manual
--StartImage=cmd.exe
--StartPath="D:\jboss-eap-7.4.6\jboss-eap-7.4\bin" ++StartParams="/c#set#NOPAUSE=Y#&&#standalone.bat#-Djboss.server.base.dir=D:\jboss-eap-7.4.6\jboss-eap-7.4\standalone#--server-config=standalone.xml"
--StopMode=exe
--StopImage=cmd.exe
--StopPath="D:\jboss-eap-7.4.6\jboss-eap-7.4\bin"
++StopParams="/c jboss-cli.bat --controller=localhost:9990 --connect --user=ABC --password='12345' --command=:shutdown"
Any help is appreciated!

Error configuring wildfly as a windows service

I am using wildfly 10.1 in standalone mode and need to use it as a service.
I copied the service files to the bin folder and then installed the service from the command prompt.
This works well, except that it is impossible to stop the service without killing the process using taskkill.
As a fix, I tried replacing
set DESCRIPTION="WildFly Application Server"
with
set DESCRIPTION=WildFly Application Server
in the service.bat file as mentioned here. But this is causing the service not to start. The system log says:
The Wildfly service terminated with the following service-specific
error: Incorrect function.
How can I fix this issue and get the service starting and stoppping normally?
Add System variable JAVA_HOME to System variable and try to start the service. It worked for me.

How to run JMeter server as a service in windows

Is it possible to run JMeter server as a service in windows?
Currently I'm just logging in and running it manually, but from time to time I have to restart this machine and I would like to make JMeter server run automatically after each restart (even no user logs in after restart).
To create windows service sc create serviceName binpath= "path\to\exe"
You can also create a shortcut/bat file in the windows startup folder to start the JMeter. C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
You can also have a look at this - to start a program using windows task scheduler w/o user log in.

How to enable JMX on tomcat7 running as Windows service?

I have googled this extensively before posting it here. I've been trying to find out a way to enable JMX Access on a Tomcat instance installed as Windows service. Its quite straightforward when Tomcat is invoked via the startup.bat script, one just needs to set the CATALINA_OPTS environment variable to something like "-Dcom.sun.management.jmxremote.port=1234 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
But how do i get the Tomcat Windows service to read these options? I tried this:
C:>tomcat\server\bin> service.bat install #install the Tomcat7 windows service
C:>tomcat\server\bin> tomcat7.exe //US//Tomcat7 ++JvmOptions "-Djava.io.tmpdir=$INSTDIR\server\temp;-XX:MaxPermSize
=256m;-Dcom.sun.management.jmxremote.port=8090;-Dcom.sun.management.jmxremote.au
thenticate=false;-Dcom.sun.management.jmxremote.ssl=false" --JvmMs 256 --JvmMx 1
024 #update the installed service using the //US switch; set tmpdir, JMX access and heap size
When i start the service from Services panel, the service fails to start and i get the following error on the logs\tomcat7-stderr-yyyy-mm-dd.log file:
yyyy-mm-dd hh:mm:ss Commons Daemon procrun stderr initialized
Error: Invalid com.sun.management.jmxremote.port number: 8090 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
I don't have a Java background, am i trying to achieve something outlandish here? Please advise.
Answering my own question; turned out to be easier than i thought.
Following needs to be done, for enabling JMX access for Tomcat installed as a Windows service, that has a name "ApacheTomcatWindowsServer" for example:
Install Tomcat as Windows service, either using the command (first cd into \bin\ )
service.bat install
or your custom scripts.
Enable Apache Service Manager for the installed service using the following command:
tomcat7w.exe //MS//ApacheTomcatWindowsServer
This should start Apache Service Monitor program on your system tray. Click on its icon. select 'Configure', click on the 'Java' tab and append the following on the 'Java Options' text box, one option per line:
-Dcom.sun.management.jmxremote.port=8090
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
Save and exit and restart the service.
To connect to the JMX console, fire jconsole from your JDK installation, click 'New Connection', specify 'Remote Process' and enter hostname:8090.
you can also uninstall the service by
service.bat remove
then edit the service.bat and add the parameters in your StartPath and add the options
-Djavax.management.builder.initial=;-Dcom.sun.management.jmxremote.port=8090;-Dcom.sun.management.jmxremote.authenticate=false;-Dcom.sun.management.jmxremote.ssl=false
here is the sample StartPath in my file
--StartPath "C:\tomcat7\" --Startup auto --JvmOptions "-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_BASE%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;-Djava.rmi.server.hostname=;-Djavax.management.builder.initial=;-Dcom.sun.management.jmxremote.port=8090;-Dcom.sun.management.jmxremote.authenticate=false;-Dcom.sun.management.jmxremote.ssl=false" %JAVA_OPTS% ^
re-install the service by
service.bat install
then start Tomcat to apply changes

server not starting with NoServerDefinedException (RAD/WebSphere)

I am using RAD 7 with WebSphere 6.1, after creating a new profile and a new server I am unable to start the server. The server fails to start with this error:
ADMU0128I: Starting tool with the AppSrv03 profile ADMU3100I: Reading
configuration for server: newserver
ADMU0111E: Program exiting with
error:
com.ibm.websphere.management.exception.NoServerDefinedException: No
configuration defined for server: newserver
This implies that there is no server with the name newserver.
How did you create the profiles? If i recall correctly, if you create a standalone server profile in WAS 6.1 the name of the server is a sacred "server1".
You have to run scripts to change the name of the server from "server1" to anything meaningful. I am guessing you haven't done that.
Go to the runtimes directory of your RAD and run the command serverstatus.bat and this would list the server names for that profile (run it froom your profile's bin directory).
This should tell you the server names. Run start server from within the command line and ensure that the server runs's properly.
This is what I would do for a start to move forward
HTH
Manglu
What command are you using to start the server here? I am assuming "newserver" is the name of profile here, so you can start the server using the following command
startServer server1 -profileName newserver
If you have only one profile then you don't need to specify profile name
startServer server1

Resources