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 Luis Camargo <lu...@shaw.ca> on 2004/06/01 07:16:09 UTC

Re: Child Table insert at same time as Parent and Auto generated PK

<text removed>

> 
> Mark
> 
> Armin Waibel <arminw <at> apache.org> wrote:
> Mark Spritzler wrote:
> 
> > No there is only one jar file which is wrapped into the .war file that is
deployed.
> >
> 
> Mark to verify my assumption, can you change line 558 in MetadataManager 
> to force a log message, e.g.
> 
> Object temp = iterator.next();
> log.error("## Test: " + temp.getClass);
> descriptor = (JdbcConnectionDescriptor) temp;
> 
> then we can decide it's a bug in OJB or a class loader problem.
> 
> regards,
> Armin
> 
> > Mark
> > 
> > Armin Waibel wrote:
> > Hi Mark,
> > 
> > 
> >>java.lang.ClassCastException at
> >>org.apache.ojb.broker.metadata.MetadataManager.buildDefaultKey(
> >>MetadataManager.java:558) at
> >>org.apache.ojb.broker.metadata.MetadataManager.init(
> >>MetadataManager.java:164) at
> > 
> > 
> > Here is the source code:
> > private PBKey buildDefaultKey()
> > {
> > List descriptors = connectionRepository().getAllDescriptor();
> > JdbcConnectionDescriptor descriptor;
> > for (Iterator iterator = descriptors.iterator(); iterator.hasNext();)
> > {
> > #### ===> descriptor = (JdbcConnectionDescriptor) iterator.next();
> > if (descriptor.isDefaultConnection())
> > ....
> > 
> > this is really strange, because it's guaranteed that all iterated 
> > objects are instance of class JdbcConnectionDescriptor. So I think it 
> > could be a class loader problem. Is there more than one ojb.jar file in 
> > classpath?
> > 
> > regards,
> > Armin

<text removed>


Hi,

I'm having exactly the same problem. Modified the source to read:

List descriptors = connectionRepository().getAllDescriptor();
        org.apache.ojb.broker.metadata.JdbcConnectionDescriptor descriptor;
        for (Iterator iterator = descriptors.iterator(); iterator.hasNext();)
        {
	    Object temp = iterator.next();
	    log.error("### Test 2: " + temp.getClass());
            descriptor =
(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor) temp;

The output in the Jboss log reads:


2004-05-31 22:01:52,970 ERROR [org.apache.ojb.broker.metadata.MetadataManager]
### Test 2: class org.apache.ojb.metadata.JdbcConnectionDescriptor

It's really weird since temp is exactly the same class as both the descriptor
variable and the cast!.


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


Re: Child Table insert at same time as Parent and Auto generated PK

Posted by Luis Camargo <lu...@shaw.ca>.
> 
> Hi,
> 
> I'm having exactly the same problem. Modified the source to read:
> 
> List descriptors = connectionRepository().getAllDescriptor();
>         org.apache.ojb.broker.metadata.JdbcConnectionDescriptor descriptor;
>         for (Iterator iterator = descriptors.iterator(); iterator.hasNext();)
>         {
> 	    Object temp = iterator.next();
> 	    log.error("### Test 2: " + temp.getClass());
>             descriptor =
> (org.apache.ojb.broker.metadata.JdbcConnectionDescriptor) temp;
> 
> The output in the Jboss log reads:
> 
> 2004-05-31 22:01:52,970 ERROR [org.apache.ojb.broker.metadata.MetadataManager]
> ### Test 2: class org.apache.ojb.metadata.JdbcConnectionDescriptor
> 
> It's really weird since temp is exactly the same class as both the descriptor
> variable and the cast!.
> 

Seems like the problem was not with OJB, but with Jboss. 

Used the code from 
http://www.javaworld.com/javaworld/javaqa/2003-07/01-qa-0711-classsrc.html
to find out where the class were loaded from.

The classes for the objects from the iterator were loaded from:
jboss/server/all/tmp/deploy/tmp2436VideoStore.ear

The class of the descriptor variable was loaded from:
jboss/server/all/tmp/deploy/tmp2604VideoStore.ear

For some reason JBoss was loading code from different ear files during the same
session. Stopping JBoss to clean the tmp directory fixed the problem.

Cheers




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