[
https://issues.jboss.org/browse/WFLY-3203?page=com.atlassian.jira.plugin....
]
David Lloyd updated WFLY-3203:
------------------------------
Description:
Given a set of simple jndi bindings like the following:
{code:xml}
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<simple name="java:global/NSPDomain" value="domain"
type="java.lang.String"/>
<simple name="java:global/NSPURL"
value="http://red-hat-summit.cloudapp.net:8081/"
type="java.net.URL"/>
<simple name="java:global/NotificationCallbackURL"
value="http://dmz.starkinternational.com:8080/iotbof-web/rest/events/send"
type="java.net.URL"/>
</bindings>
<remote-naming/>
</subsystem>
{code}
The following works from an EJB:
{code}
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Singleton
@Startup
public class NSPConnector {
...
@Resource(name = "java:global/NotificationCallbackURL")
private URL notificationURL;
{code}
but fails with a NameNotFoundException when used from within a JSF managed bean.
{code}
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
@Named("nspmodel")
@ApplicationScoped
public class NSPModel {
private static Logger logger = Logger.getLogger(NSPModel.class);
@Resource(name = "java:global/NotificationCallbackURL")
private URL notificationURL;
{code}
Has the following error when accessed:
{noformat}
Caused by: javax.naming.NameNotFoundException: env/java:global/NotificationCallbackURL --
service
jboss.naming.context.java.module.iot-ear.iotbof-web.env.java:global.NotificationCallbackURL
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0]
at
org.jboss.as.weld.services.bootstrap.WeldResourceInjectionServices.resolveResource(WeldResourceInjectionServices.java:185)
[wildfly-weld-8.0.0.Final.jar:8.0.0.Final]
... 71 more
{noformat}
was:
Given a set of simple jndi bindings like the following:
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<simple name="java:global/NSPDomain" value="domain"
type="java.lang.String"/>
<simple name="java:global/NSPURL"
value="http://red-hat-summit.cloudapp.net:8081/"
type="java.net.URL"/>
<simple name="java:global/NotificationCallbackURL"
value="http://dmz.starkinternational.com:8080/iotbof-web/rest/events/send"
type="java.net.URL"/>
</bindings>
<remote-naming/>
</subsystem>
The following works from an EJB:
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Singleton
@Startup
public class NSPConnector {
...
@Resource(name = "java:global/NotificationCallbackURL")
private URL notificationURL;
but fails with a NameNotFoundException when used from within a JSF managed bean.
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
@Named("nspmodel")
@ApplicationScoped
public class NSPModel {
private static Logger logger = Logger.getLogger(NSPModel.class);
@Resource(name = "java:global/NotificationCallbackURL")
private URL notificationURL;
Has the following error when accessed:
Caused by: javax.naming.NameNotFoundException: env/java:global/NotificationCallbackURL --
service
jboss.naming.context.java.module.iot-ear.iotbof-web.env.java:global.NotificationCallbackURL
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0]
at
org.jboss.as.weld.services.bootstrap.WeldResourceInjectionServices.resolveResource(WeldResourceInjectionServices.java:185)
[wildfly-weld-8.0.0.Final.jar:8.0.0.Final]
... 71 more
Assignee: Stuart Douglas (was: David Lloyd)
Component/s: CDI / Weld
(was: EJB)
(was: JSF)
I think this is actually a Weld issue, judging from the stack trace.
Inconsistent handling of @Resource for URL in EJB vs JSF managed
bean
---------------------------------------------------------------------
Key: WFLY-3203
URL:
https://issues.jboss.org/browse/WFLY-3203
Project: WildFly
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: CDI / Weld
Affects Versions: 8.0.0.Final
Environment: [standalone 526]$
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
Reporter: Scott Stark
Assignee: Stuart Douglas
Given a set of simple jndi bindings like the following:
{code:xml}
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<simple name="java:global/NSPDomain"
value="domain" type="java.lang.String"/>
<simple name="java:global/NSPURL"
value="http://red-hat-summit.cloudapp.net:8081/"
type="java.net.URL"/>
<simple name="java:global/NotificationCallbackURL"
value="http://dmz.starkinternational.com:8080/iotbof-web/rest/events/send"
type="java.net.URL"/>
</bindings>
<remote-naming/>
</subsystem>
{code}
The following works from an EJB:
{code}
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Singleton
@Startup
public class NSPConnector {
...
@Resource(name = "java:global/NotificationCallbackURL")
private URL notificationURL;
{code}
but fails with a NameNotFoundException when used from within a JSF managed bean.
{code}
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
@Named("nspmodel")
@ApplicationScoped
public class NSPModel {
private static Logger logger = Logger.getLogger(NSPModel.class);
@Resource(name = "java:global/NotificationCallbackURL")
private URL notificationURL;
{code}
Has the following error when accessed:
{noformat}
Caused by: javax.naming.NameNotFoundException: env/java:global/NotificationCallbackURL --
service
jboss.naming.context.java.module.iot-ear.iotbof-web.env.java:global.NotificationCallbackURL
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at
org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
[wildfly-naming-8.0.0.Final.jar:8.0.0.Final]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0]
at
org.jboss.as.weld.services.bootstrap.WeldResourceInjectionServices.resolveResource(WeldResourceInjectionServices.java:185)
[wildfly-weld-8.0.0.Final.jar:8.0.0.Final]
... 71 more
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira