4 Replies Latest reply on Nov 3, 2008 2:17 AM by Jan Malaki

    Calling a EJB method from another component

    Jan Malaki Newbie

      How do you call an EJB method from another component without running into this exception:


      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:585)

        • 1. Re: Calling a EJB method from another component
          Pawel Wrzeszcz Novice

          Please post whole stack trace and the source code.


          -Pawel

          • 2. Re: Calling a EJB method from another component
            Jan Malaki Newbie
            Thanks Pawel. Sorry for late response. I was still trying to solve it myself..but came to a dead-end. Here's the lot:

            //testSeam.xhtml

                 <f:view>
                     <h:form id="testForm">
                     <h:commandButton id="testbutt" value="Test" action="#{testComponent.testMethod}" reRender="" />
                  </h:form>
                 </f:view>


            //testAction.java
                 @Stateful
                 @Name("testComponent")
                 @Scope(ScopeType.SESSION)

                 public class testAction implements testInterface
                 {
                  //@In(create=true)  Can this work? Currently it doesn't
                  // private test_Component test_Component;
                  
                   public void testMethod() {
                      new test_Component().testrunMethod();  // a no-no? component shouldn't use new instantiation but @In doesn't work also
                        }
                   @Remove
                   public void destroy() {}

                 }

            //testInterface.java
                 @Local
                 public interface testInterface
                 {  
                    public void destroy();
                    public void testMethod();
                    }


            @Stateful
            @Name("test_Component")
            @Scope(ScopeType.SESSION)

            public class test_Component implements TestComponent2{
            private List results;
            @PersistenceContext
            private EntityManager em;
            @Remove
            public void destroy() {}
                 
            public boolean testrunMethod(){
              //        results = em.createQuery("select h from Purchases h where h.prodid like 'S%'")
              //                .getResultList();

              System.out.println("This works but sans code above");
            //Even the ff doesn't work. Seems to have trouble with the EntityManager em as in above.
            // Session sess= em.getDelegate();
              return true;
            }

            }  

            //TestComponent2.java
            @Local
            public interface TestComponent2
            {  
               public void destroy();
               public boolean testrunMethod();
            }  
              







            Exception during request processing:
            Caused by javax.servlet.ServletException with message: "#{testComponent.testMethod}: javax.ejb.EJBTransactionRolledbackException"

            javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)

            Caused by javax.faces.FacesException with message: "#{testComponent.testMethod}: javax.ejb.EJBTransactionRolledbackException"
            com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
            javax.faces.component.UICommand.broadcast(UICommand.java:383)
            org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
            org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
            org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
            org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
            com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)Caused by javax.faces.el.EvaluationException with message: "javax.ejb.EJBTransactionRolledbackException"
            javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
            com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
            javax.faces.component.UICommand.broadcast(UICommand.java:383)
            org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
            org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
            org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
            org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
            com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)Caused by javax.ejb.EJBTransactionRolledbackException with message: ""
            org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:91)
            org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
            org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:86)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:166)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:261)
            org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
            $Proxy74.testMethod(Unknown Source)
            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:585)
            org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
            org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
            org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
            org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
            org.javassist.tmp.java.lang.Object_$$_javassist_3.testMethod(Object_$$_javassist_3.java)
            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:585)
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
            org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
            org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
            org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
            com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
            javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
            com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
            javax.faces.component.UICommand.broadcast(UICommand.java:383)
            org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
            org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
            org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
            org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
            com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)Caused by java.lang.NullPointerException with message: ""
            org.jboss.seam.example.booking.test_Component.testrunMethod(test_Component.java:31)
            org.jboss.seam.example.booking.testAction.testMethod(testAction.java:18)
            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:585)
            org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
            org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
            org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
            org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
            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:585)
            org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
            org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
            org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:86)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:166)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:261)
            org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
            $Proxy74.testMethod(Unknown Source)
            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:585)
            org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
            org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
            org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
            org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
            org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
            org.javassist.tmp.java.lang.Object_$$_javassist_3.testMethod(Object_$$_javassist_3.java)
            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:585)
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
            org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
            org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
            org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
            org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
            com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
            javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
            com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
            javax.faces.component.UICommand.broadcast(UICommand.java:383)
            org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
            org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
            org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
            org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
            com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)
            • 3. Re: Calling a EJB method from another component
              Ilya Newbie

              it would be easier to help if you posted non-working code with relevant exception


              the stack trace you posted has a root causee of NPE, but the code you've given apparently doesn't have this NPE

              • 4. Re: Calling a EJB method from another component
                Jan Malaki Newbie
                Thanks Ilya for noticing. The non-working code, are commented out
                in this file. These codes use the EntityManager. Please notice that without them only System.out.println("") line works fine.


                //test_Component.java
                @Stateful
                @Name("test_Component")
                @Scope(ScopeType.SESSION)

                public class test_Component implements TestComponent2{
                private List results;
                @PersistenceContext
                private EntityManager em;
                @Remove
                public void destroy() {}
                  public boolean testrunMethod(){
                  // results = em.createQuery("select h from Purchases h where h.prodid like 'S%'")
                  // .getResultList();
                    System.out.println("This works but sans code above");
                //Even the ff doesn't work. Seems to have trouble with the EntityManager em as in above.
                // Session sess= em.getDelegate();
                  return true;
                }

                }


                My assumption is that those offending codes raise the following:

                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:585)