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 Charles Anthony <ch...@hpdsoftware.com> on 2003/12/09 08:23:33 UTC

RE: ojb mixing up jdbc-connection-descriptors

I think you'll find that putting OJB in /common/lib is your problem.

Try putting the the OJB jars in the each webapps WEB-INF/lib directory, and
see if the problem goes away.
I think it will.

Cheers,

Charles.

> -----Original Message-----
> From: Michael Mogley [mailto:mmogley@adelphia.net]
> Sent: 09 December 2003 07:29
> To: OJB Users List
> Subject: ojb mixing up jdbc-connection-descriptors
> 
> 
> OK, I've got two Tomcat webapps.  Each with it's own 
> OJB.properties and repository xml files defining two 
> different mappings and two different connection descriptors.
> 
> Ojb libraries are in common/lib to allow sharing among webapps.
> 
> Everything was working file until I added the second webapp.
> 
> Now, observing the logs, it seems the first webapp is getting 
> the broker corresponding to the connection-descriptor in the 
> second one.  In both apps, I do 
> PersistenceBroker.defaultBrokerInstance() to obtain the 
> brokers.  I tried giving each connection-descriptor a unique 
> jcd-alias, but to no avail.  Actually, that's how I 
> discovered what the problem is.
> 
> How do I tell Ojb to reference the connection-descriptor 
> defined for a specific webapp?  This seems like a 
> classloading issue.  Perhaps, there is a place in the Ojb 
> code without a needed Thread.getContextClassLoader() call?
> 
> Please help.  I'm running out of time debugging Ojb issues.
> 
> Michael
> 


___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ojb mixing up jdbc-connection-descriptors

Posted by Michael Mogley <mm...@adelphia.net>.
Actually Armin, I don't think your way will work either.  Because the
repository.xml must import via entity references all of the mappings for all
the apps.  But if the domain objects are not all shared, then the first app
to init Ojb will error out on the referenced domain-classest DOESN'T have
(since these classes are scoped by a specific webapp classloader).

OK, Ojb wins.  I'm giving each app its own copy.

Michael

----- Original Message ----- 
From: "Michael Mogley" <mm...@adelphia.net>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Tuesday, December 09, 2003 12:17 AM
Subject: Re: ojb mixing up jdbc-connection-descriptors


> Hi Armin,
>
> > If you want to share OJB, then put all OJB jars under tomcat shared
> > ClassLoader (I think $CATALINA_HOME/lib). Use one configuration for all
> > webapps. For each database define a connection-descriptor and use a
> > jcdAlias name. Lookup PB instances using the defined jcdAlias names.
>
> This sounds like what I need.  So in this scheme, I would place
> ojb.properties as well as all my repository.xml files into the shared lib
> dir as well?  I'll try it.  Thanks for the quick replies.
>
> Michael
>
> >
> > regards,
> > Armin
> >
> > >
> > > Michael
> > >
> > > ----- Original Message ----- 
> > > From: "Charles Anthony" <ch...@hpdsoftware.com>
> > > To: "'OJB Users List'" <oj...@db.apache.org>
> > > Sent: Monday, December 08, 2003 11:23 PM
> > > Subject: RE: ojb mixing up jdbc-connection-descriptors
> > >
> > >
> > >
> > >>I think you'll find that putting OJB in /common/lib is your problem.
> > >>
> > >>Try putting the the OJB jars in the each webapps WEB-INF/lib
directory,
> > >
> > > and
> > >
> > >>see if the problem goes away.
> > >>I think it will.
> > >>
> > >>Cheers,
> > >>
> > >>Charles.
> > >>
> > >>
> > >>>-----Original Message-----
> > >>>From: Michael Mogley [mailto:mmogley@adelphia.net]
> > >>>Sent: 09 December 2003 07:29
> > >>>To: OJB Users List
> > >>>Subject: ojb mixing up jdbc-connection-descriptors
> > >>>
> > >>>
> > >>>OK, I've got two Tomcat webapps.  Each with it's own
> > >>>OJB.properties and repository xml files defining two
> > >>>different mappings and two different connection descriptors.
> > >>>
> > >>>Ojb libraries are in common/lib to allow sharing among webapps.
> > >>>
> > >>>Everything was working file until I added the second webapp.
> > >>>
> > >>>Now, observing the logs, it seems the first webapp is getting
> > >>>the broker corresponding to the connection-descriptor in the
> > >>>second one.  In both apps, I do
> > >>>PersistenceBroker.defaultBrokerInstance() to obtain the
> > >>>brokers.  I tried giving each connection-descriptor a unique
> > >>>jcd-alias, but to no avail.  Actually, that's how I
> > >>>discovered what the problem is.
> > >>>
> > >>>How do I tell Ojb to reference the connection-descriptor
> > >>>defined for a specific webapp?  This seems like a
> > >>>classloading issue.  Perhaps, there is a place in the Ojb
> > >>>code without a needed Thread.getContextClassLoader() call?
> > >>>
> > >>>Please help.  I'm running out of time debugging Ojb issues.
> > >>>
> > >>>Michael
> > >>>
> > >>
> > >>
> > >>___________________________________________________________
> > >>HPD Software Ltd. - Helping Business Finance Business
> > >>Email terms and conditions: www.hpdsoftware.com/disclaimer
> > >>
> > >>
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > >>For additional commands, e-mail: ojb-user-help@db.apache.org
> > >>
> > >>
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail: ojb-user-help@db.apache.org
> > >
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ojb mixing up jdbc-connection-descriptors

