user1949565
user1949565

Reputation:

Change JAR File after deployed WAR on Tomcat possible?

I have a war file deployed to my tomcat server. Tomcat unpacks the war file and I can access the WEB-INF/lib folder.

There is a newer version of somelib.jar in WEB-INF/lib. I want to upgrade this without recompiling the war file.

Can I change somelib.jar in WEB-INF/lib for a version upgrade without any consequenses? Or does my servlet crahes after restart?

Upvotes: 2

Views: 6885

Answers (3)

Sreenivas M
Sreenivas M

Reputation: 167

Try to redeploy the war file using the tomcat manager console. There you have option to start/stop deployed web application.

Upvotes: 2

LaurentG
LaurentG

Reputation: 11717

Yes, you can theoretically. You would have to restart Tomcat or stop/start the application in Tomcat. Note that a WAR is like a ZIP file, you can unpack it, replace the JAR file and zip it again.

Note that I would not recommend to simply replace a JAR in a WAR. This could have bad consequences. You should first test the change (is it already tested?). The new JAR could introduce some incompatible changes. The best practice would be also to have a configuration management, so that you can anytime later get or build again the WAR you deployed.

Upvotes: 5

FazoM
FazoM

Reputation: 4956

You should be able to change just a jar file inside WEB-INF/lib, but you will have to restart your tomcat.

Upvotes: 2

Related Questions