You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Rick <ri...@merindus.com> on 2004/02/24 12:46:17 UTC
OJB throws OJBRuntimeException if two applications are deployed on AppServer
Hi,
We have developed two applications. Both use OJB for persistence. When we
deploy them together on Sun One Application server, we find the one deployed
last doesn't work. It throws the org.apache.ojb.broker.OJBRuntimeException
exception when trying to load the objects that represent the tables in the
database.
We searched around a little and found this occurs in the Orion application
server as well.
Could anyone suggest any steps to be taken to get around this problem?
By the way, we rebuild our applications as .WAR files, deployed them on Tomcat
and found them to work fine.
Here's (part of) the stack trace from Sun One:
Root Cause
org.apache.ojb.broker.OJBRuntimeException: Class, TCIS_ASC.valueobject.Person,
could not be found.
at
org.apache.ojb.broker.metadata.DescriptorRepository.discoverDescriptor(Unknown
Source)
at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor
(Unknown Source)
at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor
(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorByQuery
(Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery
(Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery
(Unknown Source)
at TCIS_ASC.dataaccess.ApplicationOJBDAO.getAllApplications
(ApplicationOJBDAO.java:97)
at TCIS_ASC.service.SearchService.searchApplicant
(SearchService.java:64)
at TCIS_ASC.action.AppStatusSearchAction.execute
(AppStatusSearchAction.java:79)
at org.apache.struts.action.RequestProcessor.processActionPerform
(RequestProcessor.
Caused by: java.lang.ClassNotFoundException: TCIS_ASC.valueobject.Person
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
Thanks & Regards
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: OJB throws OJBRuntimeException if two applications are deployed
on AppServer
Posted by Martin Kalén <ma...@curalia.se>.
Rick wrote:
> We have developed two applications. Both use OJB for persistence. When we
> deploy them together on Sun One Application server, we find the one deployed
> last doesn't work.
[...]
> By the way, we rebuild our applications as .WAR files, deployed them on Tomcat
> and found them to work fine.
WAR files deployed in Tomcat will run as two separate servlet instances
with two separate class-loaders (loading OJB from each webapps
WEB-INF/lib and/or WEB-INF/classes).
It looks like your deployment in Sun One Application Server loads OJB
with the same class-loader, which will give you headaches if trying to
use two different repository-mappings and/or different OJB.properties.
When OJB is first referenced it will bootstrap it's metadata manager and
statically load OJB.properties, which in turn references the
repository-files that are also loaded statically. I.e. "first
application wins" in your scenario.
To overcome this you can either try to separate class-loading between
your apps in Sun One or use OJB profiles to load the repository on a
per-thread-basis at runtime.
For more on OJB profiles, see e.g.
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgNo=9705
In that mail I outline how we use OJB with an empty global (static)
repository and load the correct class-descriptors from the thread that
needs them.
With this pattern we can run a Cocoon-servlet in Tomcat, use only one
OJB instance in cocoon/WEB-INF/lib, but still have multiple Cocoon
"applications" in sub-sitemaps running with separate repository
descriptors and class-mappings.
--
Martin Kalén
Curalia AB Web: http://www.curalia.se
Orrspelsvägen 2B Mail: info@curalia.se
SE-182 79 Stocksund Tel: +46-8-410 064 40
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org