Hibernate “PreInsertEvent.getSource()” NoSuchMethodError

前端 未结 3 685
执念已碎
执念已碎 2020-12-20 00:28

I\'m recieving the following error when trying to do inserts:

java.lang.NoSuchMethodError : org.hibernate.event.PreInsertEvent.getSource()Lorg/hibernate/

3条回答
  •  北海茫月
    2020-12-20 00:43

    The actual problem for me when this error occurred is

    1. Hibernate-core dependency was not in my EAR packaging.

    2. By default it was picking the jboss.4.2.3/.../lib's hibernate3.jar.

    3. Just adding hibernate-core-3.3.1.GA to my dependencies list in EAR packaging.

    4. Already had the overriding of loaders set in jboss-app.xml.

    5. Excluded the hibernate-core from hibernate-entitymanager-3.4.0.GA (don't think this is required as the core supplied will be 3.3.0.SP1 and will be omitted anyhow).

    It worked with some exclusions of some already existing xml-apis, ejb3-persistence, etc. dependecies from the hibernate-core.

    Finally the core dependency looked like this.

        
            org.hibernate
            hibernate-core
            3.3.1.GA
              
                
                    ejb3-persistence
                    org.hibernate
                
                
                    jta
                    javax.transaction
                
                
                    persistence-api
                    javax.persistence
                
                
                    xml-apis
                    xml-apis
                
            
        
    

    Note: I don't think cglib is required is its not relevant to this context.

    Hope this is useful for someone.

提交回复
热议问题