Adrian - thanks for the clarification of which JBoss versions this problem has been 
fixed in.  We have managed to code a work around for this as indicated below.  
Essentially, we are explicitly deleting the related child entities by cycling thru the 
related collection and applying the remove method.  i.e  We are manually performing 
the cascade delete at this stage.  When we do eventually upgrade to a version >=3.0.4 
we shall re-examine this area and see how we go.

Thanks again for your support

Regards


Alan.


public void removeJob(String erpId) throws RemoveException, FinderException, 
ObjectNotFoundException
{
      JobLocal job = jobHome.findByErpId(erpId);
      // TKH 25/10/02 added code to remove assignments before removing job as a work 
around for the 
      // IllegalStateException which is thrown if JBoss has been restarted since the 
job was created. 
      AssignmentLocal assignment;
      Collection assignments = job.getAssignments();
      Object[] assignmentsArray = assignments.toArray();
      for (int i = 0; i < assignmentsArray.length; i++)
      {
          ((AssignmentLocal) assignmentsArray[i]).remove();
      }
      job.remove();
}

 

-----Original Message-----
From: Adrian Brock [mailto:warjort@;hotmail.com]
Sent: Friday, 25 October 2002 5:08 PM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] Re: "removing bean lock and it has tx set" -
revisited


Hello Alan,

The fix(es) are in 3.0.4 which has not yet been officially release.
But you can get it from CVS.

Try setting your cache size to something very small like 1. :-)
You should be able to reproduce the most likely cause of your
problem.

If 3.0.4 does not fix your problem, please feel free to open a bug report.

Regards,
Adrian


