Running website on Tomcat 7.0: Windows 2008 R2 - java

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.

Related

How to start tomcat server outside netbeans IDE

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

Intellij IDEA 13.1 - Where does it keep the deployed webapp files in tomcat server?

I use IntelliJ IDEA 13.1 and have configured a Java web application to deploy to a Tomcat server. After starting the server, if I go to my tomcat webapps folder, I couldn't see the exploded version of my web app there.
So, do IntelliJ keep the deployed files somewhere else other than the tomcat webapps folder?
Btw, I did check the answer for this question: Where is my app placed when deploying to Tomcat?. But I couldn't find my deployed files in the ${dir.to.idea.project}\YourWebApp\out\artifacts folder either.
Any help?
Typically the exploded war is built in your web-module's target directory (called either target or out by default depending on whether you use maven or not), with a .war extension on the folder. Tomcat (and most other application servers) are pointed at this directory.
However, you shouldn't, in most cases, need to know this. When you make a change to your code, IntelliJ will update the contents of the exploded war for you. You shouldn't really change it yourself, otherwise the code will get out of sync with the deployed app.
I'm using gradle and the deployed wars are in project_root/.build/package/modules/.
If this doesn't help,here is how I found out.
While the project is running I run the gradle clean task, then tomcat kindly complained
java.io.FileNotFoundException: /project_root/.build/package/modules/exploded/my.war/WEB-INF/lib/xxx.jar (No such file or directory)` How sweet of it.
I hope this helps!

Running a duplicate Java Project on Tomcat 7

I'm working on Java project for a portal. I checked out a sample portal from an svn, and pasted a renamed copy of it in the eclipse package explorer.
When I tried to run this new project on a Tomcat 7 server, I got the error message:
Could not publish server configuration for Tomcat v7.0 Server at localhost.
Multiple Contexts have a path of "/SamplePortal".
What do I need to do to get this new project to run?
All the suggestions in this thread are valid. If you extract the war file into a folder inside of Tomcat's webapps folder, it should work.
If you are trying to do it from Eclipse, make sure the file server.xml is not corrupted, or that Eclipse is not misreading it. Restart Eclipse if that is the case.
You need to change the name of your project directory or .war file so it doesn't conflict with the existing SamplePortal project.

Upate a java file in war file

I am working on a project and the project is in running state. As there is some issue in a java file and I have resolved that issue. But I don't have an idea how to update that particular java file in war file which is deployed on the company server.Please help me out.
Tomcat doesn't support hot deployment. SO you have to restart Tomcat anyhow.
And if you are going to restart it, either replace the .class file(the one which u have changed) or generate new war and then retart Tomcat. Your changes will be reflected.
Update : for hot deployment http://www.mulesoft.com/tomcat-deploy-procedures
You can replace your new java .class file into your extracted project folder under tomcat
http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Reload_An_Existing_Application
This will cause a service interruption anyway, but probably still shorter than restarting the whole server.
Note that this will only works when the web application is deployed from an unpacked directory, otherwise you will have to undeploy and deploy again the web app.
(http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Undeploy_an_Existing_Application)

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.

Categories