openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: org.apache.openjpa.persistence.ArgumentException
Date Thu, 01 Nov 2007 15:42:51 GMT
Hi Gul,

On Nov 1, 2007, at 3:42 AM, Gul Onural wrote:

>
> Hi,
>
> I enhanced my JPA class using PCEnhancer, but I am still getting
> org.apache.openjpa.persistence.ArgumentException, when
> openjpa attempts to cast instance of my JPA class.
>
> [11/1/07 5:26:44:423 GMT-05:00] 00000020 SystemErr     R <0.0.0  
> nonfatal
> user error> org.apache.openjpa.persistence.ArgumentException:  
> Attempt to
> cast instance "com.test.Employee" to PersistenceCapable failed.   
> Ensure
> that it has been enhanced.
>
> What would cause this to happen ?

This does sound like a class loader problem. You might be getting an  
unenhanced class instead of your enhanced class. Are you enhancing in  
place, and have no other copy of the class somewhere (in your class  
path)?
>
> What type of debugging can tell me more about why this is happening ?

Can you put a statement into your code like (if ! 
presumablyEnhancedInstance instanceof PersistenceCapable) {throw  
RuntimeException("PresumablyEnhancedClass not enhanced");}
>
> Would it be because of incorrect packaging of JPA files ?

That's my guess.

>
> I am using JPA files from an Mbean (management bean) in IBM Websphere.
> My Mbean is packaged a war file. Where does openjpa look for
> JPA classes and persistence.xml file in this case ?

I don't know this environment well enough to comment.

Craig
>
> Gul
>
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message