Home
Analytics
JNDI in Weblogic
hseeram
Hello,
I am using BIRT 2.2.1 in Weblogic92. I am using report engine api to generate report within my weblogic application. It works fine with JDBC connection.
I see the following messages when I change the data source from jdbc to jndi:
Aug 5, 2008 3:18:51 PM org.eclipse.birt.report.data.oda.jdbc.JndiDataSource getConnection
INFO: javax.naming.NameNotFoundException: While trying to lookup 'comp:java.env/Birt-DS' didn't find subcontext 'comp:java'. Resolved ''; remaining name 'comp:java/env/Birt-DS'
Aug 5, 2008 3:18:51 PM org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager getJndiDSConnection
INFO: getJndiDSConnection: Unable to get JNDI data source connection; java.sql.SQLException: While trying to lookup 'comp:java.env/Birt-DS' didn't find subcontext 'comp:java'. Resolved ''
Aug 5, 2008 3:18:51 PM org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager loadAndRegisterDriver
INFO: Loading JDBC driver class: oracle.jdbc.driver.OracleDriver
Any idea, why birt fail to look up JNDI name?
Thanks
Hari
Find more posts tagged with
Comments
cypherdj
BIRT does not handle true JNDI, you don't provide the fully qualified name (comp:java/env/myDS), instead you would use java:myDS, as far as I know.
Cedric
hseeram
Okay Thank you. As you suggested I use java:myDS now it can look up the JNDI data source. But I am getting the following new exception while running the report
INFO: java.sql.SQLException: User: mydbuser, failed to be authenticated.
my xml file looks like below:
<property name="odaDriverClass">oracle.jdbc.OracleDriver</property>
<property name="odaURL">jdbc:oracle:thin:
@localhost
:1521:myDB</property>
<property name="odaUser">mydbuser</property>
<property name="odaPassword">c2JkYmEw</property>
<property name=odaJndiName>myDS</property>
Any idea why authentication is failed?
Any help would be appreciated.
cypherdj
Yes, it failed because when you are using the odaJndiName property, you should not include any other property. You should remove odaDriverClass, odaURL, odaUser, odaPassword.
Hope that helps,
Cedric
cypherdj
For example:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc " name="My_Data Source" id="26">
<property name="odaJndiName">java:MyDataSource</property>
</oda-data-source>
</data-sources>
</pre>
hseeram
Now I am in the state of total confusion. Assume I am a very typical user.<br />
I have very minimum knowledge on JNDI and my knowledge in weblogic also.<br />
If I don?t specify odauser and orapassword, what username and password does it use? <br />
<br />
The weblogic server startup failed when I included the following entries in the Weblogic domains config file. <br />
<data-sources><br />
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc " name="My_Data Source" id="26"><br />
<property name="odaJndiName">java:MyDataSource</property><br />
</oda-data-source><br />
</data-sources><br />
<br />
Please see the weblogic log below:<br />
<Aug 8, 2008 4:17:29 PM GMT> <Error> <Management> <BEA-141244> <Schema validation errors while parsing .configjdbc/birt-ds-jdbc.xml - Expected eleme<br />
nts 'properties@
http://www.bea.com/ns/weblogic/90
<a href='mailto:' title='E-mail Link' class='bbc_email'>password-encrypted@
http://www.bea.com</a>/ns/weblogic/90
<a href='mailto:' title='E-mail Link' class='bbc_email'>use-xa-data-source-interface@
http://www.bea.com</a><br
/>
/ns/weblogic/90' instead of 'data-sources@
http://www.bea.com/ns/weblogic/90'
here in element <a href='mailto:' title='E-mail Link' class='bbc_email'>jdbc-driver-params@
http://www.bea.com</a>/ns/weblogic/90><br
/>
<Aug 8, 2008 4:17:29 PM GMT> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason: [Management:141266]Parsing Failure in config.xml: weblog<br />
ic.management.ManagementRuntimeException: java.lang.RuntimeException: [Management:141245]Schema Validation Error in .configjdbc/birt-ds-jdbc.xml see<br />
log for details. Schema validation can be disabled by starting the server with the command line option: -Dweblogic.configuration.schemaValidationEnab<br />
led=false><br />
<Aug 8, 2008 4:17:29 PM GMT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED><br />
<Aug 8, 2008 4:17:30 PM GMT> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down><br />
<Aug 8, 2008 4:17:30 PM GMT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN><br />
<br />
<br />
Any help is greatly appreciated.<br />
<br />
Thanks
cypherdj
Well, ok, first of all, I don't use weblogic so I'm not sure I can help you with this part of the problem, but what you are trying to do, if I understand correctly, is to reuse an existing database connection (presumably pooled). This database connection is declared within your application, either in your hosting application server (tomcat/jboss). For example, in tomcat, you would typically declare this in conf/server.xml or conf/context.xml. This could also be declared simply within your web application, in this case, in WEB-INF/web.xml (weblogic may add its own files on top of this standard J2EE file). When your application server starts, this connection is initialised and a reference to it is stored (JNDI), with its name (in my example, MyDataSource).
This contains all the relevant info pertaining to the DB connection (user name, password, url, db driver...) and is shared within the entire application. Any (Java) part can look it up and use it.
So from a BIRT point of view, you're simply trying to get a handle on this reference. That is why you simply need to give the name (my example was MyDataSource) to BIRT.
All the error message you got is telling is if there is a JNDI DB connection, it sure is not called MyDataSource.
What you need to find out is what name is used and you should be in business from there on.
Kind regards,
Cedric
cypherdj
I'm not sure whether you actually managed to get this working, but I eventually gave this a try. First of all, though this should be taken care of by the container, you still need to provide the driver class, and a URL, though this can be anything you want as it's ignored.<br />
<br />
I had to hack into the actual XML, as the report designer was leaving the username and password even when I blanked it out.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="myDataSource" id="6"
extends="showcaseDS.showcase56devapp">
<property name="odaDriverClass">oracle.jdbc.driver.OracleDriver</property>
<property name="odaURL">jdbc:oracle:thin:
@localhost
:1521:local10g</property>
<property name="odaJndiName">java:comp/env/jdbc/reportingDS</property>
</oda-data-source>
</pre>
<br />
In my case, I have a JNDI data source defined in tomcat/conf/server.xml as follows:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<Resource name="jdbc/reportingDS" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="myUsername"
password="myPassword"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:
@myHost
:1521:mySchema"
/>
</pre>
<br />
Hope that helps,<br />
Cedric