10 Replies Latest reply on Jul 30, 2009 8:35 AM by Steffen Mueller

    EJBProcess usage

    Steffen Mueller Newbie

      Hello everybody!

      I'm trying to use the EJBProcessor with a SessionBean using an EntityBean or a Collection of EntityBeans, but it doesn't work. Now I want to ask, if the EJBProcessor supports such an action anyway or if I only configure it incorrectly? I don't find any examples dealing with complex objects such an EntityBean. All found examples are using simple data types.
      Here are two of my EJB-methods:

      public Customer createCustomer(Customer newCustomer){...}

      and
      public Collection<Customer> getAllCustomers(){...}

      The Service for the first SessionBean-method is:
      <service category="Customers"
       description="Creates a new customer in database." invmScope="GLOBAL" name="CreateCustomerService">
       <listeners>
       <jms-listener busidref="CustomerChannel" maxThreads="1" name="ESB-Listener">
       <jms-message-filter dest-name="queue/CustomerQueue" dest-type="QUEUE"/>
       </jms-listener>
       </listeners>
       <actions mep="RequestResponse">
       <action class="org.jboss.soa.esb.actions.EJBProcessor" name="createCustomer">
       <property name="ejb3" value="true"/>
       <property name="jndi-name" value="HanebuttCustomComponents/CustomerControllerBean/remote"/>
       <property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory"/>
       <property name="provider-url" value="localhost:1099"/>
       <property name="method" value="createCustomer"/>
       <property name="ejb-params">
       <arg0 type="de.hanebutt.customcomponents.entities.Customer">newCustomer</arg0>
       </property>
       </action>
       </actions>
       </service>

      The service invocation is the following:
      System.setProperty("javax.xml.registry.ConnectionFactoryClass", "org.apache.ws.scout.registry.ConnectionFactoryImpl");
       deliveryAdapter = new ServiceInvoker("Customers", "CreateCustomerService");
       requestMessage = MessageFactory.getInstance().getMessage();
       requestMessage.getBody().add(c);
       replyMessage = deliveryAdapter.deliverSync(requestMessage, 20000);

      When I invoke the service, the following exceptions occur:
      org.jboss.soa.esb.couriers.FaultMessageException: org.jboss.soa.esb.actions.ActionProcessingException: Got an error while processing EJB method [createCustomer]
      at org.jboss.soa.esb.listeners.message.errors.Factory.createExceptionFromFault(Factory.java:50)
      at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:207)
      at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.attemptDelivery(ServiceInvoker.java:641)
      at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.access$200(ServiceInvoker.java:535)
      at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:355)
      at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:215)
      at de.hanebutt.services.ServicesESB.createCustomer(ServicesESB.java:95)
      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.wsf.container.jboss42.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:102)
      at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:221)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
      at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.soa.esb.actions.ActionProcessingException: Got an error while processing EJB method [createCustomer]
      at org.jboss.soa.esb.actions.EJBProcessor.process(EJBProcessor.java:181)
      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.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
      at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74)
      at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)
      at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)
      at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)
      at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:545)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
      ... 1 more
      Caused by: java.lang.ClassNotFoundException: de.hanebutt.customcomponents.entities.Customer
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:242)
      at org.jboss.soa.esb.util.ClassUtil.forName(ClassUtil.java:93)
      at org.jboss.soa.esb.actions.EJBProcessor.process(EJBProcessor.java:153)
      ... 13 more
      Can anybody tell me, what I'm doing wrong?

      JBoss AS 4.2.3 + ESB 4.6

      Thanks
      Steffen

        • 1. Re: EJBProcess usage
          bingozzz bingozzz Newbie

          you sure that your esb project classpath include the class "de.hanebutt.customcomponents.entities.Customer "

          • 2. Re: EJBProcessor usage
            Steffen Mueller Newbie

            Hi cammette,

            Yes, I'm sure. Classpath is set correctly. The EntityBeans are in the same jar as the SessionBean interfaces (local and remote). And accessing a method returning a string or another simple data type is no problem.
            Now I've built custom actions for ESB services, that use DataTransferObjects in the esb, convert the DataTransferObjects to EntityBeans and invoke the SessionBeans. The DataTransferObjects are java.io.Serializable and JaxB-annotated. It works...

            • 3. Re: EJBProcess usage
              Daniel Bevenius Master

              Hi,

              so the class, de.hanebutt.customcomponents.entities.Customer, exists in the .esb archive you have. Is that correct?

              Could you send me your .esb archive and the jars for the ejbs, and I'll see if I can spot anything.

              Regards,

              /Daniel

              • 4. Re: EJBProcessor usage
                Steffen Mueller Newbie

                Hi Daniel,

                I changed the jboss deploy folder in eclipse from .metadata to jboss deploy folder and checked the esb archive/folder again. The jar with the Session and EntityBeans was not packaged in the lib folder of the esb archive. I added it. And now the version with the EJBProcessor works, too. So camette was right. Sorry!

                Thanks and regards
                Steffen

                • 5. Re: EJBProcess usage
                  Daniel Bevenius Master

                  Hi Steffen,

                  glad you hear that you and camette sorted this out.

                  Regards,

                  /Daniel

                  • 6. Re: EJBProcessor usage
                    Steffen Mueller Newbie

                    Hi Daniel,

                    but there is another question I have to ask: Why does it work with the DataTransferObjects.jar even though the archive wasn't in the lib folder, too...Is it because of Jax-B-serializable objects??? It's a little bit strange...

                    Thanks and regards
                    Steffen

                    • 7. Re: EJBProcess usage
                      Daniel Bevenius Master

                      Hey Steffen,

                      Why does it work with the DataTransferObjects.jar even though the archive wasn't in the lib folder, too...Is it because of Jax-B-serializable objects??? It's a little bit strange...

                      Not sure I fully understand your deployment yet. Is the DataTransferObjects.jar located in the .esb archive?

                      Regards,

                      /Daniel

                      • 8. Re: EJBProcess usage
                        Steffen Mueller Newbie

                        Hi Daniel,

                        my deployment consists originally of 4 Jars: an EJB-Component, An EJB-Component-Client, an ESB-Component and an ESB-Component-Client (version 1: doesn't work). And in the version with the DataTransferObjects there were XML-serializable classes additionally representing the EntityBeans (version 2: works).
                        Deployment looks like this:

                        ESB-Component-Client (native ESB-Client) uses EJB-Component-Client
                        |
                        <-------------------------------------> ESB-Component (Bus)
                        | |
                        EJB-Component Other Components

                        I hope you can imagine what I mean :-)
                        Originally (version 1) the EJB-Component is bound to the ESB with EJBProcessor and the ESB-Component-Client uses the EJB-Component-Client, which includes the EntityBeans and the SessionBean-Interfaces.
                        This version didn't work...Until yesterday. So I built custom actions accessing the EJB-Component and converting the EntityBeans into DataTransferObjects then transmitting the DTO's over the ESB to the ESB-Component-Client...works!
                        But in both versions the jars with the transmitted objects don't exist in lib-folder of the ESB-Component...One version works the other not. I think: this is strange.

                        Thanks and regards
                        Steffen

                        • 9. Re: EJBProcess usage
                          Daniel Bevenius Master

                           

                          But in both versions the jars with the transmitted objects don't exist in lib-folder of the ESB-Component...One version works the other not. I think: this is strange.

                          Where are these jars located? Are they in the .esb archive or somewhere else?

                          Regards,

                          /Daniel

                          • 10. Re: EJBProcess usage
                            Steffen Mueller Newbie

                            The EJB-Component-Client was in the .ear-archive of the EJB-Component and the DTO's were in the .ear-archive of the ESB-Component-Client (an .ear with a web component). Both were referenced via build path in eclipse, but they both didn't exist in the lib-folder of the built/exported .esb-archive (ESB-Component) on the jboss.