Having problems with JNDI with Tomcat 4.1.12
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   EJ_Chambers
Posted On:   Wednesday, September 25, 2002 07:34 AM

For background information, I have been using Tomcat 4.0.4 without any problems. I have just downloaded version 4.1.12 to start evaluating the upgrade process. The main reason I am wanting to upgrade is the new administrator applications and the advent of the new Global Resources since I have many separate applications that access the same databases and would like to consolidate the JNDI resources for them. The problem I have having is that many of my applications will authenticate a user login by doing the following: DataSource ds = (DataSource) jndiCntx.lookup("java:comp/env/jdbc/" + database.toUpperCase()); return ds.getConnection(user, password); Essent   More>>


For background information, I have been using Tomcat 4.0.4 without any problems. I have just downloaded version 4.1.12 to start evaluating the upgrade process.



The main reason I am wanting to upgrade is the new administrator applications and the advent of the new Global Resources since I have many separate applications that access the same databases and would like to consolidate the JNDI resources for them.



The problem I have having is that many of my applications will authenticate a user login by doing the following:

DataSource ds = (DataSource) jndiCntx.lookup("java:comp/env/jdbc/" + database.toUpperCase());
return ds.getConnection(user, password);



Essentially it opens up a database connection with the user's login and password. If I receive a valid connection object, the user is validated, otherwise they fail.



This method worked perfectly well with Tomcat 4.0.4. Now, this code will not run and will produce the following error:

java.lang.UnsupportedOperationException
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:125)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:56)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2388)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)



But if I attempt to get a connection from the DataSource without passing a login and password (using the default values) it works just fine.



Now my question is the following: Is this an actual error, or has this functionality been removed and I have to always use the default set login?

Thanks,
Ej Chambers

   <<Less
About | Sitemap | Contact