1 Reply Latest reply on Aug 27, 2004 4:44 PM by Kiet Mao

    My entity bean does not work when I have not network connect

    Rene de Jong Newbie


      I use myEclipse and JBoss 3.0.8.
      When I create an CMP entity bean, and deploy it, everything works fine if I am connected to the network.
      If I am not connected to the network, Session and MDB beans work fine, but when I call an entity bean I get the following error:

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: Could not instantiate bean; CausedByException is:
      null
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy0.findByPrimaryKey(Unknown Source)
      at PersonTest.main(PersonTest.java:29)
      Caused by: java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: Could not instantiate bean; CausedByException is:
      null
      at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:360)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:137)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.Container.invoke(Container.java:756)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:383)
      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:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: javax.ejb.EJBException: Could not instantiate bean; CausedByException is:
      null
      at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:188)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:237)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:68)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:133)
      ... 16 more


      My Client looks like this:

      public static void main(java.lang.String[] args) {
      try {
      Properties props = new Properties();
      props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      props.setProperty("java.naming.provider.url", "localhost:1099");
      props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");

      Context context = new InitialContext(props);
      Object object = context.lookup("ejb/PersonEntityHome");
      PersonEntityHome personEntityHome = (PersonEntityHome) PortableRemoteObject.narrow(object,PersonEntityHome.class);


      for (int x=1; x<4; x++){
      PersonEntity person2 = personEntityHome.findByPrimaryKey(new PersonEntityPK(Integer.toString(x)));
      System.out.println("id= "+ person2.getId()+" name= "+person2.getName() );
      }


      }
      catch (Exception e) {
      e.printStackTrace();
      }
      }

      Any ideas of what the problem is?

      Rene.