<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I think we should instead change the exception from NamingException to NameNotFoundException in WildFly, which is the exception type thrown by the Java EE 7 RI. I’ve tested such change and introduces no issues in the testsuite. And after such change Seam seems to work fine, at least the build/test issue is gone for the branch referenced in the issue.<div><br></div><div>If nobody disagrees I will create an issue and submit the PR.</div><div><br></div><div>—E<div><div><div><br><div><div>On 27 Feb 2014, at 13:32, Scott Marlow &lt;<a href="mailto:smarlow@redhat.com">smarlow@redhat.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On 02/26/2014 08:05 PM, Scott Marlow wrote:<br><blockquote type="cite">On 02/26/2014 11:04 AM, Scott Marlow wrote:<br><blockquote type="cite">On 02/26/2014 02:02 AM, Jaikiran Pai wrote:<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Right the real question is what is Seam using the UT for. There is<br></blockquote></blockquote>only one method on that is “safe” with CMT (getting the status), and<br>that isn’t all that useful.<br><br>Looking at that stacktrace [1] and the code in Seam [2], it appears that<br>Seam wants to register a transaction synchronization if a transaction is<br>active. Unfortunately, a lot of libraries (including Seam) use the<br>UserTransaction API (UserTransaction.getStatus()) to check if a<br>transaction is active. The right way to do it is using the<br>TransactionSynchronizationRegistry which is available and portable (as<br>mandated by spec) under the java:comp/TransactionSynchronizationRegistry<br>JNDI name. The TransactionSynchronizationRegistry has a<br>getTransactionStatus() method which can be used to check the transaction<br>status in the current (thread) context<br><a href="http://docs.oracle.com/javaee/5/api/javax/transaction/TransactionSynchronizationRegistry.html#getTransactionStatus%28%29">http://docs.oracle.com/javaee/5/api/javax/transaction/TransactionSynchronizationRegistry.html#getTransactionStatus%28%29</a>.<br>Usage of this API is rarely explained and applications/libraries keep<br>using UserTransaction instead.<br><br>To answer the other question as to why this started showing up now and<br>not in earlier versions, the code in Seam tries to deal with this exact<br>situation by catching a specific (NameNotFoundException) while doing a<br>UserTransaction lookup [3]. Notice that in that code [3], it doesn't<br>deal with any other exception other than NameNotFoundException although<br>that code does realize that using UserTransaction for what it's doing<br>can run into problems (the comments there indicate something along those<br>lines). So my guess is that, in previous version of AS, we used to throw<br>a NameNotFoundException in this specific case and now we are throwing a<br>IllegalStateException [4]. Maybe in WildFly, to prevent existing<br>libraries like Seam from breaking, we could just change this bit to<br>throw NameNotFoundException instead of IllegalStateException (although I<br>don't remember if the TCK tests for the exact exception type in this case).<br></blockquote><br>Should we catch the ISE somewhere in [5] and throw a<br>NameNotFoundException (with the ISE as the cause) instead of the ISE? &nbsp;I<br>wonder if we did that before in the AS5/AS6 naming code.<br></blockquote><br>A better question is whether we could throw a NameNotFoundException<br>instead of a NamingException.<br></blockquote><br>The above change would help Seam applications to work on WildFly 8.0.1.<br><br>If we change Seam to catch a NamingException instead of<span class="Apple-converted-space">&nbsp;</span><br>NameNotFoundException, the newer Seam release, would work with WildFly<span class="Apple-converted-space">&nbsp;</span><br>8.0.0 (should also work against earlier app server versions I think).<br><br><blockquote type="cite"><br><blockquote type="cite"><br>[5]<br><br>at<br>org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:142)<br>at<br>org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:81)<br>at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)<br>at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)<br>at<br>org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)<br>at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)<br>at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)<br>at javax.naming.InitialContext.lookup(InitialContext.java:411)<br>[rt.jar:1.7.0_51]<br>at javax.naming.InitialContext.lookup(InitialContext.java:411)<br>[rt.jar:1.7.0_51]<br>at<br>org.jboss.seam.transaction.Transaction.getUserTransaction(Transaction.java:82)[jboss-seam.jar:2.2.2.Final]<br><br><blockquote type="cite"><br><br>[1]<br><br><span class="Apple-tab-span" style="white-space: pre;">        </span>at org.jboss.seam.transaction.Transaction.instance(Transaction.java:39) [jboss-seam.jar:2.2.2.Final]<br><span class="Apple-tab-span" style="white-space: pre;">        </span>at org.jboss.seam.persistence.ManagedPersistenceContext.joinTransaction(ManagedPersistenceContext.java:120) [jboss-seam.jar:2.2.2.Final]<br><span class="Apple-tab-span" style="white-space: pre;">        </span>at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:112) [jboss-seam.jar:2.2.2.Final]<br><br><br>[2] <a href="http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.seam/jboss-seam/2.2.2.Final/org/jboss/seam/persistence/ManagedPersistenceContext.java#118">http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.seam/jboss-seam/2.2.2.Final/org/jboss/seam/persistence/ManagedPersistenceContext.java#118</a><br><br>[3] <a href="http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.seam/jboss-seam/2.2.2.Final/org/jboss/seam/transaction/Transaction.java#77">http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.seam/jboss-seam/2.2.2.Final/org/jboss/seam/transaction/Transaction.java#77</a><br><br>[4] Caused by: java.lang.IllegalStateException: JBAS014237: Only session and message-driven beans with bean-managed transaction demarcation are allowed to access UserTransaction<br><br>P.S: A big congratulations on the WildFly 8.0 Final release! :) Although haven't posted here so far, I've been lurking this list. Good luck with the next releases.<br></blockquote><br>Big congratulations to you also Jaikiran, you are always part of the<br>team! &nbsp;:)<br><br>Thanks for helping with this issue!<br><br>Scott<br><br><blockquote type="cite"><br><br>-Jaikiran<br><br>_______________________________________________<br>wildfly-dev mailing list<br><a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/wildfly-dev<br><br></blockquote><br>_______________________________________________<br>wildfly-dev mailing list<br><a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/wildfly-dev<br><br></blockquote><br>_______________________________________________<br>wildfly-dev mailing list<br><a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/wildfly-dev<br><br></blockquote><br>_______________________________________________<br>wildfly-dev mailing list<br><a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a></div></blockquote></div><br></div></div></div></div></body></html>