I am trying to run a jar (spring app) as a Windows service. I am using nssm to do so.
When I run the jar file with java -jar myjar.jar everything works fine. My webapp responds when I enter localhost:8080 where it runs.
After I run
nssm install MyService java -jar myjar.jar
nssm start MyService
I get in the console: MyService: START: The operation completed successfully
My application is usually logging to file as well, but it does not do so when running as a service. It seems like the application is not starting at all. When I try to access localhost:8080, nothing is responding.
Why isn't my app running when I start it as a service with nssm?
Related
I have a spring boot application with embedded tomcat in it. I need to run this application in Jenkins the problem is that the build goes into an infinite loop.
javaw -jar myjar.jar
does the same thing as mentioned above. It was mentioned somewhere in SO that if we append start with the above mentioned code it will work.
start javaw -jar myjar.jar
the issue with this is that Jenkins build are completed now, but the application doesnt run.
Is there any way i can solve this issue ?
Note:
Jenkins and salve is running on windows.
I need to deploy my spring boot rest api to my VPS server, to do so I installed JAVA and MAVEN. I ran it using sudo java -jar myfile.jar it is working but the problem is that after sometimes it stops and my webservice send me error 503.
I would like to know how to deploy it and run without it stopping.
PS : There is no page ".html" to be accessed that's the reason I want to deploy as JAR
So I'm deploying my Spring Boot application on an Ubuntu LTS Server. It is built with maven and running with embedded Tomcat.
I'm still new to the deployment process, what I did was:
Log into server via ssh
use scp to upload my_application.zip
unzip it in ssh
java -jar my_application.jar
Now all of that works perfectly fine and I've been using it like that for quiet some time. Now I have to make the Application to stay online and available after logging out of the shell.
I have read some documentation about running processes in background on Linux and I've tried it with nohup java -jar myApplication.jar &, with the screen command and with bg. All of them worked fine while I'm logged into the ssh.
Here comes my problem:
As soon as I end the ssh session the Web App is still available (so the process clearly didn't stop) but it just looks & behaves really weird.
CSS is not applied, JS does not work etc.
My guess would be that some paths or file system accesses are messed up, but I have no idea at all how that could origin from the ssh session.
(When I log back into ssh everything is working fine again)
Would be great if someone has a clue here
If your server has encrypted home directory, it will get re-encrypted once you log out and therefore your script will stop working. It does not have a lot of sense to have encrypted homes on servers so you can disable it.
Or just run the script from different directory and avoid working with files under home directory.
I think you should use systemd for this case.
Also You can add new system user for your app.
You can find more information here:
Spring Boot: 59.2.2 Installation as a systemd service
Ubuntu Wiki: Systemd For UpstartUsers
For example:
Create file myunit.service
[Unit]
Description=MySpringService
After=syslog.target
After=network.target
After=mysql.service
[Service]
Type=forking
PIDFile=/work/www/myunit/shared/tmp/pids/service.pid
WorkingDirectory=/work/www/myunit/current
User=myunit
Group=myunit
Environment=RACK_ENV=production
OOMScoreAdjust=-1000
ExecStart=/usr/local/bin/bundle exec service -C /work/www/myunit/shared/config/service.rb --daemon
ExecStop=/usr/local/bin/bundle exec service -S /work/www/myunit/shared/tmp/pids/service.state stop
ExecReload=/usr/local/bin/bundle exec service -S /work/www/myunit/shared/tmp/pids/service.state restart
TimeoutSec=300
[Install]
WantedBy=multi-user.target
Copy file to /etc/systemd/system/
Run:
systemctl enable myunit
systemctl start myunit
I have Jboss 4.2.3 installed and Windows Service,Log on AS is set to Local System for that service. When I deploying a small war project which is suppose to launch notepad.exe, jboss server runs the command but does not launch notepad.exe
When I run the JBoss 4.2.3 from command line with command run.bat -b 0.0.0.0 it launches notepad.exe from war project file Also when I change Log on AS for windows service to Current Windows User from which I am currently logged in and restart Jboss service it launches notepad.exe
I want to run Jboss service as Local System and have war file execute the exe, Can any one let me know how can I do that ?
I'm trying to run a java application on a server computer by using VNC (tightVNC).
I have the java application in eclipse and it runs perfectly. Then I export it to a runnable jar file and upload the runnable jar file to the server. Now I'm trying to run the application (called ABUN_0.0.0.jar) using VNC.
I use /u01/gatc/java/jdk1.6.0_10/bin/java -jar ABUN_0.0.0.jar& (I've used this for previous versions of the app and its worked perfectly). However now I get Unable to access jarfile ABUN_0.0.0.jar
instead of
/u01/gatc/java/jdk1.6.0_10/bin/java -jar ABUN_0.0.0.jar&
use this,
/u01/gatc/java/jdk1.6.0_10/bin/java -jar /**path to jar**/ABUN_0.0.0.jar &
or
if Linux System,
check ABUN_0.0.0.jar's permission level.
To give Permission,
chmod 755 /**path to jar**/ABUN_0.0.0.jar