Velocity behavior explained?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Velocity behavior explained?

Christian Mittendorf
Hello!

We experienced a problem with Cayenne and multiple data nodes.

I will describe our setup first: we run multiple webapps on a tomcat.  
The cayenne.xml
is stored in the shared directory, most of the third party jars are  
also located there.
Cayenne-nodeps.jar is always part of each webapp.

The setup was working fine until we added 2 more data nodes to  
cayenne.xml. We were then
running into a problem that we cannot access the two new nodes, but  
we could still use our
first node.

In catalina.out we saw the following error:

SEVERE: Servlet.service() for servlet pos threw exception
java.lang.ExceptionInInitializerError
         at  
org.objectstyle.cayenne.access.jdbc.SQLTemplateSelectExecutionPlan.execu
te(SQLTemplateSelectExecutionPlan.java:97)
         at org.objectstyle.cayenne.access.DataNode.performQueries
(DataNode.java:341)
         at org.objectstyle.cayenne.access.DataDomain.performQueries
(DataDomain.java:654)
[...]
Caused by: org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1B2  
July 25 2004] Error setting up Velocity RuntimeInstance.
         at  
org.objectstyle.cayenne.access.jdbc.SQLTemplateProcessor.initVelocityRun
time(SQLTemplateProcessor.java:119)
         at  
org.objectstyle.cayenne.access.jdbc.SQLTemplateProcessor.<clinit>
(SQLTemplateProcessor.java:96)
         ... 30 more
Caused by: java.lang.Exception: The specified class for  
Resourcemanager  
(org.objectstyle.cayenne.access.jdbc.SQLTemplateResourceManager) does  
not ex
ist (or is not accessible to the current classlaoder.
         at  
org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager
(RuntimeInstance.java:506)
         at org.apache.velocity.runtime.RuntimeInstance.init
(RuntimeInstance.java:227)
         at  
org.objectstyle.cayenne.access.jdbc.SQLTemplateProcessor.initVelocityRun
time(SQLTemplateProcessor.java:116)
         ... 31 more

Changing our setup and moving velocity.jar into each webapp did solve  
the problem.

However, we would now like to understand it. What is the reason for  
this behaviour?

Christian

Reply | Threaded
Open this post in threaded view
|

Re: Velocity behavior explained?

Mike Kienenberger-2
Christian Mittendorf (christian.mittendor..reenet.de) wrote,
> We experienced a problem with Cayenne and multiple data nodes.

>

> I will describe our setup first: we run multiple webapps on a tomcat.

> The cayenne.xml

> is stored in the shared directory, most of the third party jars are

> also located there.

> Cayenne-nodeps.jar is always part of each webapp.

>

> The setup was working fine until we added 2 more data nodes to

> cayenne.xml. We were then

> running into a problem that we cannot access the two new nodes, but

> we could still use our

> first node.

>

> [...]
>

> Changing our setup and moving velocity.jar into each webapp did solve

> the problem.

>

> However, we would now like to understand it. What is the reason for

> this behaviour?

It's a classloader issue, but I don't know the specifics.

I think it's considered a j2ee best practice to supply all jar files in the
webapp. Otherwise, you'll experience hard-to-explain-or-debug behavor.  You
will also have a much more difficult time upgrading individual web
applications.

-Mike