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

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.

Related

Is it possible to restart Netbean's Tomcat bundled version?

I'm writing a shell script in order to clean & build (with Maven) and automatically deploy the resulting war into Tomcat's webapps folder.
The only problem is I can't find Tomcat's binaries folder, thus I'm not able to restart it.
Question is: Is it possible to manually restart Tomcat without having to do it via IDE? Where are Tomcat's binaries?
To find out the path, open the services view with "Window|Services". Choose the tomcat and open the properties/reconfigure via the context menu. The path is configured there.

Web Deployment Assembly not used by Tomcat7

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.

How to Deploy to Intellij IDEA Tomcat Folder?

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.

Where is my app placed when deploying to Tomcat using IntelliJ IDEA?

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

Can you publish a .war directly from eclipse to a web server

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

Categories

Resources