]
Eric Jung updated JBSEAM-2893:
------------------------------
Attachment: search.xhtml
components.xml
web.xml
Attaching search.xhtml, components.xml, web.xml
Thread-safety issues on Websphere with EM-injected components
-------------------------------------------------------------
Key: JBSEAM-2893
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2893
Project: Seam
Issue Type: Bug
Components: Platform interoperability
Affects Versions: 2.0.2.CR1, 2.1.0.A1
Environment: Websphere 6.1.0.13 with EJB Feature Pack on both Windows XP SP2 and
Solaris 9 (SunOS 5.9)
Reporter: Eric Jung
Attachments: components.xml, search.xhtml, web.xml
I'm attaching an extremely simple application that demonstrates thread-safety issues
with EntityManager / EntityManagerFactory in Websphere 6.1. This application has one
entity bean, one session bean, and one web page.
The problem is very easy to reproduce. Just start typing "e" in the search
field, which uses rich:suggestionbox, and very quickly press the search button. This
results in two queries being performed simultaneously--one from the rich:suggestionbox
keypress, and one from submitting the page's form. All 1000 rows of data begin with
"e" so the query is slow, making it easier to create queries that execute
simultaneously.
You'll get one of the following exceptions if you time things right (this isn't
difficult, just hit the search button very quickly--if you're too slow, both queries
will succeed without error):
"javax.ejb.ConcurrentAccessException: TX_METHOD_READY: wrong transaction"
or
"java.lang.IllegalStateException: could not acquire lock on @Synchronized component:
memberSearch"
I've tried this EAR with both Hibernate and OpenJPA as persistence providers, and
switched databases between Apache Derby and DB2. In all four permutations, I get the exact
same exceptions. That should rule out any JDBC driver or JPA implementation issues.
I suspect this problem is related to the issue mentioned in this blog post by Sahoo (a
Sun engineer):
http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html.
Unfortunately, WebSphere doesn't support servlets 2.5 so
<persistence-context-ref/> isn't available in web.xml. I tried the approach he
discusses in "Application Managed Entity Manager", but it hasn't yet
worked.
You can download a pre-built EAR (with source code included) at
http://www.mediafire.com/?tlxxgaj4qtm, but I'll be attaching source code and
configuration files here, too (can't attach the EAR directly since it's 11.6 MB
with all the required JARs).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: