problem-configure-jboss-to-work-with-jndi(3)

Posted by Spiderman on Stack Overflow See other posts from Stack Overflow or by Spiderman
Published on 2010-05-17T07:50:47Z Indexed on 2010/05/17 8:20 UTC
Read the original article Hit count: 210

Filed under:
|
|

Sorry for opening new thread every time for the same problem. It's just that I'd like to refine my question during my investigation and it's hard to do it in stackoverflow structure on the same question (maybe on purpose). Anyway, in continuation to this thread
http://stackoverflow.com/questions/2843218/problem-configure-jboss-to-work-with-jndi2 I discovered that when running an application that is deployed on my JBoss 4.2.3.GA, when I perform:

Context initialContext = new InitialContext();
Object dataSource = initialContext.lookup("java:/DefaultDS");

I get null as a return value even though DefaultDS is the default datasource that comes with Jboss installation.
and generally, how come initialContext return null value? if the datasource is not found it should throw NamingException and in other case it should return real object. What can I do with null? isn't it a bad error handling of javax.naming.InitialContext ???

© Stack Overflow or respective owner

Related posts about java

Related posts about jboss