I haven't ever encountered this problem, and I'm pretty certain it hasn't been fixed in 2.2.2... that being said, the runtime itself isn't multithreaded. If I were going to take a off the cuff guess, I'd wager there is some odd interaction going on with the aries container.
> Once this has occurred, the only way to recovery is a platform restart. That is a very interesting comment. It doesn't make much sense that this sort of an exception on EM.clear() would be persistent. On Tue, Apr 14, 2015 at 6:30 AM, Raimund Klein <raimund.kl...@monitise.com> wrote: > Hi all, > > > > We are using OpenJPA 2.2.0 as part of our JBoss Fuse installation. Every > couple of months we run into a stack trace such as this one: > > > > Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal general error> > org.apache.openjpa.persistence.PersistenceException: Illegal Capacity: -12 > at org.apache.openjpa.kernel.BrokerImpl.detachAll(BrokerImpl.java:3407) > at > org.apache.openjpa.kernel.DelegatingBroker.detachAll(DelegatingBroker.java:1206) > at > org.apache.openjpa.persistence.EntityManagerImpl.clear(EntityManagerImpl.java:1169) > at > org.apache.aries.jpa.container.impl.EntityManagerWrapper.clear(EntityManagerWrapper.java:49) > at > org.apache.aries.jpa.container.context.transaction.impl.SynchronizedEntityManagerWrapper.clear(SynchronizedEntityManagerWrapper.java:113) > at > org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.createNamedQuery(JTAEntityManager.java:315) > [...] > > ... 90 more > Caused by: java.lang.IllegalArgumentException: Illegal Capacity: -12 > at java.util.ArrayList.<init>(ArrayList.java:142)[:1.7.0_55] > at org.apache.openjpa.kernel.ManagedCache.copy(ManagedCache.java:259) > at > org.apache.openjpa.kernel.BrokerImpl.getManagedStates(BrokerImpl.java:4054) > at > org.apache.openjpa.kernel.BrokerImpl.detachAllInternal(BrokerImpl.java:3418) > at org.apache.openjpa.kernel.BrokerImpl.detachAll(BrokerImpl.java:3403) > ... 101 more > > > > Once this has occurred, the only way to recovery is a platform restart. > > > > Our impression is that this is a multithreading issue inside OpenJPA. > Hoping for the best, we've upgraded to 2.2.2 just now and will test with > this one, but I'd just like to know if anyone has encountered this before > and maybe can help us with an idea what's going here? We scanned the recent > release notes, but haven't found anything like this mentioned. > > > > > > Kind regards > > > > *Raimund Klein* > *Technical Architect* > > t. +44 (0)203 657 0481 > raimund.kl...@monitisegroup.com > > > > [image: > http://mailmedia.monitisegroup.com/MonitiseUpdate/Images/Email_logo.gif] > *www.monitisegroup.com* <http://www.monitisegroup.com/> > [image: > http://mailmedia.monitisegroup.com/NewsletterImages/youtube_sig.gif] > <http://www.youtube.com/user/MonitiseGroup>[image: > http://mailmedia.monitisegroup.com/MonitiseUpdate/Images/linked_in_sig.gif] > <http://www.linkedin.com/company/monitise>[image: > http://mailmedia.monitisegroup.com/MonitiseUpdate/Images/twitter_sig.gif] > <http://twitter.com/#!/MonitiseGroup> > > > > ------------------------------ > > This message contains confidential and proprietary information of the > sender, and is intended only for the person(s) to whom it is addressed. Any > use, distribution, copying, disclosure or taking of any action in reliance > upon it by any other person is strictly prohibited. If you have received > this message in error, please notify the e-mail sender immediately, and > delete the original message without making a copy. Monitise accepts no > liability if this email harms any systems or data of the recipient > (including as a result of software virus infection or where this e-mail is > modified or amended in any way during or following transmission) or if this > email is accessed by anyone other than the person(s) to whom it is > addressed. > > The Monitise group includes Monitise plc (Reg. No. 6011822), Monitise > Group Limited (Reg. No. 5590897), Monitise International Limited (Reg. No. > 5556711), Monitise Europe Limited (Reg. No. 4831976) and Mobile Money > Network Limited (Reg. No. 7153130). These companies are registered in > England and Wales and their registered office address is 95 Gresham Street, > London, EC2V 7NA United Kingdom. > > > ------------------------------ > This email message has been delivered safely and archived online by > Mimecast. > For more information please visit http://www.mimecast.com > ------------------------------ > -- *Rick Curtis*