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

wfenthusiast do-not-reply at jboss.com
Tue Aug 29 05:45:55 EDT 2006


sorry I had been trying to get the datasource using both OracleDS and was checking with MyDS and hence got the the code and stacktrace mixed up here's how its gotta look

15:57:43,414 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:name=MyDS,service=DataSourceBinding' to JNDI name 'java:MyDS'

InitialContext ctxt = new InitialContext();
  | Object o = ctxt.lookup("java:/MyDS");
  | DataSource ds = (DataSource) PortableRemoteObject.narrow(o, DataSource.class);

 javax.naming.NameNotFoundException: MyDS 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)

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>
  | 

thanks jaikiran for pointing that out but, I assure you its certainly not because of using mixed up names

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

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



More information about the jboss-user mailing list