-->
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.  [ 4 posts ] 
Author Message
 Post subject: Exception thrown trying to create entity manager...
PostPosted: Tue Apr 17, 2007 6:01 pm 
Newbie

Joined: Tue Apr 17, 2007 5:50 pm
Posts: 5
I'm getting an exception when trying to create an entity manager factory:

java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/reflection/ReflectionManager;
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:156)

Does anyone have any clues?

This is the code it throws the exception on:

Code:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("scrumster");


Thanks for any help.

Hibernate version: 3.2

Mapping documents:

My app-beans.xml doc:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
    xmlns="urn:jboss:bean-deployer:2.0">

    <!-- Enable a JCA datasource available through JNDI -->
    <bean name="caveatEmptorDatasourceFactory"
          class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
        <property name="jndiName">java:/scrumsterDS</property>

        <!-- MySQL DB -->              
      <property name="hibernate.connection.driver_class">
         com.mysql.jdbc.Driver
      </property>
      <property name="hibernate.connection.url">
         jdbc:mysql://localhost:3306/scrumster
      </property>
      <property name="hibernate.connection.username">
         scrumster
      </property>
      <property name="hibernate.connection.password">
         scrumst3r
      </property>

        <!-- Use the C3P0 connection pool provider -->
      <property name="hibernate.c3p0.min_size">5</property>
      <property name="hibernate.c3p0.max_size">20</property>
      <property name="hibernate.c3p0.timeout">300</property>
      <property name="hibernate.c3p0.max_statements">50</property>
      <property name="hibernate.c3p0.idle_test_period">3000</property>

        <property name="transactionManager"><inject bean="TransactionManager"/></property>
        <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property>
        <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property>
    </bean>

    <bean name="scrumsterDS" class="java.lang.Object">
        <constructor factoryMethod="getDatasource">
            <factory bean="scrumsterDatasourceFactory"/>
        </constructor>
    </bean>

</deployment>


My persistence.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
     
   <persistence-unit name="scrumster" transaction-type="JTA">
   
      <!-- A managed datasource provided by the application server, in this
            case the microcontainer, see scrumster-beans.xml definition.
        -->
      <jta-data-source>java:/scrumsterDS</jta-data-source>
      
      <!-- The path to scan for entity classes, different than the root of this file
      <jar-file>file:/home/work/local/hibernate/jpwh/caveatemptor.jpa/build/classes</jar-file>
      -->
      
      <properties>
      
         <!-- Only scan and detect annotated entities -->
         <property name="hibernate.archive.autodetection" value="class"/>
         
         <!-- Only scan and detect hbm.xml files
         <property name="hibernate.archive.autodetection" value="hbm"/>
         -->
            
         <!-- Show and print nice SQL on stdout -->
         <property name="hibernate.show_sql" value="true" />
         <property name="hibernate.format_sql" value="true" />
         <property name="hibernate.use_sql_comments" value="true" />
                        
         <!-- We have a JTA data source...
         <property name="hibernate.connection.driver_class"
                   value="org.hsqldb.jdbcDriver"/>
         <property name="hibernate.connection.url"
                   value="jdbc:hsqldb:hsql://localhost"/>
         <property name="hibernate.connection.username"
                   value="sa"/>
         
         <property name="hibernate.c3p0.min_size"
                   value="5"/>
         <property name="hibernate.c3p0.max_size"
                   value="20"/>
         <property name="hibernate.c3p0.timeout"
                   value="300"/>
         <property name="hibernate.c3p0.max_statements"
                   value="50"/>
         <property name="hibernate.c3p0.idle_test_period"
                   value="3000"/>
         -->
           
         <!-- Dialect -->
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
         
         <!-- Put the EntityManagerFactory into JNDI so we can use it manually in tests -->
         <property name="jboss.entity.manager.factory.jndi.name"
                   value="java:/EntityManagerFactories/scrumsterEMF"/>
         
         <!-- Create the database schema when this test.persistence unit is deployed, drop
              it (clean the database) when it is undeployed
         -->
         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
         <!--
            <property name="hibernate.hbm2ddl.auto" value="create"/>
         -->
      </properties>
   </persistence-unit>
</persistence>


Full stack trace of any exception that occurs:

java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/reflection/ReflectionManager;
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:156)
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
com.scrumster.struts.action.TestAction.execute(TestAction.java:14)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:399)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:262)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:224)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:161)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInterceptor.java:115)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)

Name and version of the database you are using: MySQL 5


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 18, 2007 2:06 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
there is a version mismatch in your classpath
You need to be sure to use the right HEM version with the right HAN version

_________________
Emmanuel


Top
 Profile  
 
 Post subject: thanx
PostPosted: Tue Apr 22, 2008 4:14 am 
Newbie

Joined: Tue Apr 22, 2008 4:09 am
Posts: 2
i just want to thank you for this reply.
it'works for me.
i had two differents versions of HEM and HAN, and i had several times the same HEM libraries in my classpath

bye


Top
 Profile  
 
 Post subject: complements
PostPosted: Wed Apr 23, 2008 5:50 am 
Newbie

Joined: Tue Apr 22, 2008 4:09 am
Posts: 2
in fact, for my problem, i solved it with your post and this information:
http://jira.jboss.com/jira/browse/JBSEAM-2371

i tested a project with Maven and testNG.
i also had to modify the classpath of TestNG like it is explained in this report.
bye


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.