• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about jndi for datasource

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic