0 Replies Latest reply on Jun 27, 2003 4:46 AM by manax

    invoke a SSB's method from another SSB in another PC

    manax Newbie

      I have a stateless session bean(SSB) TransactionSBean deployed in PC A, and a SSBTransactionS2 deployed in another PC B (which have IP address 192.168.1.12).
      I want to invoke the method getTerminalList() of TransactionS2 from TransactionSBean. My code is:

      //in TransactionS2Bean.java
      //TerminalCMP is a CMP entity bean
      //Terminal is a class that implements Serializable interface
      public java.util.Collection getTerminalList()
      {
      try
      {
      TerminalCMPHome home = (TerminalCMPHome)jndiContext.lookup("TerminalCMPBean");
      Collection r_C = home.findAll();
      Collection ret = new ArrayList();
      Iterator iter = r_C.iterator();
      while (iter.hasNext())
      {
      TerminalCMP terCMP = (TerminalCMP)iter.next();
      Terminal ter = new Terminal();
      ter.setTerminal_id(terCMP.getTerminal_id());
      ter.setTerminal_name(terCMP.getTerminal_name());
      ret.add(ter);
      }
      return ret;
      }
      catch (Exception ex)
      {
      return null;
      }
      }


      //in TransactionSBean.java
      public java.util.Collection getTerminalList()
      {
      try
      {
      Properties p = new Properties();
      p.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      p.setProperty("java.naming.provider.url", "jnp://10.206.16.18:1099");
      p.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

      Context ctx = new InitialContext(p);
      Object objref = ctx.lookup("TransactionS2");
      TransactionS2Home myhome = (TransactionS2Home)PortableRemoteObject.narrow(objref, TransactionS2Home.class);

      System.out.println("Lookup completed");

      return myhome.create().getTerminalList();
      }
      catch (Exception ex)
      {
      System.out.println("Remote error: getting TerminalList. Starting print stacktrace");
      ex.printStackTrace();
      System.out.println("End stacktrace");
      return null;
      }
      }


      when I invoke method getTerminalList() of TransactionSBean in PC A, my jboss screen shown:

      15:11:00,468 INFO [STDOUT] Lookup completed
      15:11:00,558 INFO [STDOUT] Remote error: getting TerminalList. Starting print s
      tacktrace
      15:11:00,578 ERROR [STDERR] java.rmi.MarshalException: error marshalling argumen
      ts; nested exception is:
      java.io.NotSerializableException: org.jboss.tm.TransactionImpl
      15:11:00,588 ERROR [STDERR] at sun.rmi.server.UnicastRef.invoke(UnicastRef.j
      ava:129)
      15:11:00,598 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker_
      Stub.invoke(Unknown Source)
      15:11:00,608 ERROR [STDERR] at org.jboss.invocation.jrmp.interfaces.JRMPInvo
      kerProxy.invoke(JRMPInvokerProxy.java:138)
      15:11:00,619 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invok
      e(InvokerInterceptor.java:108)
      15:11:00,639 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke
      (TransactionInterceptor.java:77)
      15:11:00,649 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(Se
      curityInterceptor.java:80)
      15:11:00,659 ERROR [STDERR] at org.jboss.proxy.ejb.HomeInterceptor.invoke(Ho
      meInterceptor.java:198)
      15:11:00,669 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(Client
      Container.java:76)
      15:11:00,679 ERROR [STDERR] at $Proxy21.create(Unknown Source)
      15:11:00,679 ERROR [STDERR] at cdit.mtt.admin.ejb.TransactionSBean.getTermin
      alList(TransactionSBean.java:94)
      15:11:00,689 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
      Native Method)
      15:11:00,699 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
      ativeMethodAccessorImpl.java:39)
      15:11:00,709 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
      ke(DelegatingMethodAccessorImpl.java:25)
      15:11:00,729 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
      24)
      15:11:00,739 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta
      inerInterceptor.invoke(StatelessSessionContainer.java:660)
      15:11:00,749 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
      nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      15:11:00,759 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanc
      eInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      15:11:00,769 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
      nvokeNext(AbstractTxInterceptor.java:107)
      15:11:00,779 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit
      hTransactions(TxInterceptorCMT.java:228)
      15:11:00,789 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
      (TxInterceptorCMT.java:92)
      15:11:00,799 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv
      oke(SecurityInterceptor.java:130)
      15:11:00,809 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
      ogInterceptor.java:204)
      15:11:00,819 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.invok
      e(StatelessSessionContainer.java:313)
      15:11:00,829 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java
      :712)
      15:11:00,889 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MB
      eanServerImpl.java:517)
      15:11:00,899 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invok
      e(LocalInvoker.java:98)
      15:11:00,909 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invok
      e(InvokerInterceptor.java:102)
      15:11:00,919 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke
      (TransactionInterceptor.java:77)
      15:11:00,929 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(Se
      curityInterceptor.java:80)
      15:11:00,939 ERROR [STDERR] at org.jboss.proxy.ejb.StatelessSessionIntercept
      or.invoke(StatelessSessionInterceptor.java:111)
      15:11:00,949 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(Client
      Container.java:76)
      15:11:00,959 ERROR [STDERR] at $Proxy11.getTerminalList(Unknown Source)
      15:11:00,969 ERROR [STDERR] at cdit.mtt.admin.bean.TransactionBean.getTermin
      alList(TransactionBean.java:44)
      15:11:00,979 ERROR [STDERR] at org.apache.jsp.Giaodich_jsp._jspService(Giaod
      ich_jsp.java:141)
      15:11:00,989 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service
      (HttpJspBase.java:137)
      15:11:01,039 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
      rvlet.java:853)
      15:11:01,049 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.s
      ervice(JspServletWrapper.java:204)
      15:11:01,059 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJ
      spFile(JspServlet.java:295)
      15:11:01,069 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(
      JspServlet.java:241)
      15:11:01,079 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
      rvlet.java:853)
      15:11:01,089 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
      in.internalDoFilter(ApplicationFilterChain.java:247)
      15:11:01,099 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
      in.doFilter(ApplicationFilterChain.java:193)
      15:11:01,109 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve
      .invoke(StandardWrapperValve.java:260)
      15:11:01,119 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:11:01,139 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
      oke(StandardPipeline.java:480)
      15:11:01,149 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
      (ContainerBase.java:995)
      15:11:01,159 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve
      .invoke(StandardContextValve.java:191)
      15:11:01,169 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:11:01,179 ERROR [STDERR] at org.apache.catalina.valves.CertificatesValve.
      invoke(CertificatesValve.java:246)
      15:11:01,189 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:11:01,199 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
      oke(StandardPipeline.java:480)
      15:11:01,209 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
      (ContainerBase.java:995)
      15:11:01,219 ERROR [STDERR] at org.apache.catalina.core.StandardContext.invo
      ke(StandardContext.java:2415)
      15:11:01,229 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.in
      voke(StandardHostValve.java:180)
      15:11:01,239 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:11:01,249 ERROR [STDERR] at org.apache.catalina.valves.ErrorDispatcherVal
      ve.invoke(ErrorDispatcherValve.java:170)
      15:11:01,259 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:11:01,279 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.i
      nvoke(ErrorReportValve.java:172)
      15:11:01,289 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:11:01,299 ERROR [STDERR] at org.apache.catalina.valves.AccessLogValve.inv
      oke(AccessLogValve.java:509)
      15:11:01,310 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      15:11:01,320 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
      oke(StandardPipeline.java:480)
      15:11:01,330 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
      (ContainerBase.java:995)
      15:11:01,340 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.
      invoke(StandardEngineValve.java:174)
      15:11:01,350 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
      ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      15:11:01,360 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
      oke(StandardPipeline.java:480)
      15:11:01,380 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
      (ContainerBase.java:995)
      15:11:01,390 ERROR [STDERR] at org.apache.coyote.tomcat4.CoyoteAdapter.servi
      ce(CoyoteAdapter.java:223)
      15:11:01,410 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.proc
      ess(Http11Processor.java:432)
      15:11:01,420 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http1
      1ConnectionHandler.processConnection(Http11Protocol.java:386)
      15:11:01,440 ERROR [STDERR] at org.apache.tomcat.util.net.TcpWorkerThread.ru
      nIt(PoolTcpEndpoint.java:534)
      15:11:01,450 ERROR [STDERR] at org.apache.tomcat.util.threads.ThreadPool$Con
      trolRunnable.run(ThreadPool.java:530)
      15:11:01,460 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)
      15:11:01,460 ERROR [STDERR] Caused by: java.io.NotSerializableException: org.jbo
      ss.tm.TransactionImpl
      15:11:01,470 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject0(Objec
      tOutputStream.java:1054)
      15:11:01,480 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject(Object
      OutputStream.java:278)
      15:11:01,500 ERROR [STDERR] at org.jboss.invocation.MarshalledInvocation.wri
      teExternal(MarshalledInvocation.java:377)
      15:11:01,510 ERROR [STDERR] at java.io.ObjectOutputStream.writeExternalData(
      ObjectOutputStream.java:1262)
      15:11:01,520 ERROR [STDERR] at java.io.ObjectOutputStream.writeOrdinaryObjec
      t(ObjectOutputStream.java:1243)
      15:11:01,530 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject0(Objec
      tOutputStream.java:1052)
      15:11:01,540 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject(Object
      OutputStream.java:278)
      15:11:01,550 ERROR [STDERR] at sun.rmi.server.UnicastRef.marshalValue(Unicas
      tRef.java:265)
      15:11:01,560 ERROR [STDERR] at sun.rmi.server.UnicastRef.invoke(UnicastRef.j
      ava:124)
      15:11:01,570 ERROR [STDERR] ... 72 more
      15:11:01,580 INFO [STDOUT] End stacktrace


      I don't understand what the error is?
      Please help me!
      Thanks a lot!