Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Cannot look jndi name in jBoss..pls help

Thread view: 
r.kalaimathi@gmail.com - 02 Nov 2006 15:18 GMT
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:org.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
Wesley Hall - 03 Nov 2006 00:23 GMT
> 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.kalaimathi@gmail.com - 03 Nov 2006 15:42 GMT
> > 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.
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.kalaimathi@gmail.com - 03 Nov 2006 15:46 GMT
> > 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.

im using jdk1.5,jboss4.0.5 and eclipse 3.2.
r.kalaimathi@gmail.com - 06 Nov 2006 14:02 GMT
> > > DataSource ds = (DataSource)ctxt.lookup("java:DB2DS");
> >
[quoted text clipped - 3 lines]
>
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.