You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by rg...@teamsol.com on 2002/11/04 19:09:59 UTC

Must Restart Server??

I am fairly new to Velocity. Every time I make a change to my servlet, the 
app is unable to display the data that I am accessing from my database. In 
order to properly see my changes, I have to restart the entire application 
server! This, needless to say, is not good for productivity. How do I turn 
off this feature? I am using WebSphere (WSAD). 
Thanks!
Ray

RE: Must Restart Server??

Posted by Andy Lee <ag...@earthlink.net>.
At 12:54 PM -0600 11/4/02, Jenny Brown wrote:
>I have noticed even under Tomcat that if I make a change to a 
>velocity template, it reloads automatically, EXCEPT if the change I 
>made was inside of a macro, in which case I have to force a servlet 
>container restart to see the change.

I've noticed this too.

There was something in the archives about a velocity.properties 
setting for caching of *global* macros (see the docs -- changing from 
the default is recommended only during development).  So one option 
would be to move your macro to the global macros file.  I meant to 
try this, but never got around to it.

--Andy

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Must Restart Server??

Posted by rg...@teamsol.com.
It wasn't in a macro (as I understand macros ... as in macros defined in 
the template). It's in the handleRequest method of the servlet and any 
class that that method calls.





Jenny Brown <je...@bigbrother.net>
11/04/2002 01:54 PM
Please respond to "Velocity Users List"
 
        To:     Velocity Users List <ve...@jakarta.apache.org>
        cc:     (bcc: Ray Grieselhuber/Teamwork)
        Subject:        RE: Must Restart Server??


On Mon, 4 Nov 2002 rgrieselhuber@teamsol.com wrote:

> Thanks Kevin. I think this is actually a Velocity thing... None of my
> other servlets require me to start the server, or even the webapp for 
that
> matter. It seems like there should be a cache setting somewhere in
> Velocity that enables me to make changes to a Servlet that extends
> VelocityServlet without needing to restart the container. Am I wrong?
> Thanks!
> Ray


I have noticed even under Tomcat that if I make a change to a velocity
template, it reloads automatically, EXCEPT if the change I made was
inside of a macro, in which case I have to force a servlet container
restart to see the change.

I'm not sure why macros are caching, but check if your change was in a
macro.




--
To unsubscribe, e-mail:   <
mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:velocity-user-help@jakarta.apache.org>



Re: Must Restart Server??

Posted by rg...@teamsol.com.
<quote>
1. Modify a hello world servlet running in the same web app directory,
   using only println(), and have it restart properly and show the
   changes through your web browser, without using velocity at all?

2. Modify a velocity template, and hit reload on your browser, and see
   the change, without modifying your servlet Java code (for any
   velocity servlet)?

3. What release of WebSphere are you using?  What version of Java with it?

4. Are you experienced with the WebSphere configuration options for
   servlet container behavior?  There are some that may be related to
   this.  Alternatively did someone else set it up for you, whom you
   could ask questions of?
</quote>

1. Yes
2. Yes
3. WebSphere 4.03 (Inside WSAD), JDK 1.3+
4. Yes, I set this up myself. 

So it sounds like there is nothing in Velocity that would force this type 
of behavior. It's strange because inside Velocity is the only place I have 
seen it.

Thanks, 
Ray





Jenny Brown <je...@bigbrother.net>
11/04/2002 03:08 PM
Please respond to "Velocity Users List"
 
        To:     Velocity Users List <ve...@jakarta.apache.org>
        cc:     (bcc: Ray Grieselhuber/Teamwork)
        Subject:        Re: Must Restart Server??


On Mon, 4 Nov 2002 rgrieselhuber@teamsol.com wrote:

