HI:
I am using jboss3.2+tomcat4.1.
1. Test Client class
Properties prop=new Properties();
prop.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
prop.setProperty(Context.PROVIDER_URL, "jnp://jiangce:1099");
prop.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
InitialContext jndiContext = new InitialContext(prop);
DataSource dataSource = (DataSource)context.lookup("java:/KtsjkDS");
2. oracle-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- $Id: oracle-ds.xml,v 1.1.2.2 2003/04/01 04:51:12 d_jencks Exp $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Oracle originally from Steven Coy -->
<!-- ==================================================================== -->
<local-tx-datasource>
<jndi-name>KtsjkDS</jndi-name>
<connection-url>jdbc:oracle:thin:@jiangce:1521:ktsjk</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>jiangce</user-name>
hello
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>
3.Error
javax.naming.NameNotFoundException: KtsjkDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
You cannot lookup datasources directly from an external process. See http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=