Cannot look jndi name in jBoss..pls help

R

r.kalaimathi

hi,
im using jboss4.0.1 with MyEclipse3.0.8.
im trying to configure jboss with db2 and also looking up jndi name..
for this i did some of the procedures.
in db2-ds.xml i mapped as


<local-tx-datasource>
<jndi-name>DB2DS</jndi-name>
<connection-url>jdbc:db2://thapovan1:50000/EMPLOYEE</connection-url>
<driver-class>COM.ibm.db2.jdbc.DB2Driver</driver-class>
<user-name>administrator</user-name>
thapovan
<min-pool-size>0</min-pool-size>


<type-mapping>DB2</type-mapping>

</local-tx-datasource>

In login-config.xml file i mapped as

<application-policy name = "DB2DbRealm">

<login-module code
="org.jboss.resource.security.ConfiguredIdentityLoginModule"

flag = "required">
<module-option name = "principal"></module-option>
<module-option name = "userName"></module-option>
<module-option name = "password"></module-option>
<module-option name
="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DB2DS

</module-option>
</login-module>

</application-policy>


In jboss-web.xml i mapped as


<jboss-web>
<resource-ref>
<res-ref-name>DB2DS</res-ref-name>
<jndi-name>java:DB2DS</jndi-name>
</resource-ref>
</jboss-web>


In web.xml


<web-app>
<resource-ref>
DB Connection
<res-ref-name>DB2DS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>


and finally in my java code im looking up jndi name as

java.util.Properties pro=new java.util.Properties();
pro.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
pro.put(Context.URL_PKG_PREFIXES","org.jboss.naming:eek:rg.jnp.interfaces");
pro.put(Context.PROVIDER_URL, "localhost:1099");

ctxt=new InitialContext(pro);
System.out.println("context "+ctxt);
DataSource ds = (DataSource)ctxt.lookup("java:DB2DS");

DB2DS is my jndi name.i dont know where am i making mistake..will you
please give me the solution for this..

thanks and regards,
kalaimathi
 
W

Wesley Hall

DataSource ds = (DataSource)ctxt.lookup("java:DB2DS");

Change the lookup to "java:comp/env/DB2DS"

Assuming you have everything else set up correctly, that should work.
 
R

r.kalaimathi

Wesley said:
Change the lookup to "java:comp/env/DB2DS"

Assuming you have everything else set up correctly, that should work.
thanks for ur reply...

even now im getting the same error..
i changed the jboss-web.xml and web.xml in the folder
jboss-4.0.5\server\default\deploy\management\console-mgr.sar\web-console.war\WEB-INF
and db2-ds.xml in jboss-4.0.5\server\default\deploy as i mentioned
previously...is it correct to change in the jboss server folder.

is it possible to configure the connection pooling and jndi mapping as
we are doing in WAS 6.0

plz give me the solution and steps to do this.
 
R

r.kalaimathi

Wesley said:
Change the lookup to "java:comp/env/DB2DS"

Assuming you have everything else set up correctly, that should work.


im using jdk1.5,jboss4.0.5 and eclipse 3.2.
 
R

r.kalaimathi

im using jdk1.5,jboss4.0.5 and eclipse 3.2.


this mapping is working in jsp file but it is not working in standalone
application and servlet ..
how to create Remote jndi lookup...
will you plz me the solution.

thanks and regards,
kalaimathi.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top