geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: jndi datasource access problem
Date Mon, 02 Mar 2009 16:13:13 GMT

On Mar 2, 2009, at 7:30 AM, Kaupo wrote:

> I have configured a datasource in my application, but i have problems
> accessing it when when I connect to my application through a  
> webservice and
> try to use it!
> I get the following error:
> "java.lang.NullPointerException: You have accessed the java:comp jndi
> context on a thread that has not initialized it"
> The code that is use:
> InitialContext ctx = new InitialContext();
> DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ 
> MyDataSource");
> con = ds.getConnection();

This is reasonable code in a javaee component inside the server.   
Could you provide a complete stack trace?
> I read here
>  that one can access the
> resources by using the "jca:{groupId}/{artifactId}/{j2eeType}/{name}"
> notation, but I'm having a hard time figuring out the j2eeType part.
> How do I know what to put instead of j2eeType?

If you look in var/log/geronimo.log the jndi locations are logged as  
the comonents start up.  I prefer to look at these rather than try to  
remember which j2eeType is in use.

david jencks

> -- 
> View this message in context:
> Sent from the Apache Geronimo - Users mailing list archive at  

View raw message