I have deployed one war to tomcat7 webapps directory.
But when tomcat is starting it runs application twice.
What could cause this problem?
I have already met this case, but it was when I was mapping domain to webapp, but know all the configuration is standart, and there are two instances running.
This can happen if you have a symbolic link somewhere in your webapp directory, that points to a war file or exploded war directory. Tomcat simply follows those links and starts all application it finds.
Also check the configuration in conf/server.xml and make sure you haven't set up any other directories as appBase.
It might be possible that in your webapps directory you might have another war or another webapp already present.
Related
I have done a maven project in my eclipse and was generated a war file in my system.I want to run that war file in another system without using eclipse.Is it possible to run without downloading JDK and eclipse..
You can refer the following link to run WAR with tomcat -
Deploy war in Tomcat
or a video - Deploy the war in Tomcat Video
Well, if this suffice your requirement, it is good else please mention the specific issue, if there is that you are facing.
The .war file stands for 'Web Archive'. This is a packaged web application, which can be run by an Application server (Examples: Glassfish / Tomcat / Weblogic, Wildfly)
The process of making an application server run the .war file is called Deployment.
For example, a .war file can be deployed to Tomcat application server (I.E., made to run by tomcat) by simply copying the .war file to the /webapps folder of Tomcat.
Here are the steps to deploy .war file on Tomcat:
Step 1: Build the .war file for the web application.
Suppose that the .war file is "my-app.war".
Verify that the my-app.war file contains the following:
/WEB-INF/ folder and
/WEB-INF/web.xml file
Step 2: Verify the following settings in Tomcat config.
(This step can be skipped if Tomcat was installed with default settings)
autoDeploy : true
unpackWARs : true
(Note: These are default values. These will be set to true if Tomcat is installed with default settings.)
Step 3: Remove any conflicting entries or stale entries from Tomcat config.
For example, if the new app to be deployed is 'my-app', then make sure that the existing config of Tomcat does not have 'my-app' already registered for another application.
This can be checked by trying to browse http://localhost:8080/my-app.
If this link works, then it means that the name 'my-app' was already taken.
Another way to find if the name already exists:
If Tomcat is installed in "C:\Tomcat8",
then the registration for 'my-app' can be found at
C:\Tomcat8\conf\Catalina\localhost\my-app.xml
Step 4: If steps 1, 2, 3 are cleared, then copy the my-app.war file to 'webapps' folder of Tomcat.
If Tomcat is installed in "C:\Tomcat8",
then the my-app.war file can be copied to
C:\Tomcat8\webapps\my-app.war
Step 5: Wait for Tomcat to automatically detect my-app.war file inside webapps and extract it to webapps/my-app folder.
Tomcat usually does this automatically. However, this process may sometimes not work either due to file permissions (Example: User does not have write permissions on webapps folder, or Tomcat is installed to C:\program files, which has read-only permissions) or due to folder being locked.
Try restarting the Tomcat service to fix the issue.
If restarting Tomcat does not fix the issue, then verify permissions of Tomcat service and re-install / execute Tomcat with the necessary permissions.
More information:
https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Top-5-ways-to-deploy-a-WAR-file-to-Tomcat
https://tomcat.apache.org/tomcat-8.0-doc/deployer-howto.html
https://dzone.com/articles/how-deploy-war-file-using
https://developer.jboss.org/thread/268260
I'm having issues with running my application through intellij. I would like intellij to not run my application from its own folder (C:\Users[name].IntelliJIdea13...) but instead place my war file or exploded war into my tomcat /webapps folder and run form there. What is happening is i'm having issues accessing resources as my servletcontext points to my tomcat instance by the exploded war is not there, its in Ideas folder structure.
Currently I set CATALINA_BASE in my launch options which allows me to pull the correct keystore to run but that is living outside of the war.
I have tried changing where my artifact outputs too but what ends up happening is I get weird webclassloader errors due to library collision.
I am using Tomcat 7.0.50 server.
How can I delete the tomcat cache memory without restarting the server?
You can find how to delete Tomcat Cache here
You can delete the "work" folder under Tomcat Home. Even if it does allow you to delete the folder while tomcat is running, I would guess it will cause troubles to your running site.
If your Tomcat installation is configured to have a ROOT directory for your webapp, you will have to find a path like
/tomcat/base-myapplication/webapps/ROOT/
which contains your deployed webapp.
Just delete everything inside, including sub directories META-INF, WEB-INF, VAADIN etc., and then re-deploy your webapp. This worked for me even with tomcat running, but it doesn't hurt to restart tomcat after deployment.
I use tomcat 7 via Intellij IDEA 13. Tomcat home is /usr/share/tomcat7, tomcat base is /var/lib/tomcat7. /var/lib/tomcat7/webapps contains single folder ROOT where I can find initial tomcat webapp with different instructions.
So where can I find my local deployed webapp? or where is the server root folder?
/var/lib/tomcat7/webapps is the place where you should find your local deployed app, right next to the ROOT folder you see.
If it is not there, then there might be some problem in your deployment.
Are you sure you have deployed it correctly?
I have a web application (WAR) that I want to deploy in Tomcat 5. I'm using Maven 3 and the problem is that when I deploy the WAR, Tomcat automatically copies the context.xml file located in META-INF directory. The file is then renamed with the WAR name and the context path of the application will be the WAR name. By default, it is artifactId-version.war.
The problem is that some client code uses the context path to connect to the web application and I don't want to change the code each time a new version of the web application is deployed. Is there a way to set the context path to another fixed value?
I can't use the tomcat plugin for now. Setting the Context path in the context.xml doesn't help. Also, tomcat documentation precises that it's not recommended to set the Context path in the server.xml. Also, I don't want to change the WAR name, it's important for me to always keep track of the artifact version.
Thanks
You should use the ${project.build.finalName} parameter in your war plugin config so that you can ensure that the war never changes names.