> I have everything under my web app directory (I'm running WebSphere). 
But
> it still seems like something is not refreshing properly when I modify 
my
> Servlet, because I have to restart the entire web server every time I
> modify my Servlet. Any ideas?
> Thanks,
> Ray

Not to belabor the simple, but can you:

1. Modify a hello world servlet running in the same web app directory,
   using only println(), and have it restart properly and show the
   changes through your web browser, without using velocity at all?

2. Modify a velocity template, and hit reload on your browser, and see
   the change, without modifying your servlet Java code (for any
   velocity servlet)?

3. What release of WebSphere are you using?  What version of Java with it?

4. Are you experienced with the WebSphere configuration options for
   servlet container behavior?  There are some that may be related to
   this.  Alternatively did someone else set it up for you, whom you
   could ask questions of?

There are caching options in many web servers, and I'm certain in
WebSphere, that allow you to choose to not automatically reload on
changes.  That might have gotten turned on accidentally.  Also, in some
web servers (I don't know about WebSphere on this one), if you change a
supporting class file, but not the servlet file itself, it will not
automatically reload.  You have to recompile the servlet class itself to
trigger an automatic reload.

My questions are intended to help narrow the options for under what
conditions you receive odd behavior from it... and hopefully help
pinpoint what may be causing it.


Jenny Brown


--
To unsubscribe, e-mail:   <
mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:velocity-user-help@jakarta.apache.org>



Re: Must Restart Server??

Posted by Jenny Brown <je...@bigbrother.net>.
On Mon, 4 Nov 2002 rgrieselhuber@teamsol.com wrote:

> I have everything under my web app directory (I'm running WebSphere). But
> it still seems like something is not refreshing properly when I modify my
> Servlet, because I have to restart the entire web server every time I
> modify my Servlet. Any ideas?
> Thanks,
> Ray

Not to belabor the simple, but can you:

1. Modify a hello world servlet running in the same web app directory,
   using only println(), and have it restart properly and show the
   changes through your web browser, without using velocity at all?

2. Modify a velocity template, and hit reload on your browser, and see
   the change, without modifying your servlet Java code (for any
   velocity servlet)?

3. What release of WebSphere are you using?  What version of Java with it?

4. Are you experienced with the WebSphere configuration options for
   servlet container behavior?  There are some that may be related to
   this.  Alternatively did someone else set it up for you, whom you
   could ask questions of?

There are caching options in many web servers, and I'm certain in
WebSphere, that allow you to choose to not automatically reload on
changes.  That might have gotten turned on accidentally.  Also, in some
web servers (I don't know about WebSphere on this one), if you change a
supporting class file, but not the servlet file itself, it will not
automatically reload.  You have to recompile the servlet class itself to
trigger an automatic reload.

My questions are intended to help narrow the options for under what
conditions you receive odd behavior from it... and hopefully help
pinpoint what may be causing it.


Jenny Brown


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Must Restart Server??

Posted by rg...@teamsol.com.
I have everything under my web app directory (I'm running WebSphere). But 
it still seems like something is not refreshing properly when I modify my 
Servlet, because I have to restart the entire web server every time I 
modify my Servlet. Any ideas?
Thanks, 
Ray





"Geir Magnusson Jr." <ge...@adeptra.com>
11/04/2002 02:21 PM
Please respond to "Velocity Users List"
 
        To:     velocity-user@jakarta.apache.org
        cc:     (bcc: Ray Grieselhuber/Teamwork)
        Subject:        Re: Must Restart Server??


On 11/4/02 1:54 PM, "Jenny Brown" <je...@bigbrother.net> wrote:

> On Mon, 4 Nov 2002 rgrieselhuber@teamsol.com wrote:
> 
>> Thanks Kevin. I think this is actually a Velocity thing... None of my
>> other servlets require me to start the server, or even the webapp for 
that
>> matter. It seems like there should be a cache setting somewhere in
>> Velocity that enables me to make changes to a Servlet that extends
>> VelocityServlet without needing to restart the container. Am I wrong?
>> Thanks!
>> Ray
> 
> 
> I have noticed even under Tomcat that if I make a change to a velocity
> template, it reloads automatically, EXCEPT if the change I made was
> inside of a macro, in which case I have to force a servlet container
> restart to see the change.
> 
> I'm not sure why macros are caching, but check if your change was in a
> macro.
> 

Seems like we are mixing things up here.

There are two things :

1) Server restart - this all depends on where you put the Velocity jar, 
and
where you put your code, and how tomcat is configured.  Tomcat can be
configured to dump your webapp and reload from the lib & classes directory
in your WEB-INF when you change a class or jar.  Velocity 1.3 should have 
no
problems anymore with this - pre 1.3 there was an issue with the
introspection caching not getting dumped on classloader change, but that's
been fixed.  Also, note that if you have a velocity jar outside of your
webapp, i.e. In tomcats classpath, then you are going to have problems, as
the standard VelocityServlet uses a singleton, and since it is outside of
your webapp classloader (if you keep the jar outside of the webapp), it
doesn't get recycled on webappp change.  The solution, of course, is to 
just
keep it in the webapp.

2) reloading templates/macros - Velocity can reload both templates and
macros while developing.  You can even reload the global macro library, 
but
that's probably in the latest dev tree, 1.4.  See the docs.


-- 
Geir Magnusson Jr. 
geirm@adeptra.com                                    +1-203-355-2219 (w)
Adeptra Inc.                                         +1-203-247-1713 (m)



--
To unsubscribe, e-mail:   <
mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:velocity-user-help@jakarta.apache.org>



Re: Must Restart Server??

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 11/4/02 1:54 PM, "Jenny Brown" <je...@bigbrother.net> wrote:

> On Mon, 4 Nov 2002 rgrieselhuber@teamsol.com wrote:
> 
>> Thanks Kevin. I think this is actually a Velocity thing... None of my
>> other servlets require me to start the server, or even the webapp for that
>> matter. It seems like there should be a cache setting somewhere in
>> Velocity that enables me to make changes to a Servlet that extends
>> VelocityServlet without needing to restart the container. Am I wrong?
>> Thanks!
>> Ray
> 
> 
> I have noticed even under Tomcat that if I make a change to a velocity
> template, it reloads automatically, EXCEPT if the change I made was
> inside of a macro, in which case I have to force a servlet container
> restart to see the change.
> 
> I'm not sure why macros are caching, but check if your change was in a
> macro.
> 

Seems like we are mixing things up here.

There are two things :

1) Server restart - this all depends on where you put the Velocity jar, and
where you put your code, and how tomcat is configured.  Tomcat can be
configured to dump your webapp and reload from the lib & classes directory
in your WEB-INF when you change a class or jar.  Velocity 1.3 should have no
problems anymore with this - pre 1.3 there was an issue with the
introspection caching not getting dumped on classloader change, but that's
been fixed.  Also, note that if you have a velocity jar outside of your
webapp, i.e. In tomcats classpath, then you are going to have problems, as
the standard VelocityServlet uses a singleton, and since it is outside of
your webapp classloader (if you keep the jar outside of the webapp), it
doesn't get recycled on webappp change.  The solution, of course, is to just
keep it in the webapp.

2) reloading templates/macros - Velocity can reload both templates and
macros while developing.  You can even reload the global macro library, but
that's probably in the latest dev tree, 1.4.  See the docs.


-- 
Geir Magnusson Jr. 
geirm@adeptra.com                                    +1-203-355-2219 (w)
Adeptra Inc.                                         +1-203-247-1713 (m)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Must Restart Server??

Posted by Jenny Brown <je...@bigbrother.net>.
On Mon, 4 Nov 2002 rgrieselhuber@teamsol.com wrote:

> Thanks Kevin. I think this is actually a Velocity thing... None of my
> other servlets require me to start the server, or even the webapp for that
> matter. It seems like there should be a cache setting somewhere in
> Velocity that enables me to make changes to a Servlet that extends
> VelocityServlet without needing to restart the container. Am I wrong?
> Thanks!
> Ray


I have noticed even under Tomcat that if I make a change to a velocity
template, it reloads automatically, EXCEPT if the change I made was
inside of a macro, in which case I have to force a servlet container
restart to see the change.

I'm not sure why macros are caching, but check if your change was in a
macro.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Must Restart Server??

Posted by rg...@teamsol.com.
Thanks Kevin. I think this is actually a Velocity thing... None of my 
other servlets require me to start the server, or even the webapp for that 
matter. It seems like there should be a cache setting somewhere in 
Velocity that enables me to make changes to a Servlet that extends 
VelocityServlet without needing to restart the container. Am I wrong?
Thanks!
Ray





"Kevin Baynes" <kb...@seagullsw.com>
11/04/2002 01:34 PM
Please respond to "Velocity Users List"
 
        To:     "Velocity Users List" <ve...@jakarta.apache.org>
        cc:     (bcc: Ray Grieselhuber/Teamwork)
        Subject:        RE: Must Restart Server??


I have not used WebSphere in a while, so I did a quick search and found a
WAS FAQ that may help.
http://www-3.ibm.com/software/webservers/appserv/wasfaq.html You should 
also
be able to reload your Web app, rather than restarting.

Quick Note:
I currently use Tomcat for development. It has a Manager servlet that 
allows
you to reload web applications (without restarting Tomcat). I also use Ant
for make tasks. I have an Ant task that compiles my code, jars it up, 
copies
it into Tomcat and then sends an HTTP request to the Tomcat Manager 
servlet
to reload the webapp I'm working on... I go from code to browser in about 
20
seconds (with one command).

~k

> -----Original Message-----
> From: rgrieselhuber@teamsol.com [mailto:rgrieselhuber@teamsol.com]
> Sent: Monday, November 04, 2002 1:10 PM
> To: velocity-user@jakarta.apache.org
> Subject: Must Restart Server??
>
>
> I am fairly new to Velocity. Every time I make a change to my servlet,
> the
> app is unable to display the data that I am accessing from my database.
> In
> order to properly see my changes, I have to restart the entire
> application
> server! This, needless to say, is not good for productivity. How do I
> turn
> off this feature? I am using WebSphere (WSAD).
> Thanks!
> Ray
>


--
To unsubscribe, e-mail:   <
mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:velocity-user-help@jakarta.apache.org>



RE: Must Restart Server??

Posted by Kevin Baynes <kb...@seagullsw.com>.
I have not used WebSphere in a while, so I did a quick search and found a
WAS FAQ that may help.
http://www-3.ibm.com/software/webservers/appserv/wasfaq.html You should also
be able to reload your Web app, rather than restarting.

Quick Note:
I currently use Tomcat for development. It has a Manager servlet that allows
you to reload web applications (without restarting Tomcat). I also use Ant
for make tasks. I have an Ant task that compiles my code, jars it up, copies
it into Tomcat and then sends an HTTP request to the Tomcat Manager servlet
to reload the webapp I'm working on... I go from code to browser in about 20
seconds (with one command).

~k

> -----Original Message-----
> From: rgrieselhuber@teamsol.com [mailto:rgrieselhuber@teamsol.com]
> Sent: Monday, November 04, 2002 1:10 PM
> To: velocity-user@jakarta.apache.org
> Subject: Must Restart Server??
>
>
> I am fairly new to Velocity. Every time I make a change to my servlet,
> the
> app is unable to display the data that I am accessing from my database.
> In
> order to properly see my changes, I have to restart the entire
> application
> server! This, needless to say, is not good for productivity. How do I
> turn
> off this feature? I am using WebSphere (WSAD).
> Thanks!
> Ray
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>