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 "Clute, Andrew" <An...@osn.state.oh.us> on 2004/08/13 20:03:02 UTC

Jboss and ClassCastException (MetadataManager and JdbcConnectionDescriptor) -- anyone else have it?

I am running OJB 1.0 with JBoss 3.2.5.

On *occasional* redeployments of my EAR file (with nested Jars and Wars)
I will get a nasty ClassCastException that is only fixable by restarting
Jboss. This happens in the MetadataManager.buildDefaultKey() method.

The top part of the stack trace is posted below. From what I can tell,
the exception stems from not that it is the wrong class attempting to be
casted, but it is an instance of a class that is from a previous
deployment (and thus classloader) that is trying to be casted in to the
same class type in a new class loader. 

I have taken a quick look at MetadataManager, and don't see anything
terribly obvious as to the cause -- which I would assume is a static
instance to the Collection of JdbcConnectionsDescriptors. There is a a
ThreadLocal variable, but I don't think that is the cause.

So, my question is: has anyone else seen this? Can anyone think of why
on a undeployment that not all of the OJB classes are removed from the
VM?

Thanks!

Here is the stacktrace:

2004-08-11 13:24:22,923 ERROR [org.jboss.ejb.plugins.LogInterceptor]
RuntimeException:
java.lang.ClassCastException
	at
org.apache.ojb.broker.metadata.MetadataManager.buildDefaultKey(Unknown
Source)
	at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown
Source)
	at org.apache.ojb.broker.metadata.MetadataManager.<init>(Unknown
Source)
	at
org.apache.ojb.broker.metadata.MetadataManager.getInstance(Unknown
Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKe
y(Unknown Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersi
stenceBroker(Unknown Source)
	at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(
Unknown Source)
	at
org.osn.persistence.PersistenceSessionPBImpl.getBroker(PersistenceSessio
nPBImpl.java:79)

Re: Jboss and ClassCastException (MetadataManager and JdbcConnectionDescriptor) -- anyone else have it?

Posted by Armin Waibel <ar...@apache.org>.
Hi Andrew,

think this is a ClassLoader problem. Maybe ojb.jar itself or one of the 
jars OJB depends on is not correctly reloaded.

Did you follow the instructions made by Stephen Ting

http://db.apache.org/ojb/docu/guides/deployment.html#Packing+an+.ear+file

regards,
Armin


Clute, Andrew wrote:
> I am running OJB 1.0 with JBoss 3.2.5.
> 
> On *occasional* redeployments of my EAR file (with nested Jars and Wars)
> I will get a nasty ClassCastException that is only fixable by restarting
> Jboss. This happens in the MetadataManager.buildDefaultKey() method.
> 
> The top part of the stack trace is posted below. From what I can tell,
> the exception stems from not that it is the wrong class attempting to be
> casted, but it is an instance of a class that is from a previous
> deployment (and thus classloader) that is trying to be casted in to the
> same class type in a new class loader. 
> 
> I have taken a quick look at MetadataManager, and don't see anything
> terribly obvious as to the cause -- which I would assume is a static
> instance to the Collection of JdbcConnectionsDescriptors. There is a a
> ThreadLocal variable, but I don't think that is the cause.
> 
> So, my question is: has anyone else seen this? Can anyone think of why
> on a undeployment that not all of the OJB classes are removed from the
> VM?
> 
> Thanks!
> 
> Here is the stacktrace:
> 
> 2004-08-11 13:24:22,923 ERROR [org.jboss.ejb.plugins.LogInterceptor]
> RuntimeException:
> java.lang.ClassCastException
> 	at
> org.apache.ojb.broker.metadata.MetadataManager.buildDefaultKey(Unknown
> Source)
> 	at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown
> Source)
> 	at org.apache.ojb.broker.metadata.MetadataManager.<init>(Unknown
> Source)
> 	at
> org.apache.ojb.broker.metadata.MetadataManager.getInstance(Unknown
> Source)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKe
> y(Unknown Source)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersi
> stenceBroker(Unknown Source)
> 	at
> org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(
> Unknown Source)
> 	at
> org.osn.persistence.PersistenceSessionPBImpl.getBroker(PersistenceSessio
> nPBImpl.java:79)
> 

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


Re: Jboss and ClassCastException (MetadataManager and JdbcConnectionDescriptor) -- anyone else have it?

Posted by Clay Mitchell <cl...@pfd.net>.
I get the same thing pretty much every time I redeploy with Orion
Application Server.

Any idea what causes this? Is there any way to stop it?

Thanks
-Clay

> I am running OJB 1.0 with JBoss 3.2.5.
>
> On *occasional* redeployments of my EAR file (with nested Jars and Wars)
> I will get a nasty ClassCastException that is only fixable by restarting
> Jboss. This happens in the MetadataManager.buildDefaultKey() method.
>
> The top part of the stack trace is posted below. From what I can tell,
> the exception stems from not that it is the wrong class attempting to be
> casted, but it is an instance of a class that is from a previous
> deployment (and thus classloader) that is trying to be casted in to the
> same class type in a new class loader.
>
> I have taken a quick look at MetadataManager, and don't see anything
> terribly obvious as to the cause -- which I would assume is a static
> instance to the Collection of JdbcConnectionsDescriptors. There is a a
> ThreadLocal variable, but I don't think that is the cause.
>
> So, my question is: has anyone else seen this? Can anyone think of why
> on a undeployment that not all of the OJB classes are removed from the
> VM?
>
> Thanks!
>
> Here is the stacktrace:
>
> 2004-08-11 13:24:22,923 ERROR [org.jboss.ejb.plugins.LogInterceptor]
> RuntimeException:
> java.lang.ClassCastException
> 	at
> org.apache.ojb.broker.metadata.MetadataManager.buildDefaultKey(Unknown
> Source)
> 	at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown
> Source)
> 	at org.apache.ojb.broker.metadata.MetadataManager.<init>(Unknown
> Source)
> 	at
> org.apache.ojb.broker.metadata.MetadataManager.getInstance(Unknown
> Source)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKe
> y(Unknown Source)
> 	at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersi
> stenceBroker(Unknown Source)
> 	at
> org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(
> Unknown Source)
> 	at
> org.osn.persistence.PersistenceSessionPBImpl.getBroker(PersistenceSessio
> nPBImpl.java:79)
>


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