Lookup for DataSource failing--Please Help
russray Nov 19, 2006 9:21 PMI have port over my application to JBoss. I am confrigured most to the application server, but I am getting an error when the application attempts to make a connection to the DataSource. This is the error:
19:00:39,872 ERROR [STDERR] Looking up DataSource: jdbc/pidbdev 19:00:39,872 ERROR [STDERR] javax.naming.NameNotFoundException: jdbc not bound
this is the code:
try { System.err.println("Looking up DataSource: "+ name); ds = (DataSource) context.lookup(name); this.dataSourceCache.put(name, ds); } catch (NamingException ne) { ne.printStackTrace(); }
This is how I have my DataSource (*-ds.xml) configured:
<datasources> <xa-datasource> <jndi-name>jdbc/pidbdev</jndi-name> <track-connection-by-tx/> <isSameRM-override-value>false</isSameRM-override-value> <xa-datasource-class>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</xa-datasource-class> <xa-datasource-property name="ServerName">me_server</xa-datasource-property> <xa-datasource-property name="DatabaseName">me_db</xa-datasource-property> <xa-datasource-property name="SelectMethod">cursor</xa-datasource-property> <xa-datasource-property name="User">p1</xa-datasource-property> <xa-datasource-property name="Password">p1</xa-datasource-property> <min-pool-size>5</min-pool-size> <max-pool-size>20</max-pool-size> <metadata> <type-mapping>MS SQLSERVER2000</type-mapping> </metadata> <check-valid-connection-sql>SELECT * FROM invalidate</check-valid-connection-sql> </xa-datasource> </datasources>
This is my web.xml
<resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/pidbdev</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
This is my jboss-web.xml
<jboss-web> <resource-ref> <res-ref-name>jdbc/pidbdev</res-ref-name> <jndi-name>java:/pidbdev</jndi-name> </resource-ref> </jboss-web>
When I go back and look at how my dataSource is connection, I discover the DataSource log statement:
19:46:04,927 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/pidbdev' to JNDI name 'java:jdbc/pidbdev' 19:46:05,615 WARN [TransactionImpl] XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=rray-wxp/1, BranchQual=, localId=1] errorCode=XAER_RMERR javax.transaction.xa.XAException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]xa_commit (40000000) returns -4
I am let to believe the DataSource is setup properly, but for some reason, the JNDI is not.
Any suggestions would be much appreciated.
Thanks for reading my post.
Russ