I have an web application that is looking up DataSource's like they are 
provided in Tomcat[1]

The app tries to look them up like this:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/MyDS");

I have not managed to get this code working with JBoss 2.4.4-Tomcat. It 
keeps saying:

javax.naming.NamingException: Could not dereference object.  Root 
exception is java.lang.NullPointerException
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:418)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
[...]

My mbean looks like this:
    <mbean code="org.jboss.jdbc.JDBCDataSourceLoader" 
name="DefaultDomain:service=JDBCDataSource,name=jdbc/MyDS">
     <attribute name="PoolName">jdbc/MyDS</attribute>
     <attribute 
name="DataSourceClass">org.gjt.mm.mysql.MysqlDataSource</attribute> ...


I can change the code above to

DataSource ds = (DataSource)initCtx.lookup("java:/jdbc/MyDS");

and it will work. So, the problem narrows down to some JNDI magic!?


        Sven....





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to