Hello Sven,

you have to declare resource-ref in jboss-web.xml. The excerpt from
jboss-web_3_0.dtd explains:
<!--The resource-ref element maps from the servlet ENC relative name
of the resource-ref to the deployment environment JNDI name of
the resource manager connection factory.
Example:
    <resource-ref>
        <res-ref-name>jdbc/TheDataSource</res-ref-name>
        <jndi-name>java:/DefaultDS</jndi-name>
    </resource-ref>
-->
The same is right for jboss-web.dtd.

alex

Thursday, July 04, 2002, 1:33:01 AM, you wrote:

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

SK> The app tries to look them up like this:

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

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

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

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


SK> I can change the code above to

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

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


SK>         Sven....





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

-- 
Best regards,
 Alex Loubyansky




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to