[seam-commits] Seam SVN: r12240 - modules/faces/trunk/src/main/java/org/jboss/seam/faces/event.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Mar 22 15:50:15 EDT 2010
Author: nickarls
Date: 2010-03-22 15:50:14 -0400 (Mon, 22 Mar 2010)
New Revision: 12240
Modified:
modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java
Log:
look for BeanManager in some more exotic (JBoss) locations
Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java 2010-03-22 19:44:00 UTC (rev 12239)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java 2010-03-22 19:50:14 UTC (rev 12240)
@@ -1,15 +1,29 @@
package org.jboss.seam.faces.event;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+ at SuppressWarnings("serial")
public class GenericEventListener
{
+
@Inject
BeanManager beanManager;
+ // FIXME: hack to work around invalid binding in JBoss AS 6 M2
+ private static final List<String> beanManagerLocations = new ArrayList<String>()
+ {
+ {
+ add("java:comp/BeanManager");
+ add("java:app/BeanManager");
+ }
+ };
+
protected BeanManager getBeanManager()
{
if (beanManager == null)
@@ -21,13 +35,17 @@
private BeanManager lookupBeanManager()
{
- try
+ for (String location : beanManagerLocations)
{
- return beanManager = (BeanManager) new InitialContext().lookup("java:comp/BeanManager");
+ try
+ {
+ return (BeanManager) new InitialContext().lookup(location);
+ }
+ catch (NamingException e)
+ {
+ // No panic, keep trying
+ }
}
- catch (NamingException e)
- {
- throw new IllegalArgumentException("Could not find BeanManager in JNDI", e);
- }
+ throw new IllegalArgumentException("Could not find BeanManager in " + beanManagerLocations);
}
}
More information about the seam-commits
mailing list