problem configure JBoss to work with JNDI(2)
Posted
by Spiderman
on Stack Overflow
See other posts from Stack Overflow
or by Spiderman
Published on 2010-05-16T09:40:34Z
Indexed on
2010/05/16
9:50 UTC
Read the original article
Hit count: 251
in continuation to the question from last week: http://stackoverflow.com/questions/2828237/problem-configure-jboss-to-work-with-jndi
I'm trying to bind datasource in JBoss and use it in my application. In my struggling, I already managed to avoid the javax.naming.NameNotFoundException by:
1. using in java new InitialContext().lookup(connection);
instead of new JndiObjectFactoryBean().setJndiName(connection);
2. changing the connection name from: 'jndi-name' to 'java:jndi-name'
Now the problem is that the datasouce that I get from the lookup is null. I created the datsource file:
<datasources>
<local-tx-datasource>
<jndi-name>bilby</jndi-name>
<connection-url>jdbc:oracle:myURL</connection-url>
<driver-class>oracle.jdbc.OracleDriver </driver-class>
<user-name>myUsername</user-name>
<password>myPassword</password>
<exception-sorter-class- name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
and put it under \server\default\deploy\oracle-ds.xml
I get during runtime the line:
18:37:56,560 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb oss.jca:service=DataSourceBinding,name=bilby' to JNDI name 'java:bilby'
So my question is - why do I get null as my datasource???
© Stack Overflow or respective owner