0

I have made some changes to an existing Java web application. When I deploy this file to Apache, via WAR file, it regenerates the website as it appeared before my changes.

I delete the existing website directory before deployment, and I've moved out all existing WAR files. I have committed my changes to source control and recreated the WAR file, but still no effect. I even added a small text file to the solution and that was included in the WAR file and deployed to the server, but still my changes were not active.

I am using Spring as my IDE to create the WAR file, and Apache Tomcat to host the website.

Why aren't my changes being packed in the WAR file?

EDIT: I am very new to Java, but have plenty of experience in .NET. Please excuse stupid questions from me.

EDIT 2: As far as I can see, the changes are actually included in the WAR file and are deployed to the server (the class files contain certain strings that they never did before). But the code just isn't executing as it should with those changes (despite Tomcat and the machine itself being restarted).

pete the pagan-gerbil
  • 3,136
  • 2
  • 28
  • 49
  • 1
    Open the WAR file using a zip file utility like 7Zip or WinRar and check the contents – blank Aug 08 '12 at 08:31
  • how are you creating your war? what kind of 'changes' did you add? – mfirry Aug 08 '12 at 08:35
  • I made changes to the Java code - a few new methods in a class, and modified some fixed string values. Basic bug fixing. But the application is not behaving as the changes should make it. @Bedwyr, what am I looking for exactly? – pete the pagan-gerbil Aug 08 '12 at 08:37
  • The small text file you added – blank Aug 08 '12 at 08:37
  • It was deployed to the server via the WAR file but my actual code changes didn't take effect. – pete the pagan-gerbil Aug 08 '12 at 08:38
  • How are you deploying - do you use the auto deploy feature? See http://stackoverflow.com/questions/4604335/tomcat-not-autodeploying-war-file – blank Aug 08 '12 at 08:40
  • try and delete the work folder or your tomcat and then re-deploy again – mfirry Aug 08 '12 at 08:42
  • @mfirry What does the work folder do, and what will deleting it do to help? Also is there a way to force a WAR redeployment in Tomcat without restarting the service (there are other processes running on there which may interrupt the users) – pete the pagan-gerbil Aug 08 '12 at 09:16
  • tomcat auto redeploys war when you put it into webapps catalogue. The war file should be named just like the catalogue with existing web app. – Mariusz Grodek Aug 08 '12 at 09:29

1 Answers1

2

Maybe try to add Maven to your project and then try to use mvn package to make a war file. Some time ago I had a similar problem. I tried to build a war file without Maven and changes on Tomcat weren't seen. Then Maven helped me out.

Edit:

  1. Convert Existing Eclipse Project to Maven Project
  2. http://www.mkyong.com/maven/how-to-convert-java-web-project-to-maven-project/

Maybe this could help you.

Community
  • 1
  • 1
Mariusz Grodek
  • 629
  • 4
  • 12
  • 26
  • Could you add or point me to a dummys guide for that? I am very unfamiliar with Java... – pete the pagan-gerbil Aug 08 '12 at 08:44
  • I already have an option on STS to 'Update Maven Dependencies' - is this related? What other implications are there? This project includes timer tasks, web services and websites (all in one app, no comment) – pete the pagan-gerbil Aug 08 '12 at 09:23
  • Oh so your project is actually a Maven project. So try to run project as Maven package then it should create a war file. Then try to deploy it on Tomcat. [Click RBM on project and then Run as -> Maven package] – Mariusz Grodek Aug 08 '12 at 09:25
  • I had same issues (occasionally using intelliJ build). I used maven build and when I have trouble I use maven clean command and all works nicely. Now I replaced intelliJ build and assembly with maven commands. It is slower but works. – Mircea Stanciu Apr 29 '13 at 01:05