1 Reply Latest reply on Dec 19, 2006 9:20 AM by Saleem Ahmad

    javax.ejb.ObjectNotFoundException: No such entity!

    Saleem Ahmad Newbie

      I made an CMP Entity Bean and a session bean. It is successfully deployed, but when I run the client application it gives me the following exception. My JDBC connectivity is working fine. Prompt reply is requested.


      javax.ejb.ObjectNotFoundException: No such entity!
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:50)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:589)
      at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:236)
      at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
      at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:189)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:180)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:119)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:110)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:146)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:130)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
      at org.jboss.ejb.Container.invoke(Container.java:894)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:344)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
      at $Proxy140.findByPrimaryKey(Unknown Source)
      at ejb.CustomerFacadeBean.getCustomerInfo(CustomerFacadeBean.java:74)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
      at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
      at org.jboss.ejb.Container.invoke(Container.java:873)
      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:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
      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:585)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
      at java.lang.Thread.run(Thread.java:595)
      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:126)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:119)
      at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
      at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:37)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
      at $Proxy1.getCustomerInfo(Unknown Source)
      at ejbclient.Main.main(Main.java:50)
      Caught a BookException No such entity!
      javax.ejb.ObjectNotFoundException: No such entity!
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:50)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:589)
      at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:236)
      at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
      at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:189)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:180)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:119)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:110)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:146)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:130)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
      at org.jboss.ejb.Container.invoke(Container.java:894)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:344)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
      at $Proxy140.findByPrimaryKey(Unknown Source)
      at ejb.CustomerFacadeBean.getCustomerInfo(CustomerFacadeBean.java:74)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
      at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
      at org.jboss.ejb.Container.invoke(Container.java:873)
      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:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
      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:585)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
      at java.lang.Thread.run(Thread.java:595)
      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:126)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:119)
      at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
      at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:37)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
      at $Proxy1.getCustomerInfo(Unknown Source)
      at ejbclient.Main.main(Main.java:50)


      Regards,

        • 1. Re: javax.ejb.ObjectNotFoundException: No such entity!
          Saleem Ahmad Newbie

          my code of CMP and Session bean is as follows:
          CustomerFacadeBean.java

          package ejb;

          import java.util.Collection;
          import javax.ejb.*;

          /**
          * This is the bean class for the CustomerFacadeBean enterprise bean.
          * Created Dec 18, 2006 5:24:41 PM
          * @author tariq
          */
          public class CustomerFacadeBean implements SessionBean, CustomerFacadeRemoteBusiness {
          private SessionContext context;
          private ejb.CustomerTblLocalHome custHome;
          // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">
          // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
          // TODO Add business methods or web service operations
          /**
          * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
          */
          public void setSessionContext(SessionContext aContext) {
          context = aContext;
          }

          /**
          * @see javax.ejb.SessionBean#ejbActivate()
          */
          public void ejbActivate() {

          }

          /**
          * @see javax.ejb.SessionBean#ejbPassivate()
          */
          public void ejbPassivate() {

          }

          /**
          * @see javax.ejb.SessionBean#ejbRemove()
          */
          public void ejbRemove() {

          }
          // </editor-fold>

          /**
          * See section 7.10.3 of the EJB 2.0 specification
          * See section 7.11.3 of the EJB 2.1 specification
          */
          public void ejbCreate() {
          custHome = lookupCustomerTblBean();
          }



          // Add business logic below. (Right-click in editor and choose
          // "EJB Methods > Add Business Method" or "Web Service > Add Operation")

          private ejb.CustomerTblLocalHome lookupCustomerTblBean() {
          try {
          javax.naming.Context c = new javax.naming.InitialContext();
          ejb.CustomerTblLocalHome rv = (ejb.CustomerTblLocalHome) c.lookup("java:comp/env/ejb/CustomerTblBean");
          return rv;
          }
          catch(javax.naming.NamingException ne) {
          java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
          throw new RuntimeException(ne);
          }
          }

          public String getCustomerInfo(int custId) throws javax.ejb.FinderException {
          //ejb.CustomerTblLocalHome customer1 = custHome.findByPrimaryKey(new Integer(custId));
          ejb.CustomerTblLocal customer = custHome.findByPrimaryKey(new Integer(25));
          return "Discount code for customer" + custId+ "is "+customer.getDiscountCode();
          //return "City name is " + s1;
          //return "Name: " + customer.getName() + ", E-mail: " +customer.getEmail();
          }

          public String findCustomerbyCity() throws javax.ejb.FinderException {
          Collection c1 = custHome.findByCity("Miami");
          String s1 = c1.toString();
          return s1;
          }

          public String findByZipCode() throws javax.ejb.FinderException {
          Collection c1 = custHome.findByZip("12347");
          String s1 = c1.toString();
          return "Name of city with zip code is " + s1 + " .";
          }

          }



          CustomerTblBean.java

          package ejb;

          import java.sql.Date;
          import java.sql.Time;
          import javax.ejb.*;

          /**
          * This is the bean class for the CustomerTblBean enterprise bean.
          * Created Dec 18, 2006 5:19:38 PM
          * @author tariq
          */
          public abstract class CustomerTblBean implements EntityBean, CustomerTblLocalBusiness {
          private EntityContext context;

          // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
          // TODO Consider creating Transfer Object to encapsulate data
          // TODO Review finder methods
          /**
          * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
          */
          public void setEntityContext(EntityContext aContext) {
          context = aContext;
          }

          /**
          * @see javax.ejb.EntityBean#ejbActivate()
          */
          public void ejbActivate() {

          }

          /**
          * @see javax.ejb.EntityBean#ejbPassivate()
          */
          public void ejbPassivate() {

          }

          /**
          * @see javax.ejb.EntityBean#ejbRemove()
          */
          public void ejbRemove() {

          }

          /**
          * @see javax.ejb.EntityBean#unsetEntityContext()
          */
          public void unsetEntityContext() {
          context = null;
          }

          /**
          * @see javax.ejb.EntityBean#ejbLoad()
          */
          public void ejbLoad() {

          }

          /**
          * @see javax.ejb.EntityBean#ejbStore()
          */
          public void ejbStore() {

          }
          // </editor-fold>


          public abstract Integer getCustomerNum();
          public abstract void setCustomerNum(Integer customerNum);

          public abstract String getDiscountCode();
          public abstract void setDiscountCode(String discountCode);

          public abstract String getZip();
          public abstract void setZip(String zip);

          public abstract String getName();
          public abstract void setName(String name);

          public abstract String getAddrLn1();
          public abstract void setAddrLn1(String addrLn1);

          public abstract String getAddrLn2();
          public abstract void setAddrLn2(String addrLn2);

          public abstract String getCity();
          public abstract void setCity(String city);

          public abstract String getState();
          public abstract void setState(String state);

          public abstract String getPhone();
          public abstract void setPhone(String phone);

          public abstract String getFax();
          public abstract void setFax(String fax);

          public abstract String getEmail();
          public abstract void setEmail(String email);

          public abstract Integer getCreditLimit();
          public abstract void setCreditLimit(Integer creditLimit);

          public abstract Date getLastSaleDate();
          public abstract void setLastSaleDate(Date lastSaleDate);

          public abstract Time getLastSaleTime();
          public abstract void setLastSaleTime(Time lastSaleTime);


          public java.lang.Object ejbCreate(Integer customerNum, String discountCode, String zip, String name, String addrLn1, String addrLn2, String city, String state, String phone, String fax, String email, Integer creditLimit, Date lastSaleDate, Time lastSaleTime) throws CreateException {
          if (customerNum == null) {
          throw new CreateException("The field \"customerNum\" must not be null");
          }
          if (discountCode == null) {
          throw new CreateException("The field \"discountCode\" must not be null");
          }
          if (zip == null) {
          throw new CreateException("The field \"zip\" must not be null");
          }

          // TODO add additional validation code, throw CreateException if data is not valid
          setCustomerNum(customerNum);
          setDiscountCode(discountCode);
          setZip(zip);
          setName(name);
          setAddrLn1(addrLn1);
          setAddrLn2(addrLn2);
          setCity(city);
          setState(state);
          setPhone(phone);
          setFax(fax);
          setEmail(email);
          setCreditLimit(creditLimit);
          setLastSaleDate(lastSaleDate);
          setLastSaleTime(lastSaleTime);

          return null;
          }

          public void ejbPostCreate(Integer customerNum, String discountCode, String zip, String name, String addrLn1, String addrLn2, String city, String state, String phone, String fax, String email, Integer creditLimit, Date lastSaleDate, Time lastSaleTime) {
          // TODO populate relationships here if appropriate

          }
          }


          here is the code of my client application:

          /*
          * Main.java
          *
          * Created on November 29, 2006, 10:45 AM
          *
          * To change this template, choose Tools | Template Manager
          * and open the template in the editor.
          */

          package ejbclient;

          import ejb.*;
          import java.util.Enumeration;
          import java.util.Properties;
          import java.util.Vector;
          import javax.naming.Context;
          import javax.rmi.PortableRemoteObject;

          /**
          *
          * @author tariq
          */
          public class Main {

          /** Creates a new instance of Main */
          public Main() {
          }

          /**
          * @param args the command line arguments
          */
          public static void main(String[] args) {
          ObjectKey ob = new ObjectKey();
          ob.castValue();

          System.out.println("Trying to get context");
          try{
          System.out.println("Getting InitialContext");
          Context ctx = getInitialContext();
          System.out.println("Getting Initial Reference");
          Object objRef = ctx.lookup("CustomerFacadeBean");
          System.out.println("Got Initial Reference");
          CustomerFacadeRemoteHome home =
          (CustomerFacadeRemoteHome)PortableRemoteObject.narrow(
          objRef, CustomerFacadeRemoteHome.class);
          CustomerFacadeRemote r1 = home.create();
          System.out.println("home created");
          //r1.getCustomerInfo(25);
          System.out.println(r1.findCustomerbyCity());
          System.out.println("home created1");
          System.out.println(r1.findByZipCode());
          System.out.println("Found by ZIP code");
          r1.getCustomerInfo(25);
          System.out.println(r1.findCustomerbyCity());
          /*CartRemote shoppingCart = home.create(
          "Duke DeEarl", "123");
          shoppingCart.addBook("The Martian Chronicles");
          shoppingCart.addBook("2001 A Space Odyssey");
          shoppingCart.addBook("The Left Hand of Darkness");
          shoppingCart.addBook("Alice in Wonderland");
          Vector bookList = new Vector();
          bookList = shoppingCart.getContents();
          Enumeration enumer = bookList.elements();
          while (enumer.hasMoreElements()) {
          String title = (String) enumer.nextElement();
          System.out.println(title);
          }
          shoppingCart.removeBook("Alice in Wonderland");*/
          r1.remove();
          System.exit(0);
          } catch (Exception ex){
          ex.printStackTrace();
          System.err.println(
          "Caught a BookException " + ex.getMessage());
          ex.printStackTrace();
          System.exit(0);
          }
          }
          public static Context getInitialContext()
          throws javax.naming.NamingException{
          Properties p = new Properties();
          p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
          p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
          p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
          return new javax.naming.InitialContext(p);


          }
          }


          Exception is generated at highlighted point in the client application.

          Waiting for a prompt response