I have the following code in my project:

    System.out.println(">>>>>>>>>> " +
config.analyticsDatasourceJNDIName());

    System.out.println(String.format(">>>>>>>>>> %s = %s",
KEY_ANALYTICS_DATASOURCE,
ictxt.lookup(config.analyticsDatasourceJNDIName())));

    registry.bind(KEY_ANALYTICS_DATASOURCE,
ictxt.lookup(config.analyticsDatasourceJNDIName()));

    System.out.println(String.format(">>>>>>>>>> %s = %s",
KEY_ANALYTICS_DATASOURCE, registry.lookup(KEY_ANALYTICS_DATASOURCE)));

This code gets run when the web app comes up. Yet when I run the code in
JBoss this is the output I see;

[Server:Local01] 00:27:48,173 INFO  [stdout] (ServerService Thread Pool --
153) >>>>>>>>>> java:jboss/datasources/analytics
[Server:Local01] 00:27:48,174 INFO  [stdout] (ServerService Thread Pool --
153) >>>>>>>>>> analytics =
org.jboss.jca.adapters.jdbc.WrapperDataSource@604be04
[Server:Local01] 00:27:48,175 INFO  [stdout] (ServerService Thread Pool --
153) >>>>>>>>>> analytics = null

This is perplexing to say the least. I immediately look up the same key I
just bound and I get a null as a result. Any ideas why this might be
happening?

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*

Reply via email to