I am deploying an application from IntelliJ IDEA to the local Tomcat server. I thought the apps you deploy are placed in the webapps folder, however it does not turn up there.
Is this correct? Where is it?
Just for reference, the corresponding folder on a mac (for IntelliJ 13) is:
/Users/<username>/Library/Caches/IntelliJIdea13/tomcat/
Yes, If you are using IntelliJ IDEA the application does not turn up on Tomcat webapps directory. Your artifacts are in directory, for example:
${dir.to.idea.project}\YourWebApp\out\artifacts
This is default directory created by IntelliJ.
Tomcat configuration is in the different folder. I am using windows 7. So it is:
C:\Users\User\.IntelliJIdea10\system\tomcat\YourApplicationName
If you are using Intellij IDEA your artifacts are deployed directly from output directory: ${project.dir}\${web.module}\out\artifacts or ${project.dir}\${web.module}\target if you're using Maven and follow Standard Directory Layout.
Tomcat configuration is in different folder.
Mac: /Users/${user}/Library/Caches/IntelliJIdea${version}/tomcat/
Linux: /home/${user}/.IntelliJIdea${version}/system/tomcat/
Windows: C:\Users\${user}\.IntelliJIdea${version}\system\tomcat\
From IntelliJ 2020 onwards it has moved to:
C:\Users\${user}\AppData\Local\JetBrains\IntelliJIdea${version}\tomcat
If you're following the standard maven approach, which is highly recommended, then your output goes to the target directory, not out. With the maven approach you'll probably have multiple modules under your project root, and the target directory will be found under each module. The web application is then built into an exploded directory named after the module, but with .war as an extension. So, you have:
project/module/target/webapp.war
I am new to IntelliJ IDEA. In my config. I add a local tomcat server. My tomcat container is run the project's target folder.
${your project's path}\target\ ${your project's name}
In this path ,you will find the file that IDEA has build. And tomcat server would run this folder.
The server log output the env variable "CATALINA_BASE" which contains the exploaded location
Related
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.
My servlet application uses JavaMail API and Java Activation Framework (JAF). I do development in IntelliJ IDE. TomCat runs on the same local Windows machine. When I try to run my Servlet from IntelliJ I have error related to fact TomCat not finds mentioned libraries. What is the right place to store libraries for TomCat? Is it possible ask IntelliJ to place required libraries to TomCat ?
Put the jar files in the WEB-INF/lib folder. If there isn't one, create one manually.
This way the jar files are added to the war file that gets created when you build your artifact, and tomcat knows where to find those jars at runtime.
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.
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.
I use Intellij IDEA 11.1.2 Ultimate Edition. I run Tomcat 6 from Intellij IDEA. Beside my .war application I have another folder that has static HTML files. When I run tomcat manually from command line I put that folder under Tomcat's webapp folder and it automatically deploys it and works. However I want to debug my application so I want to run Tomcat from Intellij IDEA. I think that Intellij IDEA deploys tomcat applications into .IntelliJIdea11\system\tomcat folder. Where I can put my folder that contains static files when I run Tomcat from Intellij IDEA?
(I request the main page of static HTML file folder within an iframe at one of my HTML pages of .war file )
Any ideas?
Tomcat Run configuration has an option to deploy other applications from the server (that already present in the original webapps folder), like your static files:
Another option would be to create a second module for the static content with another artifact and deploy both artifacts from IntelliJ IDEA.
I think that CrazyCoder's answer is a little bit better. But here is my solution.
Go to File -> Project Structure...
Select your Web facet
In section Web resource directories click to +
Web resource directory path is your static content
Relative path in deployment directory is where you want to find it in your application war
If you want to debug you have no need to run Tomcat from IDEA. You can use remote debugging feature.
Just set up Tomcat to accept debug(listen to particular port). And create debug configuration from IDEA to attach to this port.