[JBoss-user] [EJB/JBoss] - NoSuchObjectLocalException
Hello everybody, I have two threads executing a findby method (from an entity bean) almost at the same time in a STATELESS session bean but one of them is deleting a record in the database. Thus, the other one complains with the following error: javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=11e1813-fbd1ae2521-b88d8e8d57a53bc420279153d2e46f6f at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:158) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191) ... I have declared all my finder methods from the entity bean and the method that calls these finders in the STATELESS session bean to be transaction type Required and NOT read only. I thought that if a method is not read-only then only one thread can execute at one time (Transaction locking). How can I accomplish that? Thanks in advance, jchang By the way, I am using JBoss 3.2.1 and EJB 2.0 View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3830429#3830429 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3830429 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: NoSuchObjectLocalException
Hello Vikas, Thanks for replying. I am kind scared that this will be a valid behaviour because if I am executing a findBy method that is NOT read-only and has a transaction type Required then I better have the lock to do whatever I want with that bean. Nobody can do a findBy... on the same bean unless I am done with it first. Isn't this the appropiate behaviour? In the logs, I can see that two different threads are executing the same findBy... method of an entity bean which is kind of scary because if one thread decides to delete the record then the other one will have a primary key that doesn't exist anymore in the database. There has to be a way to avoid this confrontation between these two beans. How come the second thread is being allow to execute the findBy... method in the first place? Thanks in advance, jchang P.S. Please let me know if I am missing something? View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3830447#3830447 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3830447 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: NoSuchObjectLocalException
Hello Sesques. I appreciate your help. Here is a snippet of code. As you can see, the addAttendance of this STATELESS bean is calling the findAttendance method with an specific memberId and timeSlotId. In the logs, I can see that two threads are calling this method almost at the same time but the first thread get to the deleteAttendance method and remove the record from the db. Meanwhile, the second thread went into a waiting state because the first one is working within a transaction. But when it wakes up, it tries to execute code based on the primary keys that got from the findByMemberAndTimeSlotId method that is part of the findAttendance method. I am still confused why the container lets 2 threads execute the findByMemberAndTimeSlotId concurrently the first time. By the way, the entity bean has transaction type Required and the finder methods are NOT read-only. The only methods that are read-only are the get methods. And the commit-option is A /** |* @ejb.interface-method |* |* @ejb.transaction |*type=Required |*/ | public void addAttendance(String inConferenceId, String inMemberId, String inGroupId, String inTimeSlotId) | { | ...code... | | // get the record for the current time slot | attendanceMain = findAttendance(inMemberId, inTimeSlotId); | | ...more code... | | // delete the existing attendance record | deleteAttendance(attendanceMain); | | ...more code... | } | | | /** |* @ejb.interface-method |* |* @ejb.transaction |*type=Required |*/ | | public AttendanceVO findAttendance(String inMemberId, String inTimeSlotId) | { | AttendanceVO retval = null; | logger.debug(findAttendance invoked); | try | { | AttendanceLocalHome alh = AttendanceUtil.getLocalHome(); | AttendanceLocal al = alh.findByMemberAndTimeSlotId(inMemberId, inTimeSlotId); //second thread gets into a wait state while the first one is doing transactional process. | retval = al.getAttendanceVO(); //pk for attendance is gone at this point, exception get thrown here | } | catch (FinderException fe) | { | logger.debug(fe.getMessage()); | } | catch (NamingException ne) | { | logger.warn(ne.getMessage(),ne); | } | return retval; | } | | | /** |* @ejb.interface-method |* |* @ejb.transaction |*type=Required |*/ | public boolean deleteAttendance(AttendanceVO inAttendance) | { | boolean retval = false; | if (inAttendance != null) | { | try | { | AttendanceLocalHome alh = AttendanceUtil.getLocalHome(); | AttendanceLocal al = alh.findByPrimaryKey(inAttendance.getId()); | if (al != null) | { | try | { | al.remove(); | retval = true; | } | catch (RemoveException re) | { | logger.warn(re.getMessage()); | } | } | } | catch (FinderException fe) | { | logger.warn(fe.getMessage()); | } | catch (NamingException ne) | { | logger.warn(ne.getMessage(),ne); | } | } | return retval; | } | Thanks for the help jchang View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3830484#3830484 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3830484 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Threads contention
Hello everybody, I have two threads executing a findby method (from an entity bean) almost at the same time in a STATELESS session bean but one of them is deleting a record in the database. Thus, the other one complains with the following error: javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=11e1813-fbd1ae2521-b88d8e8d57a53bc420279153d2e46f6f at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:158) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191) ... I have declared all my finder methods from the entity bean and the method that calls these finders in the STATELESS session bean to be transaction type Required and NOT read only. I thought that if a method is not read-only then only one thread can execute at one time (Transaction locking). How can I accomplish that? Thanks in advance, jchang By the way, I am using JBoss 3.2.1 and EJB 2.0 View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3830220#3830220 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3830220 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - newbie question : Store command NOT executed. Entity is not
(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619) at java.lang.Thread.run(Thread.java:534) Do you have an idea why this will be happening. It seems that another thread is deleting the entity bean. but I have not code that could delete this entity. Also, why would it say that Store command Not executed. Entity is not dirty. Thanks in advance for your help jchang View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3829856#3829856 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3829856 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Re: newbie question : Store command NOT executed. Entity is
By the way I am using Jboss 3.2.1 and JMeter as the testing tool Thanks View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3829859#3829859 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3829859 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - newbie question: transaction (CMT)
Hello everybody, I have several question about CMT that hopefully you can help me out with: * When I don't declare any type of transaction for a specific method in a session bean, how is this method considered under JBoss?. I read somewhere that JBoss treats them as supports (transaction type) by default. It's that true. * I have declared my finder methods in an entity bean to have transaction type NotSupported. But I read in the ejb 2.0 spec that they strongly advise us to use only the Required, RequiresNew and Mandatory in entity beans. Why would I want to create transactions for methods that only find data in the database. And again, If I dont' put any transaction type in an entity bean method, how JBoss treats them by default?. * Are private methods inside session beans considered part of a transaction. In other words, Does JBoss creates a transaction when a private method is use in a session bean. I apologize in advance if any of these question doesn't make sense. Thanks for the help jchang View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3829314#3829314 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3829314 --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470alloc_id=3638op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user