Posted by Michael Mogley <mm...@adelphia.net>.
Hi Armin,

> If you want to share OJB, then put all OJB jars under tomcat shared
> ClassLoader (I think $CATALINA_HOME/lib). Use one configuration for all
> webapps. For each database define a connection-descriptor and use a
> jcdAlias name. Lookup PB instances using the defined jcdAlias names.

This sounds like what I need.  So in this scheme, I would place
ojb.properties as well as all my repository.xml files into the shared lib
dir as well?  I'll try it.  Thanks for the quick replies.

Michael

>
> regards,
> Armin
>
> >
> > Michael
> >
> > ----- Original Message ----- 
> > From: "Charles Anthony" <ch...@hpdsoftware.com>
> > To: "'OJB Users List'" <oj...@db.apache.org>
> > Sent: Monday, December 08, 2003 11:23 PM
> > Subject: RE: ojb mixing up jdbc-connection-descriptors
> >
> >
> >
> >>I think you'll find that putting OJB in /common/lib is your problem.
> >>
> >>Try putting the the OJB jars in the each webapps WEB-INF/lib directory,
> >
> > and
> >
> >>see if the problem goes away.
> >>I think it will.
> >>
> >>Cheers,
> >>
> >>Charles.
> >>
> >>
> >>>-----Original Message-----
> >>>From: Michael Mogley [mailto:mmogley@adelphia.net]
> >>>Sent: 09 December 2003 07:29
> >>>To: OJB Users List
> >>>Subject: ojb mixing up jdbc-connection-descriptors
> >>>
> >>>
> >>>OK, I've got two Tomcat webapps.  Each with it's own
> >>>OJB.properties and repository xml files defining two
> >>>different mappings and two different connection descriptors.
> >>>
> >>>Ojb libraries are in common/lib to allow sharing among webapps.
> >>>
> >>>Everything was working file until I added the second webapp.
> >>>
> >>>Now, observing the logs, it seems the first webapp is getting
> >>>the broker corresponding to the connection-descriptor in the
> >>>second one.  In both apps, I do
> >>>PersistenceBroker.defaultBrokerInstance() to obtain the
> >>>brokers.  I tried giving each connection-descriptor a unique
> >>>jcd-alias, but to no avail.  Actually, that's how I
> >>>discovered what the problem is.
> >>>
> >>>How do I tell Ojb to reference the connection-descriptor
> >>>defined for a specific webapp?  This seems like a
> >>>classloading issue.  Perhaps, there is a place in the Ojb
> >>>code without a needed Thread.getContextClassLoader() call?
> >>>
> >>>Please help.  I'm running out of time debugging Ojb issues.
> >>>
> >>>Michael
> >>>
> >>
> >>
> >>___________________________________________________________
> >>HPD Software Ltd. - Helping Business Finance Business
> >>Email terms and conditions: www.hpdsoftware.com/disclaimer
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> >>For additional commands, e-mail: ojb-user-help@db.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ojb mixing up jdbc-connection-descriptors

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Michael,

Michael Mogley wrote:

