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