How to start a jboss as a service without rebooting the system - service

I'm struggling with the start of jboss as a service. I have a batch file i.e test.exe where i have written a script to start a Jboss as a service..
cd "C:\Program Files (x86)\empl\jboss7\bin"
service install
ECHO "Jboss Starting......."
service start
TIMEOUT /T 20
ECHO "Jboss Started
and even i tried NET START "JBAS70SVC" where JBAS70SVC is service name .
I'm able to install service but when i check status of my service in SERVICES folder of windows 7 its not started
When i reboot my system then i can see status "STARTED" and my application runs.
how can i start my service without rebooting the system ?

SC START Service
See SC /?
I need to add these chars to reach min post requirements :)

Related

Starting Wildfly as a windows service and waiting for start finished

I've been using http://commons.apache.org/proper/commons-daemon/ to create a windows service for the Wildfly startup (using exe mode as proposed in some blogs). The problem is, that the service is immediately marked as running. I have some other services that are only allowed to start once Wildfly is up and running. Making these services depend on the Wildfly service won't work, because the startup takes between 20-60 sec.
Is there a way to make procrun wait for a return value or at least for a fixed time, before the service is marked as running?
I don't use that service wrapper but the one that ships with wildfly (in the docs\contrib\scripts\service folder. (See http://www.mastertheboss.com/jboss-server/jboss-configuration/run-jboss-as-service-howto for details).
But I suspect the problem is one I see as well. wildfly starting is a quick process process - 1 or 2 seconds - but what then takes the time is deploying your ear or war files so it can actually do something useful. You can tell when that's happened by the
myEar.ear.deployed file turning up. With the wildfly service wrapper, everything is done in the service.bat script, and starting the wildfly service basically means running the code at the :commandStart label.
:cmdStart
if /I "%~1"=="/name" (
if not "%~2"=="" (
set SHORTNAME="%~2"
)
)
%PRUNSRV% start %SHORTNAME%
echo Service %SHORTNAME% starting...
goto cmdEnd
after the echo of Service starting, you could put in a sleep for 30 s
timeout /t 30 /nobreak
or you could try looking for the .deployed file and looping until its there or a .failed file is there. (A simple timeout is easier!)

Install4j service not started on machine reboot for Suse Enterprise Linux

We have created an application using Install4j. This application has a service, created by using "Install a Service" action, with "auto start" attribute set.(The application launcher is a "Service" type with unix option "Auto-start service for Linux packages".)
For CentOS7, CentOS6, ,RHEL7, RHEL6 platforms the service starts automatically when the system is rebooted.
For Suse Enterprise Linux 12.x series, the service could not be started on system boot up. It is working fine, when invoked manually by command "/etc/init.d/{service-name} start".
When we check for the deployed files, the service file is copied to /etc/init.d/ folder and corresponding entries K50{service-name}, S50{service-name} files created at /etc/init.d/rc2.d/, /etc/init.d/rc3.d/, /etc/init.d/rc4.d/, /etc/init.d/rc5.d/. The service is turned on by chkconfig for 2,3,4,5 run levels. But when we reboot the machine, this particular service is not even attempted in the startup process.
Please suggest.

Stopping Wildfly Windows Service failed

