8 Replies Latest reply on Dec 28, 2004 6:46 AM by Lothar Egger

    Cannot lookup after restart server

    Le Van Huyen Newbie

      I have 2 jboss servers: serverA and serverB. On serverA, I have a SLSB beanA. This SLSB has to call some method of SLSB beanB deployed on serverB.
      I can successfully lookup beanB from beanA, and do my business. But, when I restart serverB, I cannot lookup beanB again from beanA.
      The code segment in beanA that re-lookup beanB is:

      try
      {
       env = new Hashtable();
       env.put(Context.PROVIDER_URL, serverUrl);
       env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
       Context ctx = new InitialContext(env);
       Object ref = ctx.lookup(beanBJndiName);
       if (ref == null)
       System.out.println("Got ref object");
       else
       System.out.println("ref is null");
       Object curHome = PortableRemoteObject.narrow(ref, homeClass);
      }
      catch (Exception ex)
      {
       ex.printStackTrace();
      }
      


      and here is what I got on serverA's screen

      10:20:22,546 INFO [STDOUT] ref is null
      10:20:22,546 ERROR [STDERR] java.lang.ClassCastException
      10:20:22,546 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableR
      emoteObject.narrow(PortableRemoteObject.java:293)
      10:20:22,546 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(Portabl
      eRemoteObject.java:134)
      10:20:22,546 ERROR [STDERR] at infogate.payment.business.ConnectorSSBBean.Re
      connect(ConnectorSSBBean.java:286)
      10:20:22,546 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
      Native Method)
      10:20:22,546 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
      ativeMethodAccessorImpl.java:39)
      10:20:22,546 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
      ke(DelegatingMethodAccessorImpl.java:25)
      10:20:22,546 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
      24)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta
      inerInterceptor.invoke(StatelessSessionContainer.java:660)
      10:20:22,546 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
      nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanc
      eInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
      nvokeNext(AbstractTxInterceptor.java:107)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit
      hTransactions(TxInterceptorCMT.java:178)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
      (TxInterceptorCMT.java:60)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv
      oke(SecurityInterceptor.java:130)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
      ogInterceptor.java:204)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.invok
      e(StatelessSessionContainer.java:313)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.local.BaseLocalContaine
      rInvoker.invoke(BaseLocalContainerInvoker.java:301)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.local.StatelessSessionP
      roxy.invoke(StatelessSessionProxy.java:81)
      10:20:22,546 ERROR [STDERR] at $Proxy80.Reconnect(Unknown Source)
      10:20:22,546 ERROR [STDERR] at infogate.payment.business.ConnectorMDBBean.on
      Message(ConnectorMDBBean.java:51)
      10:20:22,546 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
      Native Method)
      10:20:22,546 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
      ativeMethodAccessorImpl.java:39)
      10:20:22,546 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
      ke(DelegatingMethodAccessorImpl.java:25)
      10:20:22,546 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
      24)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer$Containe
      rInterceptor.invoke(MessageDrivenContainer.java:391)
      10:20:22,546 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
      nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
      nvokeNext(AbstractTxInterceptor.java:107)
      10:20:22,546 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptorBM
      T.invokeNext(AbstractTxInterceptorBMT.java:144)
      10:20:22,562 ERROR [STDERR] at org.jboss.ejb.plugins.MessageDrivenTxIntercep
      torBMT.invoke(MessageDrivenTxInterceptorBMT.java:33)
      10:20:22,562 ERROR [STDERR] at org.jboss.ejb.plugins.MessageDrivenInstanceIn
      terceptor.invoke(MessageDrivenInstanceInterceptor.java:88)
      10:20:22,562 ERROR [STDERR] at org.jboss.ejb.plugins.RunAsSecurityIntercepto
      r.invoke(RunAsSecurityInterceptor.java:100)
      10:20:22,562 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
      ogInterceptor.java:204)
      10:20:22,562 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer.invoke(M
      essageDrivenContainer.java:302)
      10:20:22,562 ERROR [STDERR] at org.jboss.ejb.plugins.jms.JMSContainerInvoker
      .invoke(JMSContainerInvoker.java:962)
      10:20:22,562 ERROR [STDERR] at org.jboss.ejb.plugins.jms.JMSContainerInvoker
      $MessageListenerImpl.onMessage(JMSContainerInvoker.java:1038)
      10:20:22,562 ERROR [STDERR] at org.jboss.jms.asf.StdServerSession.onMessage(
      StdServerSession.java:243)
      10:20:22,562 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.sessionConsum
      erProcessMessage(SpyMessageConsumer.java:603)
      10:20:22,562 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.addMessage(Sp
      yMessageConsumer.java:417)
      10:20:22,562 ERROR [STDERR] at org.jboss.mq.SpySession.run(SpySession.java:2
      96)
      10:20:22,562 ERROR [STDERR] at org.jboss.jms.asf.StdServerSession.run(StdSer
      verSession.java:178)
      10:20:22,562 ERROR [STDERR] at EDU.oswego.cs.dl.util.concurrent.PooledExecut
      or$Worker.run(PooledExecutor.java:655)
      10:20:22,562 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)