java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider Tengo solucionada esta excepción, ¿Qué estaba ocurriendo? Hay una librería que está en la capeta lib de Jboss y en la carpeta lib de nuestro\_proyecto.war Cuando va a buscar la case para hacer un cast entonces se encuentra con el problema de no saber cual es la clase válida y no coge ninguna de las dos. La solución es coger la carpeta de nuestro proyecto y sustituirla por la que está en la librería de Jboss. Por cierto he añadido  también el <provider> cómo me dijiste, este es ahora mi persistence.xml:     <\!- JBoss + MySQL  ->     <persistence-unit name="default" transaction-type="JTA">     <provider>org.hibernate.ejb.HibernatePersistence</provider>     <jta-data-source>java:jdbc/SML/MyDataBase\_DataSource</jta-data-source>     <class>org.openxava.session.GalleryImage</class>     <class>com.alico.wpm.dao.model.Area</class> <properties>      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> </properties>     </persistence-unit> Pero sigo con el mismo problema que ya me pasaba con el jboss 4.2.3, lo bueno es que con las dos versiones de Jboss he llegado al mismo punto: 12:54:42,906 WARN   Hibernate connection does not work, therefore JPA managed classes obtained directly from classpath javax.persistence.PersistenceException:  Unable to build EntityManagerFactory

openxava | henryedsl | 7 years ago
  1. 0

    OX 4m1 + Liferay

    openxava | 7 years ago | henryedsl
    java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider Tengo solucionada esta excepción, ¿Qué estaba ocurriendo? Hay una librería que está en la capeta lib de Jboss y en la carpeta lib de nuestro\_proyecto.war Cuando va a buscar la case para hacer un cast entonces se encuentra con el problema de no saber cual es la clase válida y no coge ninguna de las dos. La solución es coger la carpeta de nuestro proyecto y sustituirla por la que está en la librería de Jboss. Por cierto he añadido  también el <provider> cómo me dijiste, este es ahora mi persistence.xml:     <\!- JBoss + MySQL  ->     <persistence-unit name="default" transaction-type="JTA">     <provider>org.hibernate.ejb.HibernatePersistence</provider>     <jta-data-source>java:jdbc/SML/MyDataBase\_DataSource</jta-data-source>     <class>org.openxava.session.GalleryImage</class>     <class>com.alico.wpm.dao.model.Area</class> <properties>      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> </properties>     </persistence-unit> Pero sigo con el mismo problema que ya me pasaba con el jboss 4.2.3, lo bueno es que con las dos versiones de Jboss he llegado al mismo punto: 12:54:42,906 WARN   Hibernate connection does not work, therefore JPA managed classes obtained directly from classpath javax.persistence.PersistenceException:  Unable to build EntityManagerFactory
  2. 0

    EclipseLink - Users - inactiveUnitOfWork with OptimisticLockException

    nabble.com | 11 months ago
    java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.parsing.DotNode cannot be cast to org.eclipse.persistence.internal.jpa.parsing.VariableNode   at org.eclipse.persistence.internal.jpa.parsing.FetchJoinNode.validate(FetchJoinNode.java:73)   at org.eclipse.persistence.internal.jpa.parsing.FromNode.validate(FromNode.java:69)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:199)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:183)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:173)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:110)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:216)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:187)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:139)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:123)   at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1374) Is there a workaround for this? Thanks,  Constantino ________________________________ From: Cronemberger, Constantino Sent: 01 December 2010 16:51 To: Subject: Re: [eclipselink-users] inactiveUnitOfWork with OptimisticLockException Hi, I am using JPA. When I throw a runtime exception manually I don't see this problem. I am using Spring to control the transaction, so it is doing the commit. Here is my persistence.xml: <?xml version="1.0" encoding="UTF-8" ?> <persistence version="2.0" xmlns=" " xmlns:xsi=" "            xsi:schemaLocation="                                   ">   <persistence-unit name="test" transaction-type="JTA">   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>       <!-- For some reason EclipseLink does not recognize this datassource.            It was necessary to add a property with name            "javax.persistence.jtaDataSource" at the end of this file.       <jta-data-source>java:comp/env/jdbc/testDs</jta-data-source>          -->       <class>com.test.TestClassA</class>       <class>com.test.TestClassB</class>       <validation-mode>CALLBACK</validation-mode>       <properties>           <property name="eclipselink.target-server" value="Weblogic"/>           <property name="eclipselink.weaving" value="static"/>           <property name="eclipselink.weaving.lazy" value="true"/>           <property name="eclipselink.jdbc.batch-writing" value="JDBC" />           <property name="eclipselink.persistence-context.flush-mode" value="COMMIT" />           <property name="eclipselink.cache.size.default" value="1000" />           <property name="eclipselink.cache.coordination.protocol" value="rmi" />           <property name="javax.persistence.jtaDataSource"                     value="java:comp/env/jdbc/testDs"/>           <property name="javax.persistence.query.timeout" value="120"/>       </properties>   </persistence-unit> </persistence> The two stack traces I get are: from weblogic: ####<01-Dec-2010 16:44:33 o'clock BRST> <Warning> <JTA> <SPMADLT0374> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1291229073404> <BEA-110401> <Ignoring error in afterCompletion. Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16<mailto:Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16>, Exception=Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.] Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.]
  3. 0

    EclipseLink - Users - inactiveUnitOfWork with OptimisticLockException

    nabble.com | 11 months ago
    java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.parsing.DotNode cannot be cast to org.eclipse.persistence.internal.jpa.parsing.VariableNode   at org.eclipse.persistence.internal.jpa.parsing.FetchJoinNode.validate(FetchJoinNode.java:73)   at org.eclipse.persistence.internal.jpa.parsing.FromNode.validate(FromNode.java:69)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:199)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:183)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:173)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:110)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:216)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:187)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:139)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:123)   at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1374) > > Is there a workaround for this? > > Thanks,  Constantino > > ________________________________ > From: Cronemberger, Constantino > Sent: 01 December 2010 16:51 > To: > Subject: Re: [eclipselink-users] inactiveUnitOfWork with OptimisticLockException > > Hi, > > I am using JPA. > > When I throw a runtime exception manually I don't see this problem. > > I am using Spring to control the transaction, so it is doing the commit. > > Here is my persistence.xml: > > <?xml version="1.0" encoding="UTF-8" ?> > <persistence version="2.0" xmlns=" " xmlns:xsi=" "            xsi:schemaLocation=" >                                   ">   <persistence-unit name="test" transaction-type="JTA">   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>       <!-- For some reason EclipseLink does not recognize this datassource.            It was necessary to add a property with name            "javax.persistence.jtaDataSource" at the end of this file.       <jta-data-source>java:comp/env/jdbc/testDs</jta-data-source>          -->       <class>com.test.TestClassA</class>       <class>com.test.TestClassB</class>       <validation-mode>CALLBACK</validation-mode>       <properties>           <property name="eclipselink.target-server" value="Weblogic"/>           <property name="eclipselink.weaving" value="static"/>           <property name="eclipselink.weaving.lazy" value="true"/>           <property name="eclipselink.jdbc.batch-writing" value="JDBC" />           <property name="eclipselink.persistence-context.flush-mode" value="COMMIT" />           <property name="eclipselink.cache.size.default" value="1000" />           <property name="eclipselink.cache.coordination.protocol" value="rmi" />           <property name="javax.persistence.jtaDataSource"                     value="java:comp/env/jdbc/testDs"/>           <property name="javax.persistence.query.timeout" value="120"/>       </properties>   </persistence-unit> > </persistence> > The two stack traces I get are: > > from weblogic: > > ####<01-Dec-2010 16:44:33 o'clock BRST> <Warning> <JTA> <SPMADLT0374> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1291229073404> <BEA-110401> <Ignoring error in afterCompletion. Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16<mailto:Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16>, Exception=Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException > Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException > Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.] > Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException > Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException > Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    EclipseLink - Users - inactiveUnitOfWork with OptimisticLockException

    nabble.com | 11 months ago
    java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.parsing.DotNode cannot be cast to org.eclipse.persistence.internal.jpa.parsing.VariableNode   at org.eclipse.persistence.internal.jpa.parsing.FetchJoinNode.validate(FetchJoinNode.java:73)   at org.eclipse.persistence.internal.jpa.parsing.FromNode.validate(FromNode.java:69)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:199)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:183)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:173)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:110)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:216)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:187)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:139)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:123)   at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1374) > > Is there a workaround for this? > > Thanks,  Constantino > > ________________________________ > From: Cronemberger, Constantino > Sent: 01 December 2010 16:51 > To: > Subject: Re: [eclipselink-users] inactiveUnitOfWork with OptimisticLockException > > Hi, > > I am using JPA. > > When I throw a runtime exception manually I don't see this problem. > > I am using Spring to control the transaction, so it is doing the commit. > > Here is my persistence.xml: > > <?xml version="1.0" encoding="UTF-8" ?> > <persistence version="2.0" xmlns=" " xmlns:xsi=" "            xsi:schemaLocation=" >                                   ">   <persistence-unit name="test" transaction-type="JTA">   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>       <!-- For some reason EclipseLink does not recognize this datassource.            It was necessary to add a property with name            "javax.persistence.jtaDataSource" at the end of this file.       <jta-data-source>java:comp/env/jdbc/testDs</jta-data-source>          -->       <class>com.test.TestClassA</class>       <class>com.test.TestClassB</class>       <validation-mode>CALLBACK</validation-mode>       <properties>           <property name="eclipselink.target-server" value="Weblogic"/>           <property name="eclipselink.weaving" value="static"/>           <property name="eclipselink.weaving.lazy" value="true"/>           <property name="eclipselink.jdbc.batch-writing" value="JDBC" />           <property name="eclipselink.persistence-context.flush-mode" value="COMMIT" />           <property name="eclipselink.cache.size.default" value="1000" />           <property name="eclipselink.cache.coordination.protocol" value="rmi" />           <property name="javax.persistence.jtaDataSource"                     value="java:comp/env/jdbc/testDs"/>           <property name="javax.persistence.query.timeout" value="120"/>       </properties>   </persistence-unit> > </persistence> > The two stack traces I get are: > > from weblogic: > > ####<01-Dec-2010 16:44:33 o'clock BRST> <Warning> <JTA> <SPMADLT0374> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1291229073404> <BEA-110401> <Ignoring error in afterCompletion. Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16<mailto:Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16>, Exception=Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException > Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException > Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.] > Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException > Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException > Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.]
  6. 0

    EclipseLink - Users - inactiveUnitOfWork with OptimisticLockException

    nabble.com | 11 months ago
    java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.parsing.DotNode cannot be cast to org.eclipse.persistence.internal.jpa.parsing.VariableNode   at org.eclipse.persistence.internal.jpa.parsing.FetchJoinNode.validate(FetchJoinNode.java:73)   at org.eclipse.persistence.internal.jpa.parsing.FromNode.validate(FromNode.java:69)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:199)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:183)   at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:173)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:110)   at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:216)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:187)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:139)   at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:123)   at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1374) >> >> Is there a workaround for this? >> >> Thanks,  Constantino >> >> ________________________________ >> From: Cronemberger, Constantino >> Sent: 01 December 2010 16:51 >> To: >> Subject: Re: [eclipselink-users] inactiveUnitOfWork with OptimisticLockException >> >> Hi, >> >> I am using JPA. >> >> When I throw a runtime exception manually I don't see this problem. >> >> I am using Spring to control the transaction, so it is doing the commit. >> >> Here is my persistence.xml: >> >> <?xml version="1.0" encoding="UTF-8" ?> >> <persistence version="2.0" xmlns=" " xmlns:xsi=" "            xsi:schemaLocation=" >>                                   ">   <persistence-unit name="test" transaction-type="JTA">   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>       <!-- For some reason EclipseLink does not recognize this datassource.            It was necessary to add a property with name            "javax.persistence.jtaDataSource" at the end of this file.       <jta-data-source>java:comp/env/jdbc/testDs</jta-data-source>          -->       <class>com.test.TestClassA</class>       <class>com.test.TestClassB</class>       <validation-mode>CALLBACK</validation-mode>       <properties>           <property name="eclipselink.target-server" value="Weblogic"/>           <property name="eclipselink.weaving" value="static"/>           <property name="eclipselink.weaving.lazy" value="true"/>           <property name="eclipselink.jdbc.batch-writing" value="JDBC" />           <property name="eclipselink.persistence-context.flush-mode" value="COMMIT" />           <property name="eclipselink.cache.size.default" value="1000" />           <property name="eclipselink.cache.coordination.protocol" value="rmi" />           <property name="javax.persistence.jtaDataSource"                     value="java:comp/env/jdbc/testDs"/>           <property name="javax.persistence.query.timeout" value="120"/>       </properties>   </persistence-unit> >> </persistence> >> The two stack traces I get are: >> >> from weblogic: >> >> ####<01-Dec-2010 16:44:33 o'clock BRST> <Warning> <JTA> <SPMADLT0374> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1291229073404> <BEA-110401> <Ignoring error in afterCompletion. Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16<mailto:Object=org.eclipse.persistence.transaction.JTASynchronizationListener@99eb16>, Exception=Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException >> Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException >> Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.] >> Exception [EclipseLink-23011] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.TransactionException >> Exception Description: Error trying to format exception message: UnitOfWork [{0}] was rendered inactive before associated externally managed transaction was complete.  The arguments are: [Exception [EclipseLink-4022] (Eclipse Persistence Services - 2.2.0.v20101117-r8503): org.eclipse.persistence.exceptions.DatabaseException >> Exception Description: Accessor or its connection has been set to null.  This can occur if the ClientSession or UnitOfWork was released in a seperate thread, for instance if a Timeout occurred.]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider Tengo solucionada esta excepción, ¿Qué estaba ocurriendo? Hay una librería que está en la capeta lib de Jboss y en la carpeta lib de nuestro\_proyecto.war Cuando va a buscar la case para hacer un cast entonces se encuentra con el problema de no saber cual es la clase válida y no coge ninguna de las dos. La solución es coger la carpeta de nuestro proyecto y sustituirla por la que está en la librería de Jboss. Por cierto he añadido  también el <provider> cómo me dijiste, este es ahora mi persistence.xml:     <\!- JBoss + MySQL  ->     <persistence-unit name="default" transaction-type="JTA">     <provider>org.hibernate.ejb.HibernatePersistence</provider>     <jta-data-source>java:jdbc/SML/MyDataBase\_DataSource</jta-data-source>     <class>org.openxava.session.GalleryImage</class>     <class>com.alico.wpm.dao.model.Area</class> <properties>      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> </properties>     </persistence-unit> Pero sigo con el mismo problema que ya me pasaba con el jboss 4.2.3, lo bueno es que con las dos versiones de Jboss he llegado al mismo punto: 12:54:42,906 WARN   Hibernate connection does not work, therefore JPA managed classes obtained directly from classpath javax.persistence.PersistenceException:  Unable to build EntityManagerFactory

      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory()
    2. Hibernate EJB
      HibernatePersistence.createEntityManagerFactory
      1. org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
      2. org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
      2 frames
    3. JavaEE 7
      Persistence.createEntityManagerFactory
      1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
      1 frame
    4. org.openxava.jpa
      XPersistence.createManager
      1. org.openxava.jpa.XPersistence.getEntityManagerFactory(XPersistence.java:179)
      2. org.openxava.jpa.XPersistence.createManager(XPersistence.java:107)
      2 frames
    5. org.openxava.annotations
      AnnotatedClassParser.parse
      1. org.openxava.annotations.parse.AnnotatedClassParser.obtainManagedClassNamesUsingHibernate(AnnotatedClassParser.java:2246)
      2. org.openxava.annotations.parse.AnnotatedClassParser.getManagedClassNames(AnnotatedClassParser.java:2162)
      3. org.openxava.annotations.parse.AnnotatedClassParser.getClassNameFor(AnnotatedClassParser.java:2124)
      4. org.openxava.annotations.parse.AnnotatedClassParser.parse(AnnotatedClassParser.java:56)
      4 frames
    6. Java RT
      NativeMethodAccessorImpl.invoke0
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      1 frame