Figured it out only a few minutes ago. Basically the classes are not in the WAR since they are from the actual JBoss libraries so it doesn't bind them. Rather than chase dependencies, I can just use the actual JNDI name in JBoss for this. Apparently when the ServletContextListener comes up, the registry is married with JBoss so I get all of jboss lookups as well. Starting to put my configs and other objects under java:app/ and I will let you know how it goes.
*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>* On Thu, Nov 21, 2013 at 1:45 AM, Claus Ibsen <[email protected]> wrote: > Not sure maybe the jboss jndi is read-only. And you need to pass in > some credentials or whatnot to be able to bind/update the jndi tree. > > I suggest to google/ask on jboss as forums etc about how to from java > to bind new objects in the jndi tree of the jboss server. > > > On Thu, Nov 21, 2013 at 7:38 AM, kraythe . <[email protected]> wrote: > > 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>* > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: [email protected] > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen >
