Home
Analytics
JNDI under JBoss
lenburt
Hello out there -- i am trying to get our reports working under JBoss 5.1 using the 2.6.2 BIRT Web Viewer. The reports and JNDI lookup works fine under WebLogic and WebSphere. Under JBoss, the reports just seem to hang on the JNDI lookup. We are using Oracle on the back end and from the JBoss console the JNDI config looks ok. I am trying to test the JNDI lookup outside of BIRT but i wnated to see if there were any know issues with JNDI and BIRT under JBoss.
regards, len
Find more posts tagged with
Comments
JasonW
This should work in BIRT. How did you setup JNDI on JBoss?
Jason
lenburt
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="100229" data-time="1336665088" data-date="10 May 2012 - 08:51 AM"><p>
This should work in BIRT. How did you setup JNDI on JBoss?<br />
<br />
Jason<br /></p></blockquote>
<br />
Jason - in our reports we have this -> <property name="odaJndiName">dashboard.txDataSource</property><br />
<br />
I have tried many JNDI config settings but this is one based on their example:<br />
<br />
<br />
<br />
<!-- ===================================================================== --><br />
<!-- --><br />
<!-- JBoss Server Configuration --><br />
<!-- --><br />
<!-- ===================================================================== --><br />
<br />
<!-- See <a class='bbc_url' href='
http://www.jboss.org/community/wiki/Multiple1PC'>http://www.jboss.org/community/wiki/Multiple1PC</a>
; for information about local-tx-datasource --><br />
<!-- $Id: oracle-ds.xml 88948 2009-05-15 14:09:08Z jesper.pedersen $ --><br />
<!-- ==================================================================== --><br />
<!-- Datasource config for Oracle originally from Steven Coy --><br />
<!-- ==================================================================== --><br />
<br />
<br />
<datasources><br />
<local-tx-datasource><br />
<jndi-name>dashboard.txDataSource</jndi-name><br />
<connection-url>jdbc:oracle:thin:
@mlincacsdb01
:1521:CACSLDEV</connection-url><br />
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class><br />
<user-name>cacs</user-name><br />
<password>baseline</password><br />
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool --><br />
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name--><br />
<!-- Checks the Oracle error codes and messages for fatal errors --><br />
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name><br />
<!-- sql to call when connection is created<br />
<new-connection-sql>some arbitrary sql</new-connection-sql><br />
--><br />
<br />
<!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered<br />
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql><br />
--><br />
<br />
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --><br />
<metadata><br />
<type-mapping>Oracle9i</type-mapping><br />
</metadata><br />
</local-tx-datasource><br />
<br />
</datasources>
JasonW
I do not see anything obvious that is wrong. Were you able to get it working outside of BIRT? Here is an article Virgil and I wrote a couple years ago on JBoss and BIRT and it has a section on connection pooling.
http://www.birt-exchange.org/org/devshare/deploying-birt-reports/1055-using-the-birt-viewer-with-jboss/
Jason
lenburt
After turning up debug i now see that the JNDI name is not getting resolved for some reason.
FINER: RETURN null
May 12, 2012 10:49:53 AM org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager
INFO: getJndiDSConnection: Unable to get JNDI data source connection; java.sql.SQLException: dashboard.txDataSource not bound
I see some posts out there that imply i need other entries in web.xml and jboss-web.xml --- are these necessary to have BIRT do a JNDI lookup under JBoss?
Examples:
*-ds.xml excerpt:
<jndi-name>jdbc/SomeDS</jndi-name>
web.xml excerpt:
<resource-ref>
<res-ref-name>jdbc/TheDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
jboss-web.xml:
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/TheDS</res-ref-name>
<jndi-name>java:jdbc/SomeDS</jndi-name>
</resource-ref>
</jboss-web>
JasonW
I set mine up this way:
<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>root</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
In the report I use:
java:/MySqlDS
as my JNDI property.
Jason
lenburt
Jason - yes, the resolution seems to be that for the JNDI lookup to work within JBoss, the report property needs to have the prefix 'java:/'. In WebSphere, the name in the report must exactly match the JNDI named defined thru the console. We can live with this; i must confess i do not really understand the intricacies of the JNDI context but at least i have something that works in both app server containers. Thanks for the help. The document you pointed me to gave me some tips about web.xml settings i find useful. -- len
delee88
In my BIRT report I am finding that when the report is deplyed to JBOSS, the JNDI connection is trying to use the userid and password entered on the datasource in the report. Has anyone run into this? I get an Oracle invalid username/password error. If I use the same database, userid, and password on the JNDI connections as I do in the report, the JNDI connection is made and I can see from the JBOSS Admin console as connectiods are allocated and dropped from the connect pool. In the BIRT report the JNDI URL is java:ORCL or java:/ORCL. Using either version the JNDI connection wil attempt to
connect. Anything else does not make an attempt at all.
Any help would be appreciated.