Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

Hot deployment

Thread view: 
Gregor Kovač - 06 Dec 2005 15:28 GMT
Hi!

I'm developing a simple client - server application and what I want is to
automatically reload classes on server side when I change them, I don't
want to restart my server all the time.

How do I do that? Any simple examples? I've look over source code of some
Java application servers (Tomcat, JBoss, ..), but they are too compicated
to understand. :)

Best regards,
       Kovi

Signature

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

| Gregor Kovac | Gregor.Kovac@mikropis.si    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
|            Experience Linux.               |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
abigale_carson@yahoo.com - 06 Dec 2005 15:34 GMT
Have you checked out the Tomcat Manager application?  It's included
with the Tomcat application, and is accessible at
{your-url}:8080/manager/html.

You need to set it up before using it, but it's pretty nice when you
get it going.  Here's a reference to how you reload JSP webapps with
it:

http://tomcat.apache.org/tomcat-4.0-doc/manager-howto.html#Reload%20An%20Existin
g%20Application


--or--

http://linkfrog.net/daa6

Hope this helps,

Abigale
Gregor Kovač - 07 Dec 2005 09:43 GMT
> Have you checked out the Tomcat Manager application?  It's included
> with the Tomcat application, and is accessible at
[quoted text clipped - 3 lines]
> get it going.  Here's a reference to how you reload JSP webapps with
> it:

http://tomcat.apache.org/tomcat-4.0-doc/manager-howto.html#Reload%20An%20Existin
g%20Application


> --or--
>
[quoted text clipped - 3 lines]
>
> Abigale

Hi!

Thanks for your answer, but this is not what I'm looking for. I know how to
set tomcat up to do that, but I want my application to be able to reload my
classes of the fly.

Best regards,
   Kovi
Signature

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

| Gregor Kovac | Gregor.Kovac@mikropis.si    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
|            Experience Linux.               |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
HalcyonWild - 06 Dec 2005 15:38 GMT
Gregor Kovac wrote:

> Hi!
>
[quoted text clipped - 5 lines]
> Java application servers (Tomcat, JBoss, ..), but they are too compicated
> to understand. :)

Gregor,  if you replace the war file , with the recompiled classes, in
the Jboss deployment directory, it will reload the classes. Try it out.
You dont have to restart.
Roedy Green - 06 Dec 2005 19:41 GMT
On Tue, 06 Dec 2005 16:28:21 +0100, Gregor Kovaè
<gregor.kovac@mikropis.si> wrote, quoted or indirectly quoted someone
who said :

>How do I do that? Any simple examples? I've look over source code of some
>Java application servers (Tomcat, JBoss, ..), but they are too compicated
>to understand. :)

You need to create new class loader to load the new version.  Then you
have both new and old objects lying around inside the JVM.

 See http://mindprod.com/jgloss/classforname.html
http://mindprod.com/jgloss/classloader.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Gregor Kovač - 07 Dec 2005 09:45 GMT
> On Tue, 06 Dec 2005 16:28:21 +0100, Gregor Kova?
> <gregor.kovac@mikropis.si> wrote, quoted or indirectly quoted someone
[quoted text clipped - 9 lines]
>   See http://mindprod.com/jgloss/classforname.html
> http://mindprod.com/jgloss/classloader.html

Hi!

Thanks for your answer. This is what I'm looking for.
So.. After, for example, 100 deployments of about 10Mb of classes I'll have
100x10Mb = 1000Mb of memory reserved only for my classes (old and new
versions) ? Is there a way to dispose old versions?

Best regards,
       Kovi

Signature

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

| Gregor Kovac | Gregor.Kovac@mikropis.si    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
|            Experience Linux.               |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Viator - 07 Dec 2005 10:22 GMT
If I understand you right, what you need is a simple hot deployment
facility. Most servers support this these days and the configuration
depends on server. For tomcat you have to make a context entry in
server.xml file and set reloadable="true". This should work fine. For
other servers chekc out the documentation.

Amit :-)
Roedy Green - 07 Dec 2005 13:01 GMT
On Wed, 07 Dec 2005 10:45:58 +0100, Gregor Kovaè
<gregor.kovac@mikropis.si> wrote, quoted or indirectly quoted someone
who said :

>Thanks for your answer. This is what I'm looking for.
>So.. After, for example, 100 deployments of about 10Mb of classes I'll have
>100x10Mb = 1000Mb of memory reserved only for my classes (old and new
>versions) ? Is there a way to dispose old versions?

If you use a classloader, and discard references to all old objects
and the class loader, the static stuff and the code will be GCed.

Please read the links.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Chris Uppal - 07 Dec 2005 12:11 GMT
Gregor Kovaè wrote:

> I'm developing a simple client - server application and what I want is to
> automatically reload classes on server side when I change them, I don't
> want to restart my server all the time.

This has been covered far too often for me to want to go into detail again, but
broadly you have to look into using your own classloader(s).  Use your own
explicitly created classloader to load your "hot swappable" classes.  When you
want to reload, discard all references to that classloader, the classes it
loaded, and any instances they may have.  Reload by creating a new classloader
and using it to load the new class defintions.

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.