Web Deployment Assembly not used by Tomcat7 - java

My understanding is when running tomcat inside of eclipse, during publishing... eclipse will copy files based on the settings in Web Deployment Assembly to tomcat directory. I added my app to Tomcat 7 thru Server --> "Add or Remove...", when I start tomcat, I don't see any files been copied to /usr/share/tomcat7/wtpwebapps/myapp folder. BTW, I have all the folder structure (folders) under tomcat directory, but missing all the files (like .class, .properties, .xml and ...). This is the error I am getting when start tomcat. BTW, the directory show in the pic is the directory under tomcat. I thought the publishing process copies files from eclipse to tomcat dir? It looks like it's trying to copy files from tomcat dir to somewhere else. What am I missing? My Server path and Deploy path are all correct.

It's a permission thing. Also I recommend install tomcat manually instead of running apt-get.
Either https://askubuntu.com/questions/17223/permissions-problem-when-copying-files-to-usr-share-tomcat6 or http://www.frattv.com/tomcat-can-t-start-from-ide-eclipse-luna-wtp-intellij-idea-in-ubuntu/ will work.

Related

IntelliJ IDEA Ultimate 2020.1.2 - Tomcat 8.5.55 - war file not in webapps dir

Am using IntellIJ IDEA Ultimate Edition 2020.1.2 and Tomcat 8.5.55 on macOS Catalina 10.15.5
Have setup a run configuration inside IntelliJ for Tomcat.
Am able to run Tomcat via IntelliJ IDEA and everything works (am able to run tomcat and see my webapp inside Google Chrome & see catalina.out via IntelliJ) but when I go to the webapps dir, I don't see the unpacked war file anywhere?
cd $CATALINA_HOME/webapps
ls
Directory listing:
ROOT docs examples host-manager manager
Question(s):
How can I setup / edit my Tomcat local run configuration to move the war file (whether exploded or not) inside $CATALINA_HOME/webapps?
Where is this IntelliJ generated war file located?
Configure the artifact output path to be under webapps directory.
In the artifact output directory.
Normally there is no need to change it, IntelliJ IDEA instructs Tomcat to deploy from the configured artifact output location.

How to run war file without using eclipse

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

How do I run a .war file with tomcat/maven?

I'm new to tomcat and maven configuration. I was given a single .war that has all the dependencies in it. I'm trying to figure out how to run the war file on a given port configured using a pom.xml file
I tried mvn tomcat:run-war where the .war file lives but it obviously needs a pom.xml How can I configure this to be able to run this?
If you have already compiled project with all the dependencies in it then it has nothing to do with maven (because it's a tool for building projects from source code).
In order to deploy a war file you should install standalone tomcat on your system and drop the war file into webapps directory in the tomcat installation home folder, then (re)start tomcat. Give it 20-30 seconds to launch and open http://localhost:8080/war-file-name-without-dot-war in your browser, if everything went right then you will see the deployed application.

Make IntelliJ 13 run web application from tomcat directory

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.

Where is my webapp deployed(From Eclipse to Tomcat 7)

I am trying to deploy my Web application(Dynamic web Project) from Eclipse to Tomcat 7( in Windows). Although the deployment works, I would like to see where exactly(the location) the web app is deployed. I did search for my webapp (named as 'Demo') in TOMCATINSTALLATION/webapps directory. But could not find my application('Demo') there.
Double-click on the Eclipse Tomcat server instance and have a look at the configuration. If you are using the option "Use workspace metadata" then the app is deployed in a path like
<workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmpX/wtpwebapps/<context>
Not sure about particular Eclipse case, but usually IDE deployment works by dynamically overriding CATALINA_BASE environment variable and setting it to your project output folder. CATALINA_BASE tells Tomcat to search for your wepapps, server settings, etc. in the specified folder.
So answer to your question is that the actual working code sits somewhere in your project's build folder: subfolder build for regular projects or target for maven ones.

Categories

Resources