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.
Related
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 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 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
I have created a dynamic web projects in eclipse which includes jsp pages and servlet.The back end of this application is Mysql and i include mysql-connector-java-5.1.15-bin.jar in the lib folder. I want to deploy this web application using Tomcat server instead of running this application in eclipse using tomcat. How is it possible?. Can any one suggest any sample codes or methods to solve this problem.
copy the WAR file to Tomcats webapps folder and it should auto deploy. answer by Will Hartung is correct
you need to build a war file (or ear depending on which technologies you use), and then deploy that to your container. (in the tomcat/webapps folder i believe). Ant and Maven, two popular technologies for managing a project, both support doing this. There is plenty of documentation on the web as well
http://www.vaannila.com/ant/ant-sample-build-file-war-1.html
Step 1: Go to Windows > SHow View > Other > Select Servers
Step 2: In Server Tab . Right Click > Add New Server > Add Run time if not available and add tomcat server.
Step 3: Add your project to it and finish. If you will see in Server tab, you will see your project.
Step 4: Right click on server and choose either debug or run.
You can use ant build script by running that script from your eclipse your web application will automatically deploy into your tomcat. Another one option is to copy the war file into the tomcat's webapps folder
After export your application from Eclipse to .WAR file you can deploy, undeploy and reload it at Tomcat Web Application Manager Panel: http://localhost:8080/manager/html.
Can you publish a .war directly from eclipse to a web server.
I know it's not a programming question, but I still think it's a relevant question.
Thanks
yes you can.
right click on the project, select export -> select web - > then war and give destination which is your deploy folder.
Yes, but it depends a lot on your project configuration. Generally you need to define the server in eclipse, and choose "Run on Server".
See this as an example of deploying on JBoss server from eclipse.
In case you are using Ant then using "deploy" target will work.
This should be pretty easy:
Import the war file into eclipse. File > Import... > Web > WAR File.
(likely only works on eclipse for java ee development)
Pick the war file, create a new project (any new name works), click finish
Add the new project to your server
Blam!
If your project is setup as a web project in Eclipse, you can choose to run it on a server (You'll have to configure the server first). This will publish the war file directly on the server from Eclipse.
This is easiest if the web server has an auto-deploy facility, with a magic directory. Then just File-> Export the WAR file into the auto-deploy folder.
If not, or if you want to be able to debug the WAR file inside Eclipse you need to have an appropriate server connector in the WTP module (which is included by default in the Java EE edition of Eclipse).
If you want to programmatically push the WAR file to a given server directly from within Eclipse, then you can e.g. use the Tomcat Ant tasks - http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing%20Manager%20Commands%20With%20Ant - or use the Cargo library to do this with many different types of servers - http://cargo.codehaus.org/
I created my own ant file, and set eclipse to use that ant file when building.
Part of that ant build file is a target that publishes to Tomcat, so I can just right click
and chose install from within eclipse.
Eclipse pic http://img408.imageshack.us/img408/6701/eclipseant.png
The basis of such an ant file is here: http://tomcat.apache.org/tomcat-6.0-doc/appdev/build.xml.txt
Yes, you do that
Start the build the application
Create the war file
A WAR (or "web archive") file is simply a packaged webapp directory. It is created using the standard Java jar tool. For example:
cd /home/alex/webapps/mywebapp
jar cf ../mywebapp.war *
- copy that war file to the following deploy directory in your server
say in Jboss its like this
"C:\Jboss405\server\default\deploy"
I hope this might be clear, else let me know any issues if you face any issues