How to start tomcat server outside netbeans IDE - java

I have created an application in Java EE, I have learned how to deploy it in the tomcat server using the manager app or by copying the war file to the webapps folder. Now I can start the tomcat server only from the Netbeans IDE.
I want to know how to start the apache tomcat server without using the IDE and run my web application from the war file deployed. If I'm headed in the wrong direction please correct me. I'm asking this to gain knowledge of how to deploy the .war file in another server system without using the IDE only the tomcat server.

The shell scripts located in "CATALINA_HOME/bin" are the most bare-bones way of getting Tomcat up and running. The two scripts capable of starting Tomcat in this directory are named "catalina" and "startup", with extensions that vary by platform.

In your tomcat installation directory, there would be a startup.bat/sh file which will start the server for you. Moreover you can see the conf folder as well if you want to change any configurations. Whatever war you copy to the webapps folder will be automatically deployed

Related

Run war file on localhost without having tomcat installed

Is there any way to run a war file on localhost without having the need to have tomcat installed on the machine? I have built a web application using gradle, spring and tomcat and I would like to be able to send the project as a war file to someone else and have them run it, even if they don't have tomcat installed.
Make it a runnable jar which contains tomcat inside. And then start the application with:
java -jar myWebApplication.jar
https://www.baeldung.com/deployable-fat-jar-spring-boot

What are the drawbacks of deploying a website using the Eclipse IDE?

I started my journey into web applications about three years ago and I'm happy to say that I've finally deployed a working website. My concern is that to deploy the website I use the Eclipse IDE and a Tomcat webserver. So basically I right click the project in Eclipse and then choose "Run As > Run on Server" and then select the Tomcat server I downloaded - from that point on the console spits out some startup messages and my website is online and ready for use. What are are some of the drawbacks of deploying a project this way. I've read just briefly about WAR files and adding them to Tomcats Webapps folder but I could neither get that working nor did I understand completely the process...so is it acceptable to just deploy the project the way I have been doing thus far by running it in Eclipse?
Generally Development machine and deployment server is different.
On Deployment server one may not have eclipse always.
WAR file is just a webarchive which includes all the necessary files. WAR makes your project portable.
Export WAR from eclipse place it in tomcat webapps in any machine and restart tomcat.
You should have your webapp successfully running on that machine.
That's a fine way for deploying a server when you're learning, or always have the server (the only server!) running on your development machine.
If you need to push to a remote machine, it won't work, and you'll need to learn other methods then, but for now, what you're doing is fine.

Running website on Tomcat 7.0: Windows 2008 R2

My team and I originally had a server running through Eclipse (Java EE), but wanted to switch it to running on the Tomcat 7.0 service found in Windows 2008 R2. We are completely clueless on what files to put where in the Tomcat folders found in program files. The entire server has gone down and we can't go back to the original setup. Any help is appreciated. All we're asking is where do we put our JSP/ROOT ect folders in the Tomcat program files.
Copying JSP files are not good idea rather you can package your jsp file into an archive file called WAR file. You can export your project from Eclipse IDE as a WAR file.
After creating the WAR file (.war), you need to find out tomcat installation directory and its called tomcat HOME. Now you just need to copy the WAR file into the following folder:
{TOMCAT HOME}/webapps/<project>.war
I'll add to the answer.
If you have folders of running applications from before you can put 'em under
{TOMCAT HOME}/webapps/
war file will un-zip after you start the service.
once the war is un-zipped, you can delete it, but only after you stop the service for the first time after war deployment.

How do I deploy a war file onto tomcat 6 using eclipse Juno

I am not familiar with build processes on Eclipse with javascript (HTML5) and Java resources. But recently I got a war file from someone who asked me put it on tomcat (since the server where I used to access the project from is down). I tried putting it under C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps... and then I restarted the tomcat which I have mounted on eclipse... and then I thought I will be able to access the project using localhost
http://localhost:8080/<warprojectfilename>
But I get 404...
Could someone let me know how could I deploy it on tomcat and access it using localhost like a website.
Thanks
it looks like you have got some other Tomcat (or other server using port 8080)running on your machine... please check which tomcat instance is running and stop it, or stop any other server running service that you mentioned is working fine...
You can stop tomcat server by going in to tomcat/bin
and execute
sh shutdown.sh
or
shutdown.bat
in windows
and to deploy war file to Tomcat server :
1) go to your Tomcat path
2) open webapps directory
3) paste your war file here
4) restart tomcat
5) now you should be able to access your app
File -> import ->Web-War file this will import your .war as a web project.
goto Servers->tomcat->web modules-> add the imported web project. restart tomcat. you should be good
Since it was all static resource (javascript files)... I decided to extract the whole thing in a static web project on eclipse and it worked.

Debugging java web application with secondary tomcat folder serving static content

I have a java web application which I can debug using IntelliJ or Eclipse through a local machine tomcat 7 configuration (localhost:8080/javaapp)
I was hoping to be able to reference static content not part of the java application - installed locally at /staticapp. However, IntelliJ launches tomcat with only the java application available, the other application is not launched or serving the files.
Is there a way to configure tomcat so that either:
- the /staticapp is also started when the /javaapp is launched so it may be accessed from /javapp pages
- tomcat will always serve the static content from the /staticapp folder while running... the staticapp folder tree is not a real "web application", it only contains folders with javascript/css/images
Thanks
In eclipse, open you Tomcat server settings and go to the "Server Locations" option. Choose "Use Tomcat installation".
Next, change the deploy path to Tomcat's (original) /webapps folder, instead of the eclipse setting wtpwebapps.
Add your static app manually (folder or .war file) or though eclipse to the webapps folder, then when you publish your "javaapp" Tomcat should start each web application in its deploy path.

Categories