[jboss-user] [JNDI/Naming/Network] - JNDI datasource not available in one webapp while its availa

wfenthusiast do-not-reply at jboss.com
Wed Aug 23 06:47:33 EDT 2006


Hi,
    I have a datasource configured using myds-ds.xml in jboss and when starting up it gets bound.
15:57:43,414 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:name=MyDS,service=DataSourceBinding' to JNDI name 'java:MyDS'
     But I'm not able to access this datasource through the usual context lookup
InitialContext ctxt = new InitialContext();
  | Object o = ctxt.lookup("java:/OracleDS");
  | DataSource ds = (DataSource) PortableRemoteObject.narrow(o, DataSource.class);
     I get the following exception.
 javax.naming.NameNotFoundException: OracleDS not bound
  |      at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
  |      at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
  |      at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
  |      at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
  |      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
  |      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
  |      at javax.naming.InitialContext.lookup(InitialContext.java:347)
  |      at org.foo.bar.db.DataSourceAccess.retrieveDataSource(DataSourceAccess.java:143)

    But, just to test out I created another test webapp and tried to get the datasource in a simple JSP page using the same code. It worked. What did I do wrong. I even tried adding resource-ref, resource-env-ref entries to my web.xml. I'm stumped.


Heres my datasource config file
myds-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
  | <datasources>
  | 	<local-tx-datasource>
  | 		<jndi-name>MyDS</jndi-name>
  | 		<connection-url>jdbc:oracle:thin:@oradev:1521:dev</connection-url>
  | 		<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
  | 		<user-name>dev</user-name>
  | 		<password>dev</password>
  | 		<exception-sorter-class-name>
  | 			org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
  | 		</exception-sorter-class-name>
  | 		<min-pool-size>10</min-pool-size>
  | 		<max-pool-size>50</max-pool-size>
  | 		<idle-timeout-minutes>10</idle-timeout-minutes>
  | 		<track-statements>true</track-statements>
  | 		<metadata>
  | 			<type-mapping>Oracle10g</type-mapping>
  | 		</metadata>
  | 	</local-tx-datasource>
  | </datasources>
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966922#3966922

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966922



More information about the jboss-user mailing list