as mentioned from the title i have a problem stopping the wildfly windows service.
When i tried to stop the wildfly service via the server manager - services window the status of the wildfly service doens't change to stop from stop pending. But wildfly isn't running anymore (my web service is not reachable and also the server log says that wildfly was successfully stopped). to start the service again i have to restart the windows server.
i've tested this with different scenarios:
Windows Server 2008 R2 Datacenter + Wildfly 9
Windwos Server 2012 Datacenter + Wildfly 10
Windows 7 + Wildfly 10
I also tried to make changes in the service.bat like Chris French mentioned on https://developer.jboss.org/thread/238135?tstart=0 but there is no change.
Interessting is that the problem doens't exists on any of the scenarios when i added the service without adding any deployments to wildfly (so just the blank server). What means that i am able to start and stop the wildfly service successfully from the server manager services window when the wildfly server is "blank" and without any changes (for e.g. in standalone.xml).
So i think the problem must be my java ee project which contains a web service and a simple persistent project to access different my sql databases. In the standalone.xml i just added the mysql driver and the databases and i do some edits in the interface section (ip adress changes).
Any Ideas? Do i have to made changes in different config files (for e.g. the service.bat) when im deploying something to wildfly?
Sorry for my english and thanks a lot!
When installing the WildFly service, make sure you have the following parameters specified:
In WildFly 8: /user <username> /password <password>
in WildFly 10: /jbossuser <username> /jbosspass <password>
In the services.bat the documentation reads:
/user: username for the shutdown command
/password: password for the shutdown command
According to my experience, without these parameters, WildFly will move to status "stopping", but will not stop.
That works for me:
1. Always run the CMD as admin first.
2. If your JBOSS_HOME environment is not set, get sure that you navigate to WildFly home directory before you execute the script.
For example: cd "C:\Program Files\wildfly
It's matter, because the service.bat takes your current dir (%CD%) as JBOSS_HOME, if it's not set.
3. You’ve to install the service with a special parameter. /controller
It’s important that you tell wildfly service on which port your wildfly admin console is running.
Take a look in standalone.xml, search for “management-http”, get sure that you use the same port in parameter.
Example: (Default port is 9990)
./bin/service/service.bat install /controller localhost:9990
Done. Now start the service and wait until you can reach the wildfly console page.
After try to stop or restart the service in service.msc or with service.bat (service.bat start/stop/restart).
I had similar issue but it turned out I needed a JAVA_HOME in standalone.conf.bat under bin folder. Simply uncomment the line that sets the JAVA_HOME variable and update its value with the desired path.
set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121"
Above solution worked for me.
I had the "stopping" problem, when JAVA_HOME was set directly in jboss_cli.bat, pointing to the older jdk version previously installed on my machine. Check jboss_cli.bat for correct path of JAVA_HOME or simply use the JAVA_HOME environment variable (you might have to delete set JAVA_HOME line in jboss_cli.bat).

Wildfly server doesn't start under Windows environment

I am using Wildfly 9 under both Ubuntu an Windows servers. Sometimes, I need to restart the servers but after I stop the server, I cannot start it again. There is a red message box saying Server start failed. The detailed message is:
WFLYCTL0158: Operation handler failed: java.lang.IllegalStateException
I cannot stop Wildfly because there is a bug on Windows preventing the user from stopping Wildfly server through Services. The process stucks at Stopping but it never stops the Wildfly service. I have to restart Windows itself to make it work again.
Anyone facing this problem? How can I overcome this?
Here is how I got around the "stopping" issue.
To kill the windows service without having to reboot windows, create a batch file call it killwindowsservice.bat or whatever. Put the following in it.
set SERVICE=%1
echo Killing Service %SERVICE%
FOR /F "tokens=3" %%A IN ('sc queryex %SERVICE% ^| findstr PID') DO (SET pid=%%A)
IF "!pid!" NEQ "0" (
taskkill /f /t /pid !pid!
)
Just call your script with the name of the windows service. So for me I call my Windows Services the name of my application server instance. So for eaxmple "Server01".
So for me I would call it like:
killwindowsservice.bat Server01
And the script will kill the windows service.
The Windows service scripts that come with Wildfly 8.x+ DO NOT work on Windows 2012/2012 R2. I have not gotten them to work. I went and grabbed the jbosssvc.exe from a previous version of JBoss and customized the Windows Service scripts that come with it. And they work perfectly. I'm using these scripts on 12 Wildfly servers now without a problem.
This is how I manage Wildfly on Windows:
Open Task Manager
Eanble Command Line column under Details tab
Find Wildfly process (the path will tell you correct instance)
Kill the process
Then the server starts through admin console. You can also kill Wildfly master process and start over.

Wildfly deployment scanner

I am new to WildFly and I am trying to know more on deployment scanner process.
There are two deployment mode in WildFly auto deploy mode and manual.
If I restart WildFly, my ear files are deploying again. As per WildFly forum it should deploy again if there is a change in file(based on time-stamp).
I am running my WildFly in standalone mode.
When I run the following command:
sh standalone.sh -b 0.0.0.0
and its started within 2 minutes. Again if I restart server is taking same time.
It is re-deployed using timestamp only in a running instance. An application needs to be deployed to 'run' thus when the servcer starts it deploys the applications and stops aka undeploys them when it stops.
Whenever you deploy anything on wildfly manually ( I mean using admin console ) , it put a entry in standalone.xml ( or other xml if you configure to use them ). You will find an entry referring to it. With this during next restart it knows what to re-deploy.
In scanner mode , it know location of scanner directory and during startup , it picks content from it.
Now for >>>>> As per WildFly forum it should deploy again if there is a change in file(based on time-stamp).
Ans : If autodeployed is true ; then while server is running and you update any file , it will be picked up and wildfly will re-deploy app.
Hope this helps