What is a servlet container you use, Tomcat, Jetty or
something else?

Make sure you don't have velocity.jar in a global path
(java classpath, jre extension folders, tomcat
common/lib or similar in other containers).

If you put velocity.jar to webapp/WEB-INF/lib folder
you should get a private instance on each web
application. This is how I have been using it for 2
years now, I use Tomcat btw.

Only requirement is that servlet container actually
uses a separate class loader for each web application.
This should be ok if use any mainstream container
engine.


--- Nathan Bubna <[EMAIL PROTECTED]> wrote:

> What version of VelocityTools are you using?
> 
> On 1/12/07, Ryan Clifton <[EMAIL PROTECTED]> wrote:
> > Ok, after spending a couple more hours playing
> around with this, here's
> > what I've found:
> >
> > I can use the FileResourceLoader or the
> WebappLoader and they both
> > appear to work fine.
> > I can get either web-app running with either
> loader just fine.
> > I can even configure the web-apps with different
> loaders and they work
> > fine as long as the other isn't loaded.
> > When i turn on both web-apps, the second loader is
> totally ignored.
> > Even if they are different (webapploader vs
> fileloader).
> > The only thing in the logs to indicate Velocity
> recognizes something
> > fishy is going on is:
> >
> > 007-01-12 17:32:28,484 - Introspector : detected
> classloader change.
> > Dumping cache.
> >
> > The log file clearly shows the FileResourceLoader
> starting up, but there
> > is no log of the WebappLoader starting (setup on
> the other servlet).
> >
> > I really thought I had this thing licked when i
> used a different loader
> > for each web-app, but no dice.  :(
> >
> > foo1 config:
> >   runtime.log.logsystem.class =
> >
> org.apache.velocity.runtime.log.SimpleLog4JLogSystem
> >   resource.loader = file
> >   file.resource.loader.class =
> >
>
org.apache.velocity.runtime.resource.loader.FileResourceLoader
> >    file.resource.loader.path =
> C:\\sites\\foo2\\web
> >    file.resource.loader.cache = true
> >    file.resource.loader.modificationCheckInterval
> = 2
> >     runtime.log.invalid.reference = true
> > runtime.log.error.stacktrace = true
> > runtime.log.warn.stacktrace = true
> > runtime.log.info.stacktrace = true
> >
> > foo2 config:
> >
> >   runtime.log.logsystem.class =
> >
> org.apache.velocity.runtime.log.SimpleLog4JLogSystem
> >   resource.loader = webapp
> >   webapp.resource.loader.class =
> >
> org.apache.velocity.tools.view.servlet.WebappLoader
> >   webapp.resource.loader.path = web/templates/,
> web/, /
> >   webapp.resource.loader.cache = true
> >   webapp.resource.loader.modificationCheckInterval
> = 2
> >     runtime.log.invalid.reference = true
> > runtime.log.error.stacktrace = true
> > runtime.log.warn.stacktrace = true
> > runtime.log.info.stacktrace = true
> >
> > Here's the log that I get:
..clip..
> > ==> here is where i hit reload on the other
webapp, but the config doesn't run again.
> >
> > Nathan Bubna wrote:
> > > Ok, here's a few questions:
> > >
> > > Is there any particular reason that you are
> using the FileResourceLoader?  Have you tried
getting this to work with the WebappLoader that the
VVS uses by default?
> > > Can you show us some log output for both apps?
> > >
> > > On 1/12/07, Ryan Clifton <[EMAIL PROTECTED]>
> wrote:
> > >>
> > >>  Well, I had thought this would be an easy
problem to fix, but it turns out that I am using the
VelocityViewServlet.  I also followed the directions
for configuring the resource loader within each
web-app through velocity.properties.  
The file definitely works for the first app loaded (I
can make the path invalid and the whole thing
> breaks), but the second app in my  servlet container
config does not load it's
> path correctly.  So both sites run off the same set
of templates from the foo1 site.
> > >>
> > >>  Again, if i remove foo1 from the container,
foo2 works perfectly.
> > >>
> > >>  Any ideas?
> > >>  Thanks everyone.
> > >>
> > >>  (velocity.properties : foo1)
> > >>   resource.loader = file
> > >>    file.resource.loader.class =
> > >>
>
org.apache.velocity.runtime.resource.loader.FileResourceLoader
> > >>    file.resource.loader.path =
> C:\\sites\\foo1\\web
> 
=== message truncated ===



 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to