WebSphere Application Server - Problem in locating jndi datasource in WebSphere Application Server

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > March 2007 > Problem in locating jndi datasource in WebSphere Application Server





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Problem in locating jndi datasource in WebSphere Application Server

2007-03-26, 1:23 pm

Hi All,

I am facing a problem in WebSphere Application Server when using jdbc datasource.
I have created JDBC datasource named "jdbc/myDataSource".
Code i use:-

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.Websphere.naming.WsnInitialContextFactory");
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("jdbc/myDataSource");

This works fine but gives warning in the server logs as:-
"I J2CA0122I: Resource reference jdbc/myDataSource could not be located, so default values of the following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)

I J2CA0107I: Component-managed authentication alias not specified for connection factory or Data Source myDataSource."

If i use
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/myDataSource");
it gives error as:
Name comp/env/jdbc not found in context "java:".

I referred this link :- http://www.webspherepower.com/issue...0/00001357.html

It says that i should create alias and use it. But i dont have WebSphere Studio Application Developer. So how do i create one???

I tried putting this in web.xml of my application
<resource-ref id="ResourceRef_1042443188222">
<res-ref-name>jdbc/myDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

and in ibm-web-bnd.xmi (binding)
<resRefBindings xmi:id="ResourceRefBinding_1042448130198" jndiName="jdbc/myDataSource">
<bindingResourceRef href="META-INF/web.xml#ResourceRef_1042443188222"/>
</resRefBindings>

Still didnt solved my problem.Please help me..



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com