facebook

Defect with Spring+Hibernate

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #286781 Reply

    frankc01a
    Member

    This is a purely point and click setup/generation from ME. I can email project if needed.

    Simple test web application with adding Spring and JPA w/Hibernate
    Setup
    ME: 6.5 GA
    JVM: 1.6.0_06

    Web App
    JRE: 1.6.0_06
    Java EE 5 Libraries
    Spring 2.5
    Hibernate 3.2

    I have one DAO and one Service defined properly in applicationContext.xml

    Using ME Tomcat sandbox, following error:
    Jul 4, 2008 8:04:55 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    Jul 4, 2008 8:04:59 AM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0’ defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
    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:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
    at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:270)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:122)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:78)
    at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
    at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:97)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1324)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
    … 38 more
    Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor
    at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
    at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
    at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
    at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
    at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
    at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
    at org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:91)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:273)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
    … 55 more
    Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.CodeVisitor
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    … 83 more

    Is there a documented solution? I have seen all the references to other people explaining the problem but I’d like a MyEclipse solution.

    #286796 Reply

    Loyal Water
    Member

    I have asked the dev team to look into this. Seems like the asm jar issue. I’ll get back to you with an update asap.

    #286800 Reply

    Brian Fernandes
    Moderator

    Frank,

    At the surface the problem seems to be a version mismatch with the asm library, but we have not seen this reported earlier.

    I added Spring 2.5 + Hibernate 3.2 to a project, generated a few DAOs and had no problems deploying and running this.

    But there are really many variables in Spring + Hibernate project, including the order in which they were added to the project. If you could email the project to [email protected] ATTN Brian, that will help us narrow this down asap.

    Best,

    #286840 Reply

    frankc01a
    Member

    Sent last night

    #286876 Reply

    Brian Fernandes
    Moderator

    Frank,

    Thanks for the project, I had to add a dialect for MySQL to persistence.xml after which I could reproduce your error.

    I suggest editing the Hibernate 3.2 core libraries at. Window > Preferences > MyEclipse > Project Capabilities > Hibernate > Hibernate 3.2. Select Hibernate 3.2 Core Libraries from the combo and remove the cglib-2.1.3.jar file, this should clear up the library mixup.

    Note that this is a global setting and the cglib JAR will be removed from all projects which use the Hibernate 3.2 Core library container. We are working on making these customizable at a project level.

    I’ve filed this particular conflict for further investigation.

    Hope this helps.

    #286878 Reply

    frankc01a
    Member

    Brian,

    Thanks… I don’t know if this is my problem as much as it is with the distribution of Hibernate and Spring that ME is supporting. I’m sure this has (or will) affect many other users
    that work this pretty popular combination.

    Somebody should consider a peace tour to the Hibernate and Spring camps to get these to groups to kiss and make up. You hiring?

    Frank

    #287007 Reply

    PVJ
    Member

    I get a similar error when using Spring3.5 and Hibernate3.2 with JAX-WS. Haven’t found any solutions online. Hope someone has resolved this issue! If so, please post it on the web!!!

    #287009 Reply

    PVJ
    Member

    Oops! Make that Spring2.5 and Hibernate3.2!

    #293782 Reply

    millstone
    Member

    Hi,

    it doesn’t seem to be solved. Run at this error two days ago and solved it now. It was really frustrating over this days!!!

    Used ME 7.0.1 with Spring 2.5.x and Hibernate 3.2.x.

    Ca

    #300780 Reply

    Michael J Caughey
    Participant

    I have just upgrade to MyEclipse 7.5
    My Project is using
    Spring 2.5.4
    Hibernate 3.3.2.GA
    Struts 1.2.9
    I have tried both JDK 1.5.0_17 and JDK 1.6.0_17

    I’m getting the same error, however when I remove the cglib from the Hibernate 3.2 Core libraries it doesn’t fix the problem. I do not see a 3.3 capabilities anywhere. Is 3.3.2 the same as 3.2?

    I also removed the asm libraries from the Hibernate 3.2 core.

    #300781 Reply

    Michael J Caughey
    Participant

    I just noticed that every time the application deploys it keeps putting the cglib-2.1_3.jar back in the WEB-INF/lib directory. Where is this coming from?

    #300794 Reply

    mcaughey,
    ME7.5 currently supports Hibernate 3.2. I would recommend you to use hibernate 3.2 after removing asm libraries.
    In case the error still occurs, please mail your project to [email protected]. Add ATTN: Shalini in the subject and refer to this thread.
    This will help us reproduce this issue internally. Thanks for your help

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Defect with Spring+Hibernate

You must be logged in to post in the forum log in