-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
 Post subject: AbstractMethodError on 2.1.8
PostPosted: Mon Jan 31, 2005 2:41 am 
Newbie

Joined: Thu Aug 12, 2004 5:53 am
Posts: 4
Location: Japan
Hibernate version: 2.1.8

Name and version of the database you are using: Oracle 10g

Hello,

I'm using Hibernate on spring framework 1.0.2. JDK version is 1.4.2_07.

I've been using Hibernate 2.1.7 and working good. But when I migrates to 2.1.8, AbstractMethodError occurs when initializing Hibernate.

When I change hibernate2.jar to ver.2.1.7, this don't happen.

Any suggestion?

Sorry for my poor English. Thank you in advance.

Error log follows:

Code:
2005-01-31 15:17:50,162 ERROR - [ContextLoader.java:108] [Context initialization failed] (main)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in resource [/WEB-INF/applicationContext.xml] of ServletContext: Can't resolve reference to bean 'sessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource [/WEB-INF/webSessionFactory.xml] of ServletContext: Initialization of bean failed; nested exception is java.lang.AbstractMethodError: net.sf.ehcache.hibernate.Provider.start(Ljava/util/Properties;)V
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource [/WEB-INF/webSessionFactory.xml] of ServletContext: Initialization of bean failed; nested exception is java.lang.AbstractMethodError: net.sf.ehcache.hibernate.Provider.start(Ljava/util/Properties;)V
java.lang.AbstractMethodError: net.sf.ehcache.hibernate.Provider.start(Ljava/util/Properties;)V
   at net.sf.hibernate.cfg.Configuration.configureCaches(Configuration.java:1133)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:804)
   at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:467)
   at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:405)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:991)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:288)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:208)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveReference(AbstractAutowireCapableBeanFactory.java:903)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:844)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:785)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:637)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:271)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:208)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:230)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284)
   at org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:131)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:156)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:97)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3276)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:3618)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
   at org.apache.catalina.core.StandardService.start(StandardService.java:497)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
   at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
   at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 5:27 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
yes, i've got the same problem except that i'm not using spring ... (i'm using hibernate directly).

Using ehcache version 0.9 and 1.1 doesn't make a difference .. the exception is always the same.

Problem is in line 1133 of Configuration.java
Code:
        // needed here because caches are built directly below.  This is fixed in H3.
      settings.getCacheProvider().start( properties );


Ehcache doesn't implement the new methods "start" and "stop" in Interface CacheProvider.

I haven't found a newer version of ehcache fixing that problem ... i think i'll patch ehcache and look if it's still working ...

gtx
curio


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 5:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
2 things to remember if some thirdparty library (in this case spring and ehcache) does not work with hibernate after a release:

1. always check if we have updated to a more recent library (we have for ehcache)

2. recompile the library (in this case spring) with the library to ensure it calls the proper newly overloaded method

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 5:44 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
sorry for double-post.

This CacheProvider will fix the problem for ehcache. I've just copied the code from 'net.sf.ehcache.hibernate.Provider' version 1.1 into the new class and added the missing methods.

I hope that's okay for the ehcache-team ;)

For me this is good enough until a new version of ehcache will follow ...

Code:
package <your package>.cache;

import net.sf.ehcache.hibernate.Plugin;
import net.sf.hibernate.cache.Cache;
import net.sf.hibernate.cache.CacheException;
import net.sf.hibernate.cache.CacheProvider;
import net.sf.hibernate.cache.Timestamper;

import java.util.Properties;

/**
* Workaround to make ehcache work with hibernate 2.1.8
*
* @author curio
*/
public class Provider implements CacheProvider {

    //~ Methods ----------------------------------

    /**
     * @see net.sf.hibernate.cache.CacheProvider#buildCache(java.lang.String, java.util.Properties)
     */
    public Cache buildCache(String name, Properties properties) throws CacheException {
        return new Plugin(name);
    }

    /**
     * @see net.sf.hibernate.cache.CacheProvider#nextTimestamp()
     */
    public long nextTimestamp() {
        return Timestamper.next();
    }

    /**
     * Callback to perform any necessary initialization of the underlying cache implementation
     * during SessionFactory construction.
     *
     * @param  properties current configuration settings.
     *
     * @throws CacheException CacheException
     */
    public void start(Properties properties) throws CacheException {
        // do nothing
    }

    /**
     * Callback to perform any necessary cleanup of the underlying cache implementation during
     * SessionFactory.close().
     */
    public void stop() {
        // do nothing
    }
}


It seems that ehcache is still working as it should ... at least i hope, because I'm quite sure, that the new methods weren't added just for fun ;)

@HB-Team
Does the ehcache-team know that the interface has changed? Can we hope for a new, fixed version?

TiA
curio


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 5:47 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
sorry max ...
i've read your answer after my previous post ...

but in the lib-directory of "hibernate 2.1.8" i only found "ehcache-0.9.jar".
I've added this jar to my webapp and it doesn't work either.

In the ehcache website, the latest release is version 1.1 which doesn't work, too.

And ... i don't use spring ...

gtx
curio


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 5:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i have a hard time beliving that hibernate 2 unit tests can run without a working ehcache provider - did you check with the version hibernate 2.1.8 distributes ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 5:54 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
yes, and i've decompiled the 'Provider.class' in ehcache-0.9.jar delivered with version 2.1.8 ...

Code:
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name:   Provider.java

package net.sf.ehcache.hibernate;

import java.util.Properties;
import net.sf.hibernate.cache.*;

// Referenced classes of package net.sf.ehcache.hibernate:
//            Plugin

public class Provider
    implements CacheProvider
{

    public Provider()
    {
    }

    public Cache buildCache(String name, Properties properties)
        throws CacheException
    {
        return new Plugin(name);
    }

    public long nextTimestamp()
    {
        return Timestamper.next();
    }
}


The new methods are missing.

Perhaps something got wrong during the build-process of the new version?

gtx
curio


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 6:00 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
okay ... i'm just to stupid ...

i had "net.sf.ehcache.hibernate.Provider" in my hibernate.cfg.xml ... and not
"net.sf.hibernate.cache.EhCacheProvider" as it's in the reference doc :(

BIG SORRY ... i think i've overread the changelog-entry "* added EhCache provider to Hibernate distribution, use net.sf.hibernate.cache.EhCacheProvider (Emmanuel Bernard)"

It sure works ...

gtx
curio

P.S.: If i'm meeting some of you somewhere ... i'll spend a drink :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 6:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
in 2.1.8 net.sf.hibernate.cache.EHCacheProvider is *inside* hibernate.jar to work around this current limitation in EhCache.

Put hibernate.jar in front of ehcache in your classpath and everything should be fine and dandy.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 8:29 am 
Newbie

Joined: Thu Aug 12, 2004 5:53 am
Posts: 4
Location: Japan
Sorry, I'm a user since ver.2.1.4 and haven't read the changelog carefully.

I changed cache provider to net.sf.hibernate.cache.EhCacheProvider and it worked.

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 8:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ah yes - i forgot about the name change - no need for classpath ordering.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.