You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Sankar Kondur <sh...@home.com> on 1999/10/20 06:24:09 UTC

reloading a jsp bean

Hi,

i am facing a problem. this is the situation.

i have a jsp file MyJSPFile.jsp in which i am using a bean
MyJSPBean.java. if i make changes in MyJSPBean.java and recompile it and
then run MyJSPFile.jsp, the changes i made in the bean don't take
effect. i have to restart tomcat.
this(making changes to the bean) happens quite frequently in our team.

i went thru the source code but could not come up with a sensible/simple
way of getting it done.
i want to know
if anybody has faced this problem/requirement?
does anybody know of a simple way of getting this done?

also can somebody tell me if this would work - currently the
JspLoader.java uses the parent class loader to do some of the class
loading. if i put all the class loading functionality into
JspLoader.java, check if the class in the classpath is more recent then
the class in the hashtable(class-store) and then realod it, will this
work.

any help would be appreciated.

thanks,
Shankar.




Re: reloading a jsp bean

Posted by James Davidson <du...@x180.com>.
(limited to tomcat-dev)...

> This is a common problem.
> It's too bad that the Java ClassLoader does not have a reload()
> method.  I understand not having an unload() method because
> of the possibility of runtime errors if the class signature has
> changed, but it seems like you could have a safe reload() that
> would verify that the class signature hasn't changed before
> reloading, and through an exception if it has.

Actually there's a problem with that generic a method --  What do you do
about all  active instances of a class? Shut them down and replace? What do
you do about references to those instances (or the static representation of
the class) held by other class instances?

It's not an easy problem....

.duncan



Re: reloading a jsp bean

Posted by Cris Perdue <cr...@perdues.com>.
Shawn McMurdo wrote:

> It's too bad that the Java ClassLoader does not have a reload()
> method.  I understand not having an unload() method because
> of the possibility of runtime errors if the class signature has
> changed, but it seems like you could have a safe reload() that
> would verify that the class signature hasn't changed before
> reloading, and through an exception if it has.
> Shawn
>
Yes, this would be great for development and other situations where dynamic behavior is wanted. Ability to *replace* a class definition dynamically, not just add a new one in a new namespace would be very nice.

This is a feature that requires VM support of course, and probably support in the language spec.  The issues run kind of deep, though, basically you need to be able to know when it will and will not be permitted.  A capability like this interacts with optimizations including inlining and any optimization based on known properties of a class.
--
Cris Perdue
Impact Online, Inc.
http://www.volunteermatch.org



Re: reloading a jsp bean

Posted by Shawn McMurdo <sh...@lutris.com>.
This is a common problem.
It's too bad that the Java ClassLoader does not have a reload()
method.  I understand not having an unload() method because
of the possibility of runtime errors if the class signature has
changed, but it seems like you could have a safe reload() that
would verify that the class signature hasn't changed before
reloading, and through an exception if it has.
Shawn

Brill Pappin wrote:

> This is actually a common problem during development..
> How about including a "development" switch that would load *all* classes
> through a re-loading classloader?
> Of course, this would be bad in a production situation, so it would have to
> be a switch...
>
> - Brill Pappin
>   www.jmonkey.com
>
> ----- Original Message -----
> From: Sankar Kondur <sh...@home.com>
> To: <to...@jakarta.apache.org>; <ge...@jakarta.apache.org>
> Sent: Wednesday, October 20, 1999 12:24 AM
> Subject: reloading a jsp bean
>
> > Hi,
> >
> > i am facing a problem. this is the situation.
> >
> > i have a jsp file MyJSPFile.jsp in which i am using a bean
> > MyJSPBean.java. if i make changes in MyJSPBean.java and recompile it and
> > then run MyJSPFile.jsp, the changes i made in the bean don't take
> > effect. i have to restart tomcat.
> > this(making changes to the bean) happens quite frequently in our team.
> >
> > i went thru the source code but could not come up with a sensible/simple
> > way of getting it done.
> > i want to know
> > if anybody has faced this problem/requirement?
> > does anybody know of a simple way of getting this done?
> >
> > also can somebody tell me if this would work - currently the
> > JspLoader.java uses the parent class loader to do some of the class
> > loading. if i put all the class loading functionality into
> > JspLoader.java, check if the class in the classpath is more recent then
> > the class in the hashtable(class-store) and then realod it, will this
> > work.
> >
> > any help would be appreciated.
> >
> > thanks,
> > Shankar.
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: general-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org

--
Shawn McMurdo              mailto:shawn@lutris.com
Lutris Technologies        http://www.lutris.com
Enhydra.Org                http://www.enhydra.org



Re: reloading a jsp bean

Posted by Shawn McMurdo <sh...@lutris.com>.
This is a common problem.
It's too bad that the Java ClassLoader does not have a reload()
method.  I understand not having an unload() method because
of the possibility of runtime errors if the class signature has
changed, but it seems like you could have a safe reload() that
would verify that the class signature hasn't changed before
reloading, and through an exception if it has.
Shawn

Brill Pappin wrote:

