Question

I'm using Hibernate 3.5.0, JBoss AS 6 and Liquibase 1.9.5.

I wanted to activate EhCache Hibernate second-level caching as follows:

The first thing I do, is adding a new dependency to the pom.xml:

 <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>3.5.0-Final</version>
 </dependency>

Now, when I redeploy my app, following Exception is thrown:

Caused by: java.lang.VerifyError: (class: liquibase/database/HibernateDatabase, method: <init> signature: (Ljava/lang/String;)V) Bad type in putfield/putstatic
        at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_18]
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_18]
        at java.lang.Class.getDeclaredMethods(Class.java:1791) [:1.6.0_18]
        at org.jboss.deployment.AnnotatedClassFilter.hasAnnotations(AnnotatedClassFilter.java:186) [:6.0.0.20100429-M3]
        at org.jboss.deployment.AnnotatedClassFilter.accepts(AnnotatedClassFilter.java:114) [:6.0.0.20100429-M3]
        at org.jboss.deployment.AnnotatedClassFilter.visit(AnnotatedClassFilter.java:99) [:6.0.0.20100429-M3]
        at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:407) [jboss-vfs.jar:3.0.0.CR5]
        at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:409) [jboss-vfs.jar:3.0.0.CR5]
        ...

Note that I didn't activate the caching in persistence.xml yet (!)

Does this ring a bell to somebody? Any clues are more than welcome.

Thank you!

Was it helpful?

Solution 2

Looks like a version mismatch.

Actually, EhCache 2.2 seems to fit my configuration better. (Hibernate 3.5.0 & JBoss AS 6 (and Liquibase 1.9.5)):

Add to persistence.xml:

    <property name="hibernate.cache.region.factory_class" value="net.sf.ehcache.hibernate.EhCacheRegionFactory"/>

Add to pom.xml:

<dependency>
    <groupId>net.sf.ehcache</groupId>
    <artifactId>ehcache-core</artifactId>
    <version>2.2.0</version>
</dependency>

(This Maven dependency does not explicitely depend on "Hibernate", which keeps the dependency hierachy a bit cleaner.)

OTHER TIPS

Is there any other "Caused by" messages later on?

I could be that liquibase is built against an earlier version of hibernate than you are running and the hibernate API has changed. Did you just add the ehcache dependency? Or did hibernate get upgraded as well?

The artifact hibernate-ehcache doesn't add any particular Hibernate artifact so I'm not sure it's really the root cause of the problem. However, maybe you changed the classpath order (by declaring it before liquidbase) and you revealed the problem. You can maybe try to declare it after (in the pom.xml).

You could also try to run the JVM with -Xverify:all to see if you get a more useful message.

Or, recompile liquibase against Hibernate 3.5.x.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top