1 Reply Latest reply on Dec 7, 2007 4:31 PM by jbalunas

    Reflection issues with <transaction:ejb-transactions/> on oc

    jbalunas

      I have been working on this oc4j issue from the reference guide.

      - followed the example from the reference guide chapter for a seam-gen app.
      - if <transaction:ejb-transaction> is in the components.xml app gets the exceptions below. If it is not there everything works fine.
      - I broke it down into a smaller problem and did not do the drools, or the reverse eng. on a db but still had this issue.

      - Similar issue on the forum - but in that the JNDI lookup failed and it was JBoss AS http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071599

      The weird part is that the JNDI reference to the EjbSynchronizations is found it is just not the correct object. Instead of an instance of the EjbSynchronizations class it is instance of com.evermind.server.ejb.StatefulSessionDefaultLocalHomeImpl. Which does not have the methods from the LocalEjbSynchronizations interface.

      I've been comparing the jee5 example because that does not have this issue. One thing that is different between the jee5 and seam gen is the managed-persistence-context and entity-manager-factory as described in the guide.

      I have been looking over the seam config files over and over, and it was time to get a second opinion. I have been searching the oc4j docs, and config. Also the jboss-seam.jar is listed as an ejb-module in app....xml.

      ejb from web.xml

      <ejb-local-ref>
       <ejb-ref-name>oc4j_gen_drools/EjbSynchronizations/local</ejb-ref-name>
       <ejb-ref-type>Session</ejb-ref-type>
       <local-home/>
       <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
       <ejb-link>EjbSynchronizations</ejb-link>
       </ejb-local-ref>
      


      application.xml partial
      <display-name>oc4j_gen_drools</display-name>
      
       <module>
       <web>
       <web-uri>oc4j_gen_drools.war</web-uri>
       <context-root>/oc4j_gen_drools</context-root>
       </web>
       </module>
      
       <module>
       <ejb>oc4j_gen_drools.jar</ejb>
       </module>
      
       <!-- Seam and EL -->
       <module>
       <ejb>jboss-seam.jar</ejb>
       </module>
      


      Components.xml partial
       <core:init debug="true" jndi-pattern="java:comp/env/oc4j_gen_drools/#{ejbName}/local"/>
      
       <core:manager concurrent-request-timeout="500"
       conversation-timeout="120000"
       conversation-id-parameter="cid"/>
      
       <transaction:ejb-transaction />
      
       <persistence:entity-manager-factory auto-create="true"
       name="oc4j_gen_droolsEntityManagerFactory"
       persistence-unit-name="oc4j_gen_drools" />
      
       <persistence:managed-persistence-context name="entityManager"
       auto-create="true"
       entity-manager-factory="#{oc4j_gen_droolsEntityManagerFactory}"/>
      


      This could be an issue with oc4j, but I'm not sure. The next thing I was going to try was a hack to cast the StatefulSessionDefaultLocalHomeImpl to what we expect EjbSynchronizations (obviouslly just temp).

      Thanks,
      Jay

      SEVERE: uncaught exception
      java.lang.IllegalStateException: Could not start transaction
       at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:578)
       at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:314)
       at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:218)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:619)
       at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
       at com.evermind.server.http.HttpRequestHandler.doDispatchRequest(HttpRequestHandler.java:889)
       at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:797)
       at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:607)
       at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:376)
       at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:161)
       at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:142)
       at oracle.oc4j.network.ServerSocketReadHandler$ClientRunnable.run(ServerSocketReadHandler.java:275)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.IllegalArgumentException: Could not invoke method by reflection: Synchronizations.afterTransactionBegin() on: com.evermind.server.ejb.StatefulSessionDefaultLocalHomeImpl
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:41)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
       at org.javassist.tmp.java.lang.Object_$$_javassist_0.afterTransactionBegin(Object_$$_javassist_0.java)
       at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:40)
       at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:573)
       ... 33 more
      Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
       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:21)
       ... 40 more
      Dec 7, 2007 1:39:34 PM org.jboss.seam.jsf.SeamPhaseListener beforePhase