Recent changes are not reflected in the servlet (tomcat)

I am working on my silence project, sometime now I use tomcat and eclipse, which still work correctly.

I launched the war of 22-1-2012 (with some printed messages), it worked correctly, and the next day I made some changes, deleted some messages and redistributed the file ... In my webapps folder it shows the last time for the "last change" of my war file .. what am I not doing, tell me.

PS any changes on the JSP pages of the same project are reflected, but the servlet class does not change

Here is what the _SEVERE log file shows: it looks like the web application started TimerThread with the name [TimelineTransation Timer] using the java.util.Timer API, but did not stop it. To prevent a memory leak, the timer (and therefore the associated thread) was forcibly canceled. _

Ok, this is a summary of my problem, I hope I can explain the problem to you now. I have completed the following steps again
1.Disconnect my webapp directory from webapps
2. I tried to access the servlet (it shows "Resource unavailable")
3. Make some changes to the print expression for debugging
4.Redeployed WAR from eclipse
5.Again when accessing the servlet is not the latest version showing the same old messages.

Now tell me if there is a solution .... Thanks in advance


After I tried so many things that I noticed when I deployed the WAR file that non-JSP servlet class files were not included in the WAR, when I manually add these class files to the WAR, all changes are updated. So now you can tell me how to automatically deploy them to WAR..whats a problem?

+4
source share
10 answers

JSP files are not updated because they have been precompiled, and even if they can extract information from files that have been modified, each JSP file that may be affected should have minor changes, for example, add a space and then remove the space and save his.

Then create your WAR, and then the updates should show. Today I ran into this problem and none of the other answers helped. The key is to check the dates of the files in the Tomcat directory where you deployed the WAR. I noticed that even though I deployed a completely new cleaned WAR and deleted all the folders, there were still old cached files there, probably because Eclipse saved them in order to save compilation time, assuming that they had no changes .

Hope this helps

+6
source

Go to viewing servers in Eclipse:

Double click on your server. In my case, this is Tomcat.

A Tomcat web module should appear. Click on the Modules tab at the bottom (see Figure 1).

Choose your project. Click the "Delete" button.

Photo 1: enter image description here

You should now see a star next to the Tomcat tab. This means that you need to save your changes. So do Control + S.

Photo 2: enter image description here

Right-click your project in Project Explorer. Go to Maven -> Update Project ...

Photo 3: enter image description here

Now this is an important part, make sure you have the "Force snapshot / release update" checkbox selected. Verification of this part is crucial. Then click Ok.

Photo 4: enter image description here

Now look at your server. It should look like this with a β€œRestart” warning indicating that it is not in sync.

Photo 5: enter image description here

Right-click and select Restart.

Fig 6:

enter image description here

Let the server reboot. Now, if you return to viewing the server, you will see that it is synchronized. This is what you want. Like this:

Photo 7: enter image description here

Now you can right-click on your project and select "Run as" β†’ "Run on server" and you will see your changes.

Photo 8: enter image description here

If something still did not update, go back to your server view and make sure that it does not indicate a restart, as in Figure 5 above. If this happens, please restart the server again, as in fig. 6. Then click "Refresh" in the browser.

+5
source

any changes to the JSP pages of the same project are reflected, but the servlet class does not change

It is not clear what you are saying.

  • If you say that the updated JSPs are in the extended webapp directory, but the generated / compiled JSP classes have not changed (in the working directory), then try removing the classes from the working directory. You may need to restart the web container.

  • If you say that non-JSP servlet classes have been updated (in webapp) but you are not using them, try restarting the web container.

  • If you say that non-JSP servlet classes were not updated in the webapp directory, then something went wrong in deploying webapp. Close the web container, delete the webapp directory (and the compiled JSPs for a good score), and restart webapp.


After I tried so many things that I noticed when I deployed the WAR file that non-JSP servlet class files were not included in the WAR, when I manually add these class files to the WAR, all changes are updated. So now you can tell me how to automatically deploy them to WAR..whats a problem?

Therefore, the problem is not deployment related. The problem is that you are not building the WAR file correctly.

I can not help it, because I do not use Eclipse to create my WAR files. (I use Maven so that the build process is scriptable and reproducible ... and does not depend on the fact that I press the right button in the right order every time.)

0
source

Check the log files for Tomcat, I am sure there is a problem launching your web application and it is not being deployed.

0
source

The reality is that Tomcat cannot run code in which there is no copy. Especially if you restarted it. There seems to be a separate β€œcopy” of your web application that is actually being used. Either you did it unintentionally (hey, let's face it, we all did it) OR did Tomcat in a place you didn't know about.

Select a unique file that exists in your web application. Perhaps the icon name or the name of the configuration file. Locate the entire hard drive so that it can find exploded copies of the WAR file. This will help you find it in a temporary directory or working folder. Be sure to clean them.

Also, make sure you are using Tomcat, which you think you are. Most developers with multiple Tomcat installations also made a mistake when deploying elsewhere. See the list of processes to see the arguments given by the JVM at startup. Be sure to also check the environment variable for things like CATALINA_HOME.

EDIT: your update, which the JSP pages change, but the classes do not make me think that you have several JAR files on the class path that have the same file (one earlier version was loaded first). Or you changed the class name to the code base, but not updated links to it.

0
source

go to catalina home \ conf \ context.xml

change <Context> to <Context reloadable="true"> Make sure you restart tomcat. Boom. You may still have to press F5 or Ctrl + F5 two or three times.

0
source

Is your tomcat server.xml pointing to the desired workspace? to make sure that you go to the installed tomcat directory - find server.xml in the confi folder

0
source

Go to your browser settings and clear your cache.

0
source

for each war file, tomcat creates a similar folder with the name. Delete the folder, try reinstalling the war again, I hope that it will reflect.

0
source

In the web.xml file, add one letter at the end and delete it, then press Enter to save the file. After that, run the program, and it will work with the updated data.

0
source

Source: https://habr.com/ru/post/1392597/


All Articles