0 Replies Latest reply on Feb 2, 2009 9:02 AM by Vinoth S

    invoking EJB via Http call using Jboss

    Vinoth S Newbie

      Hi all,
      I am new to the world of remotes and homes. I am stuck in this problem for a while... Please help me out.

      I am using EJB 2.1 , Jboss 4.0.2, JDK 1.6 and JRE 5.0. I can able to invoke the session bean from a java application. But when i tried to invoke from the servlet (in my case JSF servlet,... also i tried with the Http Servlet ...i got the same result), it is giving the communication exception error. just like the call from main method, i am using Eclipse RCP as a front end and can be able to invoke the session beans.

      1. What is the configuration need to be done in Jboss AS for EJB. Please explain it.
      2. What is the exact difference between when a user making a call from a main method and call from a servlet.
      3. Do i have to use the concept of Mbean? if it is so, could you please brief it. Or giveme some links to explore it.



      Here is the class which is invoking the (Proxy) EJB,


      
      
      public class SearchSuspensDelegate implements Serializable {
      
       public SearchSuspensDelegate()
       {
      
       }
      
      
       public List<SUSPENS> retrieveSuspensList(TravellingBean ParameterBean) throws CreateException, NamingException, RemoteException
       {
      
       testEJB(); // this is calling the EJB service Locator method .
      
       return new SuspensSearchPOJO().retrieveSuspensList(ParameterBean);
       }
      
       public void testEJB() throws CreateException, NamingException
       {
      
       Properties props = new Properties();
       props.put("java.naming.factory.initial", "org.jboss.naming.HttpNamingContextFactory" );
       props.put("java.naming.provider.url", "http://localhost:8080/invoker/JNDIFactory");
       props.put("java.naming.factory.url.pkgs", "org.jboss.naming");
      
       try {
      
       Context context = new InitialContext(props);
      
       System.out.println("Looking up ejb");
      
      
       Object ref= context.lookup("My");
      
       System.out.println("reference is" +ref);
      
       My bean;
      
       try {
       bean = ((MyHome)ref).create();
       System.out.println("Bean is" +bean);
      
       System.out.println("in the client side we are printing");
       System.out.println(bean.foo("vin"));
      
       }
      
       catch (RemoteException e)
       {
       e.printStackTrace();
       }
      
       }
      
       catch (NamingException e)
       {
       System.out.println("couldnt look it up");
       e.printStackTrace();
       }
       }
      
       public static void main(String[] args) throws Exception {
       new SearchSuspensDelegate().testEJB();
       }
      
      


      This is the Error Message i am getting when i tried to invoke the EJB session bean ..... I understood that the root exception is because of the jboss-client.jar and jbossall-client.jar. But i am using the same jar files which comes along with the jboss 4.0.2.Zip. I am getting the same error. Is there any other thing causing this error? So what is the solution for this problem.



      
      
      
      12:52:29,503 INFO [STDOUT] couldnt look it up
      12:52:29,503 INFO [STDOUT] javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.util.id.GUID; local class incompatible: stream classdesc serialVersionUID = 3289509836244263718, local class serialVersionUID = 6926421946503004889]
      12:52:29,503 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:707)
      12:52:29,503 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      12:52:29,503 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:351)
      12:52:29,503 INFO [STDOUT] at com.tcs.nulamda.Delegate.SearchSuspensDelegate.testEJB(SearchSuspensDelegate.java:61)
      12:52:29,503 INFO [STDOUT] at com.tcs.nulamda.Delegate.SearchSuspensDelegate.retrieveSuspensList(SearchSuspensDelegate.java:38)
      12:52:29,503 INFO [STDOUT] at com.tcs.nulamda.Controller.SuspensSearchController.searchSuspens(SuspensSearchController.java:33)
      12:52:29,503 INFO [STDOUT] at com.tcs.nulamda.Controller.SuspensSearchController.getSuspenslist(SuspensSearchController.java:113)
      12:52:29,503 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:52:29,504 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      12:52:29,504 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      12:52:29,504 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
      12:52:29,504 INFO [STDOUT] at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
      12:52:29,504 INFO [STDOUT] at org.apache.struts.faces.application.PropertyResolverImpl.getValue(PropertyResolverImpl.java:171)
      12:52:29,504 INFO [STDOUT] at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
      12:52:29,504 INFO [STDOUT] at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
      12:52:29,504 INFO [STDOUT] at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
      12:52:29,504 INFO [STDOUT] at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
      12:52:29,514 INFO [STDOUT] at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
      12:52:29,514 INFO [STDOUT] at javax.faces.component.UIData.getValue(UIData.java:527)
      12:52:29,514 INFO [STDOUT] at javax.faces.component.UIData.getDataModel(UIData.java:848)
      12:52:29,514 INFO [STDOUT] at javax.faces.component.UIData.setRowIndex(UIData.java:379)
      12:52:29,514 INFO [STDOUT] at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:65)
      12:52:29,514 INFO [STDOUT] at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:675)
      12:52:29,514 INFO [STDOUT] at javax.faces.component.UIData.encodeBegin(UIData.java:681)
      12:52:29,514 INFO [STDOUT] at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:584)
      12:52:29,514 INFO [STDOUT] at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:536)
      12:52:29,514 INFO [STDOUT] at com.sun.faces.taglib.html_basic.DataTableTag.doEndTag(DataTableTag.java:491)
      12:52:29,514 INFO [STDOUT] at org.apache.jsp.pages.SearchResult_jsp._jspx_meth_h_005fdataTable_005f0(SearchResult_jsp.java:852)
      12:52:29,514 INFO [STDOUT] at org.apache.jsp.pages.SearchResult_jsp._jspx_meth_h_005fform_005f0(SearchResult_jsp.java:266)
      12:52:29,514 INFO [STDOUT] at org.apache.jsp.pages.SearchResult_jsp._jspx_meth_f_005fview_005f0(SearchResult_jsp.java:171)
      12:52:29,514 INFO [STDOUT] at org.apache.jsp.pages.SearchResult_jsp._jspService(SearchResult_jsp.java:116)
      12:52:29,514 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
      12:52:29,515 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      12:52:29,515 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
      12:52:29,515 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
      12:52:29,515 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      12:52:29,515 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      12:52:29,515 INFO [STDOUT] at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
      12:52:29,515 INFO [STDOUT] at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
      12:52:29,515 INFO [STDOUT] at org.apache.struts.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:135)
      12:52:29,515 INFO [STDOUT] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
      12:52:29,515 INFO [STDOUT] at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
      12:52:29,515 INFO [STDOUT] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
      12:52:29,515 INFO [STDOUT] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      12:52:29,515 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:52:29,515 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      12:52:29,516 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      12:52:29,516 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
      12:52:29,516 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      12:52:29,516 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      12:52:29,516 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      12:52:29,516 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      12:52:29,516 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      12:52:29,516 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      12:52:29,516 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
      12:52:29,517 INFO [STDOUT] Caused by: java.io.InvalidClassException: org.jboss.util.id.GUID; local class incompatible: stream classdesc serialVersionUID = 3289509836244263718, local class serialVersionUID = 6926421946503004889
      12:52:29,517 INFO [STDOUT] at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      12:52:29,517 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.readExternal(InvokerInterceptor.java:254)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      12:52:29,517 INFO [STDOUT] at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:66)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      12:52:29,517 INFO [STDOUT] at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:66)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      12:52:29,517 INFO [STDOUT] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      12:52:29,517 INFO [STDOUT] at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:66)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      12:52:29,518 INFO [STDOUT] at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:142)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      12:52:29,518 INFO [STDOUT] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      12:52:29,518 INFO [STDOUT] at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      12:52:29,518 INFO [STDOUT] at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:57)
      12:52:29,518 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:637)
      12:52:29,518 INFO [STDOUT] ... 68 more
      
      


      Thanks for your valuable time.
      - Vinoth