2 Replies Latest reply on May 10, 2002 11:05 AM by sweetfa

    NoSuchEntityException on finder query

    sweetfa

      Please help - am unable to figure why exception is thrown when accessing EJB remote interface element returned from a finder query.

      Collection col = home.findInRange( new PhoneNumber( value1).getPhoneNumber(), new PhoneNumber(value2).getPhoneNumber());
      System.out.println("Search finished - found " + col.size());

      // Add to the result set.
      processCollection( col, results);



      protected void processCollection( Collection col, NumberSearchResults results) throws RemoteException
      {
      // Add them to the result set one at a time
      Iterator i = col.iterator();
      while (i.hasNext())
      {
      Object o = i.next();
      System.out.println("i is " + o.getClass().toString());
      if (o instanceof Numbers)
      System.out.println("Is of type Numbers");
      else if(o instanceof NumbersLocal)
      System.out.println("Is of type NumbersLocal");
      else if(o instanceof NumbersHome)
      System.out.println("Is of type NumbersHome");
      else
      System.out.println( "Is of some other type");
      Numbers num = (Numbers) o;
      System.out.println("MAde it");
      System.out.println("Putting out: " + num.getPhoneNumber().toString());

      results.addElement( new NumberSearchElement( (Numbers) o ));
      System.out.println("Processing: " + o.toString());
      }
      }


      17:24:12,112 INFO [STDOUT] NumbersBean Instance Created
      17:24:12,112 INFO [STDOUT] Search finished - found 3
      17:24:12,112 INFO [STDOUT] i is class $Proxy181
      17:24:12,112 INFO [STDOUT] Is of type Numbers
      17:24:12,112 INFO [STDOUT] MAde it
      17:24:12,128 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
      javax.ejb.NoSuchEntityException: Entity not found: primaryKey=402302067
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:163)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:489)
      at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:410)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(CachedConnectionInterceptor.java:31
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:283)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:147)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:193)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
      at org.jboss.ejb.Container.invoke(Container.java:706)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:116)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy181.getPhoneNumber(Unknown Source)
      at com.whitesmiths.sacha.ejb.numbers.interfaces.SearchRangeInfo.processCollection(Unknown Source)
      at com.whitesmiths.sacha.ejb.numbers.interfaces.SearchRangeInfo.performSearch(Unknown Source)
      at com.whitesmiths.sacha.ejb.numbers.implementations.NumberManagerBean.search(Unknown Source)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:653)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:147)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:706)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy121.search(Unknown Source)
      at com.whitesmiths.sacha.web.actions.numbers.SearchAction.perform(Unknown Source)
      at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:326)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:595)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1357)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1309)
      at org.mortbay.http.HttpServer.service(HttpServer.java:744)
      at org.jboss.jetty.Jetty.service(Jetty.java:527)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:743)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:916)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:758)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:145)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
      at java.lang.Thread.run(Thread.java:484)

        • 1. Re: NoSuchEntityException on finder query
          sweetfa

          I have a suspicion that the problem is caused by the order in which the rows are returned to the finder. I would suspect that they are not being returned in an order that they are expected or handled (hoping someone who knows the code will be able to give me a quick answer on this one).

          • 2. Re: NoSuchEntityException on finder query
            sweetfa

            Thanks all for help - as usual I am wrong.

            However, for those who come across the problem in the future, check the equals method in your primary key class is working....