> This is actually a common problem during development..
> How about including a "development" switch that would load *all* classes
> through a re-loading classloader?
> Of course, this would be bad in a production situation, so it would have to
> be a switch...
>
> - Brill Pappin
>   www.jmonkey.com
>
> ----- Original Message -----
> From: Sankar Kondur <sh...@home.com>
> To: <to...@jakarta.apache.org>; <ge...@jakarta.apache.org>
> Sent: Wednesday, October 20, 1999 12:24 AM
> Subject: reloading a jsp bean
>
> > Hi,
> >
> > i am facing a problem. this is the situation.
> >
> > i have a jsp file MyJSPFile.jsp in which i am using a bean
> > MyJSPBean.java. if i make changes in MyJSPBean.java and recompile it and
> > then run MyJSPFile.jsp, the changes i made in the bean don't take
> > effect. i have to restart tomcat.
> > this(making changes to the bean) happens quite frequently in our team.
> >
> > i went thru the source code but could not come up with a sensible/simple
> > way of getting it done.
> > i want to know
> > if anybody has faced this problem/requirement?
> > does anybody know of a simple way of getting this done?
> >
> > also can somebody tell me if this would work - currently the
> > JspLoader.java uses the parent class loader to do some of the class
> > loading. if i put all the class loading functionality into
> > JspLoader.java, check if the class in the classpath is more recent then
> > the class in the hashtable(class-store) and then realod it, will this
> > work.
> >
> > any help would be appreciated.
> >
> > thanks,
> > Shankar.
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: general-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org

--
Shawn McMurdo              mailto:shawn@lutris.com
Lutris Technologies        http://www.lutris.com
Enhydra.Org                http://www.enhydra.org



Re: reloading a jsp bean

Posted by Brill Pappin <br...@jmonkey.com>.
This is actually a common problem during development..
How about including a "development" switch that would load *all* classes
through a re-loading classloader?
Of course, this would be bad in a production situation, so it would have to
be a switch...


- Brill Pappin
  www.jmonkey.com

----- Original Message -----
From: Sankar Kondur <sh...@home.com>
To: <to...@jakarta.apache.org>; <ge...@jakarta.apache.org>
Sent: Wednesday, October 20, 1999 12:24 AM
Subject: reloading a jsp bean


> Hi,
>
> i am facing a problem. this is the situation.
>
> i have a jsp file MyJSPFile.jsp in which i am using a bean
> MyJSPBean.java. if i make changes in MyJSPBean.java and recompile it and
> then run MyJSPFile.jsp, the changes i made in the bean don't take
> effect. i have to restart tomcat.
> this(making changes to the bean) happens quite frequently in our team.
>
> i went thru the source code but could not come up with a sensible/simple
> way of getting it done.
> i want to know
> if anybody has faced this problem/requirement?
> does anybody know of a simple way of getting this done?
>
> also can somebody tell me if this would work - currently the
> JspLoader.java uses the parent class loader to do some of the class
> loading. if i put all the class loading functionality into
> JspLoader.java, check if the class in the classpath is more recent then
> the class in the hashtable(class-store) and then realod it, will this
> work.
>
> any help would be appreciated.
>
> thanks,
> Shankar.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
>


Re: reloading a jsp bean

Posted by ja...@almery.com.
Anil K. Vijendran writes:

 > The problem is if the bean class is newer, then the only way you can reload
 > it is by creating a new class loader. The whole code out there should
 > probably rely on a pluggable class loader factory that gives you a new class
 > loader when you want to reload something. It doesn't.
 > 
 > Another alternative is to drop the context and create a new one...
 > 
 > I'd love to hear if you have any ideas...

JServ uses the concept of repositories, where it seems like some sort
of class reloading is done.

Jay
-- 
Jay Doane | vivid studios | doane@vivid.com


Re: reloading a jsp bean

Posted by "Anil K. Vijendran" <ak...@eng.sun.com>.
This is a tricky problem that I haven't investigated well enough.

The problem is if the bean class is newer, then the only way you can reload
it is by creating a new class loader. The whole code out there should
probably rely on a pluggable class loader factory that gives you a new class
loader when you want to reload something. It doesn't.

Another alternative is to drop the context and create a new one...

I'd love to hear if you have any ideas...

Sankar Kondur wrote:

> Hi,
>
> i am facing a problem. this is the situation.
>
> i have a jsp file MyJSPFile.jsp in which i am using a bean
> MyJSPBean.java. if i make changes in MyJSPBean.java and recompile it and
> then run MyJSPFile.jsp, the changes i made in the bean don't take
> effect. i have to restart tomcat.
> this(making changes to the bean) happens quite frequently in our team.
>
> i went thru the source code but could not come up with a sensible/simple
> way of getting it done.
> i want to know
> if anybody has faced this problem/requirement?
> does anybody know of a simple way of getting this done?
>
> also can somebody tell me if this would work - currently the
> JspLoader.java uses the parent class loader to do some of the class
> loading. if i put all the class loading functionality into
> JspLoader.java, check if the class in the classpath is more recent then
> the class in the hashtable(class-store) and then realod it, will this
> work.
>
> any help would be appreciated.
>
> thanks,
> Shankar.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

--
Peace, Anil +<:-)