1 Reply Latest reply on Sep 6, 2007 4:01 AM by alexandre russel

    class cast exception using managed persistence context

    alexandre russel Newbie

      I am using jboss-seam-1.2.1.GA in jboss 4.0.5 .
      I followed the doc 8.3.1 on using seam managed persistence and get the following error
      when seam try to inject the entity manager:
      Caused by: java.lang.ClassCastException: org.jboss.ejb3.entity.InjectedEntityManagerFactory
      at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:160)
      at org.jboss.seam.core.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:77)
      at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:105)
      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:585)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
      at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
      at org.jboss.seam.Component.unwrap(Component.java:1860)
      at org.jboss.seam.Component.getInstance(Component.java:1657)

      I am using a loader in jboss-app.xml and I can see the factory in jndi:
      +- EntityManagerFactory (class: org.jnp.interfaces.NamingContext)
      | +- foo (class: org.jboss.ejb3.entity.InjectedEntityManagerFactory)

      any help welcome,
      thanks