question about jndi for datasource
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   zhebin_cong
Posted On:   Wednesday, August 21, 2002 11:46 PM

helllo i setup a connection pool named "TaskPool" in my weblogic server,the i setup a datasource named "dsTaskPool" to point to it,in my project,i lookup it by following: Context ctx=new InitialContext(); DataSource ds=(dataSource)ctx.lookup( "dsTaskPool" ); it works well. but if i use following method: .............. DataSource ds=(DataSource)ctx.lookup( "java:comp/env/dsTaskPool" ); it throws: javax.naming.NameNotFoundException: Unable to resolve comp/env/dsTaskPool/ Resolved: 'comp/env' Unresolved:'dsTaskPool' ; remaining name '' at weblogic.jndi.internal.B   More>>

helllo


i setup a connection pool named "TaskPool" in my weblogic server,the i setup a datasource named "dsTaskPool" to point to it,in my project,i lookup it by following:



Context ctx=new InitialContext();

DataSource ds=(dataSource)ctx.lookup( "dsTaskPool" );


it works well.

but if i use following method:


..............

DataSource ds=(DataSource)ctx.lookup( "java:comp/env/dsTaskPool" );

it throws:


javax.naming.NameNotFoundException: Unable to resolve comp/env/dsTaskPool/ Resolved: 'comp/env' Unresolved:'dsTaskPool' ; remaining name ''

at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:887)

at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:219)

at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:183)

at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:191)

at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:191)

at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:339)

at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:36)

at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:124)

at javax.naming.InitialContext.lookup(InitialContext.java:350)

at com.jhtop.task.forum.InitServlet.init(InitServlet.java:35)

at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:700)

at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:643)

at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:588)

at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2221)

at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:2165)

at weblogic.servlet.internal.HttpServer.preloadServlets(HttpServer.java:475)

at weblogic.servlet.internal.WebService.preloadServlets(WebService.java:450)

at weblogic.t3.srvr.ServletInitRunner.run(ServletInitRunner.java:49)

at java.lang.Thread.run(Thread.java:484)





help me!thank you!    <<Less

Re: question about jndi for datasource

Posted By:   neal_ravindran  
Posted On:   Sunday, September 29, 2002 04:44 AM

Did you have to use
DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/dsTaskPool");

to make this work?


Was curious why the first worked and not the second.
About | Sitemap | Contact