how to Debug war file inside tomcat - java

I just started to work on JSF. And i followed some steps. At last step i created project configured it. After build the project, eclipse created target folder inside of my jsf project. i moved the war file to webapps folder of apache tomcat.
After localhost:8080/firstJsfApp it worked successfully.
But when I changed something on this project and it recreates the .war file. and I have to move it to tomcat folder again (repeatedly).
Is there anyway to make this easier?

You can deploy your webapp to tomcat directly from Eclipse:
1st. Open the "Servers" view in Eclipse, and it will allow you to configure a tomcat instance.
2nd. Add your webapp to the tomcat
Then you can debug and hot deploy any changes to the project.

Here is a link were you can run tomcat in eclipse: http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html

Related

How to deploy web app to tomcat without eclipse?

To my knowledge, to deploy my web application to tomcat, I need to move the war file under webapps in tomcat home. And in eclipse, in order to do that I right click on the server and select "Add and Remove", then add the projects to deploy them when ran.
Without eclipse, I have to make the war file myself by using jar -cf projectname.war * but I don't at which directory should I use this command. Also, should I compile all the sources in the src folder first?
To sum up my question, what is the step to run my web app on tomcat without using eclipse? I want to know what eclipse have done for me under the hood.
Thanks in advance!

create war file in tomcat and create web-inf

I have a java project that use tomcat. when I run project in idea with tomcat(version 6)my project run in idea and in tomcat not create web inf file for my project and war file. why?
thanks
It should be a web project not java project and Tomcat is not responsible for creating web-inf folder. It is created when you first defined the project. Also are you able to see your war after building ? Does it launch the browser when you say running in Tomcat?

How to deploy Java/Spring application on my own system in Apache tomcat server.?

Hello all master minds,
I have created a java spring application in eclipse with mysql db.
Now I can run this application using >Run on server in eclipse,but I want to know how to deploy this application on my own laptop(windows 7).
I have already configured server,by localhost://8080 I can see Apache tomcat is configured.
Give me simple steps so that i can just run that software using browser via its link like
http://localhost:8080/PMS
PMS is my project name.
Thanks in advance.
You can install tomcat-manager in order to deploy your war using a web interface: Tomcat 7 manager
Another option is to copy your war file into tomcat webapps folder. Your container will auto deploy your war: http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html#Deployment_With_Tomcat.
The easiest way, since you are using eclipse is to just export your project as war and then put that war (naming it PMS) in webapps directory in your tomcat.
Once started, Tomcat will deploy that war on http://localhost:8080/PMS
You have to do the following steps:
Right click on project>> Export (Export as WAR file).
or if you are using a maven project then you can give a maven build.
Copy that WAR file, (you will get that war file inside the project folder in your workspace) to the tomcat_Installed_Folder/ webapps
Inorder to deploy the app from outside eclipse,
goto tomcat_Installed_Folder/bin
and double click on startup.bat
then you could see a console.
For detailed logs of deployment, goto tomcat_Installed_Folder/logs
ALL THE BEST :)

Difference in EAR Deployed in Websphere Application server. (war to ear )

I have a web application(Myapp) configured in eclipse.
So in order to Deploy it in Websphere v5.1 I have to export it to EAR.
Scenario 1: In eclipse--> new --> Enterprise Application Project
-->Named as MyappEAR--> Selected Existing Module(Myapp)--> Finish. Now I got MyappEAR in Project Explorer. Right click on MyappEAR export to
EAR. Done. Got MyappEAR.ear file with Myapp.war inside it.(Includes
META-INF and xml)
Deployed MyappEAR.ear in Websphere, Deployed Successfully. But when i
tried to start MyappEAR it ends up with this error SRVE0054E: An error
occurred while loading Web application (No more information found).
Scenario 2: Eclipse--> right click on Myapp export to war--> Got
Myapp.war--> Deleted existing myapp from Project explorer.
File-->Import-->WAR--> enabled Add project to an EAR and named it as
MyappEAR-->finish Right click on MyappEAR-->export to EAR. Done . Got
MyappEAR.ear with same stuff as above.
Deloplyed and Started working fine.
Now my question is What's the difference in both ways causing that error? (even checked with beyond compare, everything is same).
Websphere app server v5.1,
Java 1.4,
Eclipse Indigo.
We have a Maven project and it builds the EAR after we run mvn clean install.Then I take EAR from target folder and deploy it in server.
In local setup,Just add the project in server and start the server.Normally it works.

Deploying war file in STS using gradle

I have a web project in STS, that iam looking to deploy in Tomcat. The build file for the project is written in GRADLE. Using GRADLE'S build script, a war file is generated in build/libs.
But STS looks for the war file in workspace/metadata/plugins/org.eclipse.wst.server.core/ folder.
Now If I manually copy the generated WAR file from build/libs to this workspace/metadata/plugins folder, and then start the tomcat, everything works fine but I am not able to debug using breakpoints in STS.
How do I make sure that the war file from build/libs gets moved to workspace/metadata/plugins folder?
And, Why is STS looking to find the war in workspace/metadata/plugins folder. As the app-server is tomcat, should it not be looking in Tomcat/webapps folder to find the war?
I am not a eclipse fan nowadays but did you run eclipse plugin? you can add it to the gradle file
apply plugin: 'eclipse'
and then just run
gradle eclipse
check Eclipse Plugin
I don't believe STS deploys/runs your war file directly. That is, if you select the project and say "Run on Server", STS/eclipse will generate an exploded war to the wtp.deploy directory defined. You can control/alter this by editing the "run configuration" for your server. Just go to the "Arguments" tab and change the setting for the "-Dwtp.deploy".
You should really only use this STS mechanism for development purposes - as it is invaluable for that. To deploy an actual warfile to Tomcat you have a variety of options. You can start a tomcat instance with the manager UI enabled and upload the war file from the Tomcat GUI, you can just manually drop the war file into Tomcat's deployment area, or probably your best option - extend your gradle build scripts to include deploying the generated war file to a tomcat server. Hope this helps some.

Categories