> You're probably right.  But is there no way then to keep Ojb as a shared
> library?
hmm, I suppose it should be possible (e.g. it's possible to deploy OJB 
within ejb's and share these beans across webapps). But does it make 
sense? If you want to change one app, you have to shutdown/restart 
Tomcat because you share OJB resources.

 >>>OK, I've got two Tomcat webapps.  Each with it's own
 >>>OJB.properties and repository xml files

if you want to share OJB, then you can't use different OJB.properties 
and repository files.
If you want discrete configurations for each webapp, then you need 
different ClassLoader for each webapp, thus you have to put OJB 
libraries in your web-inf directory (as Charles describe).

If you want to share OJB, then put all OJB jars under tomcat shared 
ClassLoader (I think $CATALINA_HOME/lib). Use one configuration for all 
webapps. For each database define a connection-descriptor and use a 
jcdAlias name. Lookup PB instances using the defined jcdAlias names.

regards,
Armin

> 
> Michael
> 
> ----- Original Message ----- 
> From: "Charles Anthony" <ch...@hpdsoftware.com>
> To: "'OJB Users List'" <oj...@db.apache.org>
> Sent: Monday, December 08, 2003 11:23 PM
> Subject: RE: ojb mixing up jdbc-connection-descriptors
> 
> 
> 
>>I think you'll find that putting OJB in /common/lib is your problem.
>>
>>Try putting the the OJB jars in the each webapps WEB-INF/lib directory,
> 
> and
> 
>>see if the problem goes away.
>>I think it will.
>>
>>Cheers,
>>
>>Charles.
>>
>>
>>>-----Original Message-----
>>>From: Michael Mogley [mailto:mmogley@adelphia.net]
>>>Sent: 09 December 2003 07:29
>>>To: OJB Users List
>>>Subject: ojb mixing up jdbc-connection-descriptors
>>>
>>>
>>>OK, I've got two Tomcat webapps.  Each with it's own
>>>OJB.properties and repository xml files defining two
>>>different mappings and two different connection descriptors.
>>>
>>>Ojb libraries are in common/lib to allow sharing among webapps.
>>>
>>>Everything was working file until I added the second webapp.
>>>
>>>Now, observing the logs, it seems the first webapp is getting
>>>the broker corresponding to the connection-descriptor in the
>>>second one.  In both apps, I do
>>>PersistenceBroker.defaultBrokerInstance() to obtain the
>>>brokers.  I tried giving each connection-descriptor a unique
>>>jcd-alias, but to no avail.  Actually, that's how I
>>>discovered what the problem is.
>>>
>>>How do I tell Ojb to reference the connection-descriptor
>>>defined for a specific webapp?  This seems like a
>>>classloading issue.  Perhaps, there is a place in the Ojb
>>>code without a needed Thread.getContextClassLoader() call?
>>>
>>>Please help.  I'm running out of time debugging Ojb issues.
>>>
>>>Michael
>>>
>>
>>
>>___________________________________________________________
>>HPD Software Ltd. - Helping Business Finance Business
>>Email terms and conditions: www.hpdsoftware.com/disclaimer
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ojb mixing up jdbc-connection-descriptors

Posted by Michael Mogley <mm...@adelphia.net>.
You're probably right.  But is there no way then to keep Ojb as a shared
library?

Michael

----- Original Message ----- 
From: "Charles Anthony" <ch...@hpdsoftware.com>
To: "'OJB Users List'" <oj...@db.apache.org>
Sent: Monday, December 08, 2003 11:23 PM
Subject: RE: ojb mixing up jdbc-connection-descriptors


> I think you'll find that putting OJB in /common/lib is your problem.
>
> Try putting the the OJB jars in the each webapps WEB-INF/lib directory,
and
> see if the problem goes away.
> I think it will.
>
> Cheers,
>
> Charles.
>
> > -----Original Message-----
> > From: Michael Mogley [mailto:mmogley@adelphia.net]
> > Sent: 09 December 2003 07:29
> > To: OJB Users List
> > Subject: ojb mixing up jdbc-connection-descriptors
> >
> >
> > OK, I've got two Tomcat webapps.  Each with it's own
> > OJB.properties and repository xml files defining two
> > different mappings and two different connection descriptors.
> >
> > Ojb libraries are in common/lib to allow sharing among webapps.
> >
> > Everything was working file until I added the second webapp.
> >
> > Now, observing the logs, it seems the first webapp is getting
> > the broker corresponding to the connection-descriptor in the
> > second one.  In both apps, I do
> > PersistenceBroker.defaultBrokerInstance() to obtain the
> > brokers.  I tried giving each connection-descriptor a unique
> > jcd-alias, but to no avail.  Actually, that's how I
> > discovered what the problem is.
> >
> > How do I tell Ojb to reference the connection-descriptor
> > defined for a specific webapp?  This seems like a
> > classloading issue.  Perhaps, there is a place in the Ojb
> > code without a needed Thread.getContextClassLoader() call?
> >
> > Please help.  I'm running out of time debugging Ojb issues.
> >
> > Michael
> >
>
>
> ___________________________________________________________
> HPD Software Ltd. - Helping Business Finance Business
> Email terms and conditions: www.hpdsoftware.com/disclaimer
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org