>From: "Alan Yost" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>CC: <[EMAIL PROTECTED]>,"Adrian Brock" <[EMAIL PROTECTED]>
>Subject: "removing bean lock and it has tx set" - revisited
>Date: Fri, 25 Oct 2002 14:24:16 +0800
>
>Guys - about a week ago there was a thread related to the subject matter 
>above.
>
>We still have a problem when attempting to delete an entity that has a 1:M 
>relationship using CMR 2 and a cascade delete tag.
>
>The error we receive whilst attempting to remove the parent entity is as 
>follows:-
>
>13:57:43,693 ERROR [LogInterceptor] TransactionRolledbackLocalException, 
>causedBy:
>java.lang.IllegalStateException: removing bean lock and it has tx set!
>         at 
>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef(QueuedPessimisticEJBLock.java:473)
>         at 
>org.jboss.ejb.BeanLockManager.removeLockRef(BeanLockManager.java:78)
>         at 
>org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:124)
>         at 
>org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)
>
>We have checked the descriptors for the relationships and these appear to 
>be the same as various examples regarding 1:M and cascade delete.  The 
>cascade delete will work in the same JBoss session that the parent and 
>child entities were created in, but will fail if the delete is attempted 
>after a restart of JBoss.
>
>We did note that in thread 
>http://www.mail-archive.com/jboss-user@;lists.sourceforge.net/msg22239.html 
>Adrian Brock indicated that he had resolved the matter after Alexey 
>Yudichev offered some assistance.
>
>If anyone could help us on this matter even we would very much appreciate 
>it.  There are various indications that this problem has been resolved in a 
>number of different JBoss versions - Is 3.0.2 one of them or is there a 
>work around that we require?
>
>Our Config:-
>               JBoss 3.0.2
>               Windows 2000 server
>               MySQL 2.0.11-bin.jar
>
>
>Regards and thanks in advance
>
>
>Alan.
>
>
>PS. If it helps I have included the original defect thread below...
>
>We are getting a similar error (see below) from a Stateless Session bean 
>using JBoss 3.0.2.
>We are also using the "Required" transaction attribute.  The error occurs 
>after the following sequence of events:
>1) create some data using entity beans, via a session facade
>2) Shutdown JBoss
>3) Restart JBoss
>4) Remove the data using entity beans, via a session facade
>
>Are we possibly doing something wrong or is this related to the same bug?
>
>Regards
>Chris
>
>This is the error message:
>
>2002-10-10 14:37:50,699 ERROR 
>[com.yambay.mdrover.erp.proxy.session.ERPTestManagerBean] Failed due to 
>remote exception removing bean lock and it has tx set!; CausedByException 
>is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; nested exception is:
>       javax.ejb.TransactionRolledbackLocalException: removing bean lock and it 
>has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!
>javax.transaction.TransactionRolledbackException: removing bean lock and it 
>has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; nested exception is:
>       javax.ejb.TransactionRolledbackLocalException: removing bean lock and it 
>has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!; CausedByException is:
>       removing bean lock and it has tx set!
>       at 
>org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:230)
>       at 
>org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
>       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
>       at 
>org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
>       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
>       at 
>org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
>       at org.jboss.ejb.Container.invoke(Container.java:720)
>       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
>       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 $Proxy61.removeJob(Unknown Source)
>       at 
>com.yambay.mdrover.erp.proxy.session.ERPTestManagerBean.clearCache(ERPTestManagerBean.java:661)
>       at com.yambay.mdrover.erp.proxy.session.ERPTestManagerBean.runTestCase
>
>...
>
>
>
>
>
>-----Original Message-----
>From: Adrian Brock [mailto:warjort@;hotmail.com]
>Sent: Friday, 11 October 2002 7:40 PM
>To: [EMAIL PROTECTED]
>Subject: Re: [JBoss-user] Re: "removing bean lock and it has tx set" -
>question
>
>
>Hi Michael,
>
>I've applied the fix to the 2.4 branch.
>
>Regards,
>Adrian
>
> >From: Michael Rudorfer <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: [JBoss-user] Re: "removing bean lock and it has tx set" - 
>question
> >Date: Fri, 11 Oct 2002 10:47:28 +0200
> >
> >Did I get you right, Bill?
> >
> >You think that this is a bug in Jboss, not a problem with
> >me, using transactions in a wrong way?
> >
> >Michael
> >
> >Bill Burke wrote:
> >
> > > Can you log a bug on this, copy this email, and assign to me?
> > >
> > > patriot1burke
> > >
> > > Thanks,
> > >
> > > Bill
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:jboss-user-admin@;lists.sourceforge.net]On Behalf Of Michael
> > > > Rudorfer
> > > > Sent: Thursday, October 10, 2002 11:38 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [JBoss-user] "removing bean lock and it has tx set" -
> >question
> > > >
> > > >
> > > > Hi there!
> > > >
> > > > I have the following problem:
> > > >
> > > > I am using Jboss 2.4.6 with CMP (jaws) and Container
> > > > Managed Transaction.
> > > > I have a Stateful Session bean with a bussiness method,
> > > > that utilizes entity beans. The transaction type of that bussiness
> > > > method is set to "required". When there are many entity beans
> > > > to be accessed, jboss crashes with the follwing error message:
> > > >
> > > > [16:22:34,047,AttributeDetailBean] TRANSACTION ROLLBACK EXCEPTION:
> > > > javax.transaction.TransactionRolledbackException: removing bean lock
> >and
> > > > it has tx set!; nested exception is:
> > > >  java.lang.IllegalStateException: removing bean lock and it has tx
> >set!
> > > > java.lang.IllegalStateException: removing bean lock and it has tx 
>set!
> > > >  at
> > > > org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef(Queu
> > > > edPessimisticEJBLock.java:468)
> > > >
> > > >  at
> >org.jboss.ejb.BeanLockManager.removeLockRef(BeanLockManager.java:78)
> > > >
> > > >  at
> > > > org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInter
> > > > ceptor.java:142)
> > > >
> > > > ....
> > > >
> > > > My guess is, that some of the entity beans are beeing passivated
> > > > during the transaction, because the problem gets worse if you set
> > > > the "max-capacity"-parameter in standardjboss.xml to a smaller 
>value.
> > > > Of course setting the value to a higher number helps in the first
> >place,
> > > >
> > > > but isn't a solution to the problem.
> > > >
> > > > Any thoughts on that?
> > > >
> > > > What is the desired way to use transactions for a bussiness method
> > > > that itself calls many different methods on a lot of other beans?
> > > > What happens to a container managed transaction
> > > > if one of the beans that it utilized is passivated?
> > > >
> > > > Any help would be appreciated.
> > > >
> > > > Thanks
> > > > Michael
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This sf.net email is sponsored by:ThinkGeek
> > > > Welcome to geek heaven.
> > > > http://thinkgeek.com/sf
> > > > _______________________________________________
> > > > JBoss-user mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/jboss-user
> > >
> > > -------------------------------------------------------
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> >
> >--
> >Dipl.-Inform. Univ.
> >Michael Rudorfer
> >Senior Software Engineer
> >
> >Wearix Software GmbH
> >Unterhachinger Straße 75
> >81737 München
> >
> >Tel.: +49-89-54 88 28-915
> >Fax : +49-89-54 88 28-88
> >
> >www.wearix.com
> >
> >
> >
> >
> >
> >
> >-------------------------------------------------------
> >This sf.net email is sponsored by:ThinkGeek
> >Welcome to geek heaven.
> >http://thinkgeek.com/sf
> >_______________________________________________
> >JBoss-user mailing list
> >[EMAIL PROTECTED]
> >https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
>_________________________________________________________________
>Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>JBoss-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>JBoss-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/jboss-user


_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband. 
http://resourcecenter.msn.com/access/plans/freeactivation.asp



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


-------------------------------------------------------
This SF.net email is sponsored by: ApacheCon, November 18-21 in
Las Vegas (supported by COMDEX), the only Apache event to be
fully supported by the ASF. http://www.apachecon.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to