tags:

views:

58

answers:

0

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 ???