Tomcat not uploading all files - java

When i make the war i see the XCV.Jar, but I add the project on Tomcat (IDE eclipse), and when I deploy it, I have all jars except XCV.Jar (This jar is the parent of the project I deployed).

When you deploy to Tomcat from Eclipse it often fails to clean up the work directory directory. Try to clean $TOMCAT_HOME/work/Catalina// and the web apps directory then try redeploying.
If you are running tomcat inside eclipse you're asking for trouble. Its often better to build and validate the .war independently(with ant or maven) then deploy manually or with a script.

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!

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 :)

Deploying Spring MVC project

I've developed a small MVC project using Spring MVC, Hibernate, MySQL, Maven and Tomcat. I can run and test the application (locally) smoothly.
Now I need to publish/deploy this project on an (online) server that have only Tomcat installed on it. How can I publish/deploy the project online? Is there any special build I should do? What files I shall upload and to where?
There are several types of development options available.
For development on localhost EAR (Exploded ARchive) type of project is usually used (because you can easily make hot deploy on servery). But for production WAR (Web ARchive) is used (basically it's the same EAR archive, but compressed using ZIP algorithm).
If you want to deploy your project to remote Tomcat server then make your project as WAR archive and upload it to Tomcat's webapps directory. Then you might need to restart Tomcat. But it's manual way of deploying.
Better option is to use automated build tools (like Maven) which can compile your project, run unit tests, deploy on web server (local or remote) etc.
This one is a great example of how to deploy your project on Tomcat server by using Maven's tomcat-maven-plugin: http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/
Good luck ;)
Do a mvn clean install and you will get a .war file in your target directory of web module.
Copy it and paste it in tomcat_home/webapps directory and restart tomcat. Thats it. now, you can access it in whatever configured port (eg: http://localhost:8080/<your webapp war name>). lets say your war name is myapp.war, then tomcat would have extracted it into myapp folder in webapps.
so your url will be http://localhost:8080/myapp
With maven deploy command, usually gets errors for various reasons.
if you work in Unix/Linux system, I recommend using "rsync" method on console. (You can write own shell script to manage easily). It helps not only deploying without a problem but also helps to get time while redeploying (only uploading changed / new files). Because maven deploy / redeploy uploads your project as a bundle in jar/war. However "rysnc" method uploads your project files one by one.
Before using it, you should sure that two conditions.
1- your project is built in target folder (Spring Tool Suite)
2- you have access to tomcat via ssh
example code : (v_ : prefix which is variable(customizable))
rsync -avz v_your_project_in_target root#v_ip:v_tomcat_name/webapps/v_project_name
(Second sharing)

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.

Eclipse and SubClipse: How to deploy my own package with svn to a TomCat server?

I'm using SubClipse for Eclipse for my project.
And in this project I've added my own package "com.mytestpkg.www"
I then use TortoiseSVN to deploy my project on the TomCat server where the project is running, because i the easily can update the site with "SVN Update".
But using this method I always have to manually update my package by copying it from my Eclipse workspace build path to the WEB-INF folder classes/com/mytestpkg/www.
Is there a way to make Subclipse/SVN update this file directly with the other files?
Why don't you do this a more conventional way; e.g.
get Eclipse to create and deploy a WAR file
use Ant or Maven to build the WAR file and deploy it by hand. (The Maven way of building WAR files is really slick!)
Doing a checkout into a Tomcat server's webapps directory is ... weird. And you've got the problem of stopping the world seeing the .svn directories.

Categories