ehcache 2.10.3 on WildFly with hibernate-jpa 2.1

885 views
Skip to first unread message

Mathias Haimerl

unread,
Aug 2, 2016, 8:31:52 AM8/2/16
to ehcache-users
Hi there,

I am trying around for some hours now and I don't get where I'm stuck. I guess there is some piece of configuration missing that I need to provide.

Short description:
  • I am using WildFly 8.2.0 to deploy my Application. I wanted to add ehcache as caching solution.
  • I followed some guides on the Internet, but upon deployment, i get the following error:
"{\"JBAS014671: Failed services\" => {\"jboss.persistenceunit.\\\"Dwabba-1.0.war#dwaPU\\\"\" => \"org.jboss.msc.service.StartException in service jboss.persistenceunit.\\\"Dwabba-1.0.war#dwaPU\\\": java.lang.AbstractMethodError: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory.start(Lorg/hibernate/cfg/Settings;Ljava/util/Properties;)V
    Caused by: java.lang.AbstractMethodError: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory.start(Lorg/hibernate/cfg/Settings;Ljava/util/Properties;)V\"}}"

My Persistence Unit is configured and active, but it seems there is some kind of configuration provided for the regionfactory that java tries to instantiate from an abstract class.
Does anyone know about this problem? Can anyone help me?

Data:
  1. Software versions (All from Maven)
    1. ehcache-2.10.3-SNAPSHOT
    2. hibernate-ehcache-5.2.1.Final
    3. hibernate-core-5.2.1.Final
    4. hibernate-jpa-2.1-api-1.0.0.Final
  2. Configuration (persistence.xml):
    1. <?xml version="1.0" encoding="UTF-8"?>
        <persistence-unit name="dwaPU" transaction-type="JTA">
          <provider>org.hibernate.ejb.HibernatePersistence</provider>
          <jta-data-source>java:/jboss/datasources/DWABBA_DS</jta-data-source>
          <exclude-unlisted-classes>false</exclude-unlisted-classes>
          <properties>
            <property name="hibernate.show_sql" value="false" />
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.connection.release_mode" value="after_transaction"/>
            <property name="hibernate.cache.use_second_level_cache" value="true"/>
            <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory"/>
            <property name="hibernate.cache.use_query_cache" value="true"/>
          </properties>
        </persistence-unit>
      </persistence>
  3. Additional information:
    1. Deployment done with NetBeans 8.0.2 and by WildFly web interface.
    2. PU runs on a local MySQL 5.7.13 server.
Thank you for your help in advance. Hope I did not forget any information.
_
Mathias

Fabien Sanglier

unread,
Aug 2, 2016, 3:48:42 PM8/2/16
to ehcach...@googlegroups.com
based on the error, I think you possibly have an older hibernate version (4.x) loaded somewhere in your classpath...and wilfly is using this older hibernate version to call the old signature for SingletonEhCacheRegionFactory.start...resulting in the AbstractMethodError you see (because you loaded a newer version of hibernate-ehcache.jar with a different start() signature)

in hibernate-ehcache 5.x, the start method signature is:
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException {

in hibernate-ehcache 4.x, the start signature is:
public void start(org.hibernate.cfg.Settings settings, Properties properties) throws CacheException {

And actually, i just downloaded wildflu 8.2 just to check... and indeed wildfly 8.2 comes with a hibernate-core-4.3.7.Final hibernate module...which explains my above assumption.

The easier for you to make it work would be to remove the hibernate reference in your project (because wildfly provides them already), and use the hibernate-ehcache-4.3.7 dependency instead...

If you want to use the latest hibernate instead, then i'm not sure how you force wildfly to use it instead of the global one...with some research I'm sure you can find that answer.

Fabien

--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/9f6381d3-e6f6-4899-bb8e-9c0e925b8537%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Fabien Sanglier
fabiens...@gmail.com

Mathias Haimerl

unread,
Aug 4, 2016, 7:43:03 AM8/4/16
to ehcache-users
Thank you very much!

I would never have guessed that the method signatures have changed since I am only in hibernate since Version 5 ;-)

Changed dependencied for hibernate-core and hibernate-ehcache to 4.3.7 and voilá, works perfectly!

Reply all
Reply to author
Forward
0 new messages