views:

1484

answers:

4

Im getting a weird error when running my spring2.5.6,jpa(hibernate3.4) webapp in weblogic 10.3


[ERROR] Javassist Enhancement failed: com.xxx.domain.model.Scheme
java.lang.NoSuchMethodError: pcGetManagedFieldCount
        at com.xxx.domain.model.Fund.<clinit>(Fund.java)
        at sun.misc.Unsafe.ensureClassInitialized(Native Method)
        at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAc
cessorFactory.java:25)


The com.xxx.domain.model.Scheme class is a mapped subclass entity of the abstract fund entity on a single_table inheritance hierarchy, and I'm getting this error for all entities on the hierarchy. I'm using both annotated classes and xml metadata to define the mappings for my persistence classes.

I only get this error when the app is deployed to weblogic, so everything runs fine using junit. I have tried upgrading to the latest version on javaassit.jar.

Problem Looks to me like an issue with classloading order, but I cant figure it out.

PS. As suggested by bea I have added the following to the weblogic.xml

<container-descriptor>
  <prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

Anyone got any ideas, other config tips, or directions I should take my investigation?

A: 

I'm sorry, I only have WebLogic 10.0 on my machine, and it doesn't have any javassist JARs in the distro. Looks like javassist was only added in 10.3 for AOP byte code generation.

It might be worth a try to remove the javassist JAR from your WebLogic deployment and use the version that it supports. Take the "prefer-web-inf-classes" tag out of your web.xml and see if it can work with the version that WebLogic prefers.

duffymo
A: 

Can you post the code for the entity class and, if you're not using annotations, the segment of your hbm mapping file?

Your classpath hunch may be right on. In your weblogic-application.xml, try this

<prefer-application-packages>
  <package-name>antlr.*</package-name>
  <package-name>org.antlr.*</package-name>
</prefer-application-packages>

If you have any more log output, please post that as well.

A: 

I just lost a couple of days on this myself. The problem for me was that I 2 separate data-services modules in my app. I'm thinking 10.3 has some trouble with that. I'm not sure of the solution, but a work around for me was to combine both of my data-services modules into just one. BEA seems to be aware of this issue. Hopefully the URL below will help. Reference CR370788. http://edocs.bea.com/wls/docs103/issues/known_resolved.html

+1  A: 

I had the same problem.

My entities extended a class (@MappedSuperClass) which lived inside a jar dependency. I had to move that class from the jar into my project. Only then it would work and deployed fine.

Also another way to solve this is to specify your entities explicitly in the persistence.xml

JavaRocky