0 Replies Latest reply on Aug 25, 2003 3:33 AM by sysuser1

    java.rmi.NoSuchObjectException: Entity not found

    sysuser1

      Hi I am trying the sample codes (ex 4.1) from OREILLY's jboss workbook. It works fine with defaultDS, then I am trying to configure the MS-SQLSERVER 7.0, the table can be created when jar file deployed, but I have the exceptions as below when I run the client code :

      run.client_41a:
      [java] java.rmi.NoSuchObjectException: Entity not found: primaryKey=1; nested exception is:
      [java] javax.ejb.NoSuchEntityException: Entity not found: primaryKey=1
      [java] javax.ejb.NoSuchEntityException: Entity not found: primaryKey=1
      [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
      [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
      [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      [java] at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      [java] at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
      [java] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
      [java] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      [java] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
      [java] at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:97)
      [java] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      [java] at $Proxy1.setName(Unknown Source)
      [java] at com.titan.clients.Client_1.main(Client_1.java:24)


      The client code just lookup a CMP entity bean (CabinBean) and set its attributes


      import com.titan.cabin.CabinHomeRemote;
      import com.titan.cabin.CabinRemote;

      import javax.naming.InitialContext;
      import javax.naming.Context;
      import javax.naming.NamingException;
      import javax.rmi.PortableRemoteObject;
      import java.rmi.RemoteException;

      public class Client_1
      {
      public static void main(String [] args)
      {
      try
      {
      Context jndiContext = getInitialContext();
      Object ref = jndiContext.lookup("CabinHomeRemote");
      CabinHomeRemote home = (CabinHomeRemote)
      PortableRemoteObject.narrow(ref,CabinHomeRemote.class);
      CabinRemote cabin_1 = home.create(new Integer(1));

      cabin_1.setName("Master Suite");
      cabin_1.setDeckLevel(1);
      cabin_1.setShipId(1);
      cabin_1.setBedCount(3);

      Integer pk = new Integer(1);

      CabinRemote cabin_2 = home.findByPrimaryKey(pk);
      System.out.println(cabin_2.getName());
      System.out.println(cabin_2.getDeckLevel());
      System.out.println(cabin_2.getShipId());
      System.out.println(cabin_2.getBedCount());

      }
      catch (java.rmi.RemoteException re){re.printStackTrace();}
      catch (javax.naming.NamingException ne){ne.printStackTrace();}
      catch (javax.ejb.CreateException ce){ce.printStackTrace();}
      catch (javax.ejb.FinderException fe){fe.printStackTrace();}
      }

      public static Context getInitialContext()
      throws javax.naming.NamingException
      {
      return new InitialContext();
      /**** context initialized by jndi.properties file
      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "localhost:1099");
      return new javax.naming.InitialContext(p);
      */

      }
      }


      I have created jbosscmp-jdbc.xml file for SQL Server

      <jbosscmp-jdbc>


      java:/MSSQLDS
      <datasource-mapping>MS SQLSERVER</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>true</remove-table>


      </jbosscmp-jdbc>


      Can anyone help me ? thank you very much !