Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to load a new jar file while server is running

 
kiranrredy ad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to place a new jar file into lib while server is running.
How can we load this jar(entirely a new file) into tomcat's current classpath without restarting the server.

Could you anyone help me out.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can restart the webapp itself, without restarting all of Tomcat from the Tomcat manager.
 
kiranrredy ad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
You can restart the webapp itself, without restarting all of Tomcat from the Tomcat manager.


Ben,
Thanks a lot.

Can we do the same action programatically without using tomcat manager?
 
kiranrredy ad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben,
Thanks a lot.

Can we do the same action programatically without using tomcat manager?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could if you wrote your own custom class loader or, if you set your app to privileged, you could do whatever is is that the manager app does when it restarts an app. It's open source so you can look for yourself.

There is also another option of the <Context .../> element that allow you to make your app reloadable. This will cause the app to be reloaded any time a class file or jar file is uploaded. There is a small performance penalty but it's never been noticable to me.

See: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
 
kiranrredy ad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben,

First one will be the best option in this case. As Context.reload() loads only the classes if they are already in the classpath, here we are adding a new jar file(all new classes).

am i correct?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic