4 Replies Latest reply on Aug 7, 2015 5:17 AM by manarh

    object is not an instance of declaring class

    vata2999

      I'm using Seam2.3.Final, Jboss7.1.1Final.

       

      I've created  a Jboss Datasource named PostgresDS.

       

      my persistence.xml

       

       

      <?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_2_0.xsd" 
                   version="2.0">
         <persistence-unit name="omidbizDatabase">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>java:/PostgresDS</jta-data-source>
            <properties>
               <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
               <property name="hibernate.show_sql" value="true"/>
               <!-- These are the default for JBoss EJB3, but not for HEM: -->
      <!--          <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> -->
               <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
               <property name="jboss.entity.manager.factory.jndi.name" value="java:/omidbizEntityManagerFactory"/>
            </properties>
         </persistence-unit>
      </persistence>
      

       

      my components.xml

       

       

      <core:init jndi-pattern="java:/omidbizEntityManagerFactory" debug="true" distributable="false"/>
      

       

      normally, I guess as I  remember in Seam 2.2 this should work but I get this exception :

       

       

      Caused by: java.lang.IllegalArgumentException: Could not invoke method by reflection: Synchronizations.afterTransactionBegin() on: org.hibernate.ejb.EntityManagerFactoryImpl
          at org.jboss.seam.util.Reflections.invoke(Reflections.java:32) [jboss-seam.jar:2.3.1.Final]
          at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam.jar:2.3.1.Final]
          at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76) [jboss-seam.jar:2.3.1.Final]
          at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:2.3.1.Final]
          at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54) [jboss-seam.jar:2.3.1.Final]
          at org.javassist.tmp.java.lang.Object_$$_javassist_seam_1.afterTransactionBegin(Object_$$_javassist_seam_1.java)
          at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:40) [jboss-seam.jar:2.3.1.Final]
          at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:597) [jboss-seam.jar:2.3.1.Final]
          ... 39 more
      Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_38-ea]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_38-ea]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_38-ea]
          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_38-ea]
          at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.3.1.Final]
          ... 46 more