I have a working WebService. I can deploy and run it from eclipse on a Tomcat Server. Now i want to run it from the command line.
The problem is that when i run the Tomcat server i can't add my web service as i do on eclipse to the server.
I tried to launch the Tomcat server like this in the command line :
tomcat
I can only add the arguments start or stop. How could i add my WebService like a do in eclipse ?
I think it could be possible with a file or something but i can't find anything that relate to my project.
Is this possible to do such a thing ?
You put your WAR file in the webapps directory of the Tomcat server and run the command line tomcat start
Using Apache Tomcat - Maven deploy plugin is my suggest:
http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/deploy-mojo.html
From command line:
mvn tomcat7:deploy
(Tomcat 8 also use the above command)
1) Create a war File and Place it in the webapps folder of your tomcat.
2) To start the server, go the bin folder and execute startup.sh
./startup.sh
3) To stop the server, go the bin folder and execute shutdown.sh
./shutdown.sh
Related
I had problem with Websphere.
I want to run test.jar in websphere.
I copy test.jar in dropins and run "sh ./server start --archive="java -jar ../dropins/test.jar"
Starting server --> ok
But console.log empty
It's not clear from your description exactly what you're trying to do, but based on your title, I assume you're trying to run a Java application. Liberty is an app server for running Java EE apps, but given that you're trying to run a file ending in .jar, that is more typical of a standalone (Java SE) app. Also, the command line you're using is mixing options, the --archive option is for specifying a target file for the server package or dump operation. See the IBM help topic https://www.ibm.com/docs/en/was-liberty/base?topic=line-server-command-options for more details. On the Liberty app server, you can deploy Java EE (not Java SE) apps by copying the .ear or .war of the app to the dropins directory. If you provide additional details about the contents of test.jar and what you're trying to achieve, you'll get a more complete answer.
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
When I compile my maven-based project I have the resulting jar file in 'target/my-application'. When I run locally my application (I use Payara Micro if this is important) I have the following in log:
Payara Micro URLs
http://localhost:8080/my-application-1.0-SNAPSHOT
How do I get rid of my-application-1.0-SNAPSHOT from URL address?
As per request, I'd say that:
What type of application is that? EAR/WAR?
war application (however, maven creates for me "payara-uber-jar"
and I run the application via java -jar filename.jar
What application server is it running on?
Payara micro
Are you using maven?
Yes, I am.
Hello according to Paraya documentation what you need to do is:
java -jar payara-micro.jar --deploy NAMETHATYOUWANT.war
And then the context path will be /NAMETHATYOUWANT
https://www.davidsalter.co.uk/payara-micro-context-path/
Actually i have two application in webapps directory of tomcat
webapps/hello_web1 and
webapps/hello_web2
I want to start and stop these to apps separably and by using command line (or any other way except using tomcat manager gui so that i can implement start and stop function manually in my program).
Please suggest me if it is possible, and if it is not possible in tomcat than suggest me web server in which it is possible.
Best way is using CURL targetting your desired command from Tomcat /manager
curl --user user:pass http://localhost:8080/manager/text/<your command>?path=/<your web appl>
here you can find list of commands
https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
in your case
Start Application
http://localhost:8080/manager/text/start?path=/yourWebAppl
Stop Application
http://localhost:8080/manager/text/stop?path=/yourWebAppl
Restart Application
http://localhost:8080/manager/text/reload?path=/yourWebAppl
There are several ways of deploying web applications in Apache Tomcat. One is the XML deployment descriptor file in the directory <TOMCATDIR>/conf/Catalina/localhost.
The content of such a file is a <Context...></Context> configuration that may look like this (eg. webapp1.xml):
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="webapp1"
override="true"
path="/webapp1"
docBase="${catalina.base}/webapps/webapp1">
... some context configuration ...
</Context>
If Tomcat finds a XML file in this directory, it will try to deploy the context defined in that file. If you remove that file from this directory, Tomcat will undeploy the web application context.
All of that can be done by command line or shell script.
Regarding to your question: You may put two context files in this directory. One for each of your web apps. To deploy one just move the file in and to undeploy one just move it out of the directory.
# deployment
&> cd "<TOMCATPATH>/conf/Catalina/"
&> mv webapp1.xml localhost/
# undeploy
&> cd "<TOMCATPATH>/conf/Catalina/localhost"
&> mv webapp1.xml ../
For more detailed information about the <Context...></Context> element refer to: The Context Container Doc Page
I'm looking into installing Jenkins, in the instructions it says
"Easy installation: Just java -jar jenkins.war, or deploy it in a
servlet container. No additional install, no database."
I understand the servlet container method, but does the above statement mean that just installing Java and running the .war file will somehow spinup a webserver and start serving http request ?
Yes, the war file contains the built-in Winstone servlet container, and running that command will start it and make it listen for requests on port 8080.
Edit: Jenkins 1.535 and above bundles Jetty (rather than Winstone). You can still run it with java -jar jenkins.war.
Jenkins comes bundled with Winstone, a very lightweight servlet container. As such, Jenkins can be started from the command line as stated by the instructions without any additional software installation.