This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Configuring DataSource in tomcat 4.x Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Configuring DataSource in tomcat 4.x " Watch "Configuring DataSource in tomcat 4.x " New topic
Author

Configuring DataSource in tomcat 4.x

Muhammad Ghufran
Greenhorn

Joined: Jul 20, 2005
Posts: 8
I am trying to configure Datasource in tomcat, I did all steps defined in JNDI Datasource HOW-TO.

I am able to get the object of DataSource but when I call mydatasource.getConnection(); I am getting NullPointer exception as follows. Thanks for any help and comments in advance.


java.lang.NullPointerException
at org.apache.commons.dbcp.DelegatingConnection.close(DelegatingConnecti
on.java:195)
at org.apache.commons.dbcp.PoolableConnection.reallyClose(PoolableConnec
tion.java:129)
at org.apache.commons.dbcp.PoolableConnectionFactory.destroyObject(Poola
bleConnectionFactory.java:311)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(Bas
icDataSource.java:842)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:821)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:518)
at com.fruit.demand.planning.ui.actions.LoginAction.createDBConn(LoginAc
tion.java:132)
at com.fruit.demand.planning.ui.actions.LoginAction.execute(LoginAction.
java:84)
at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
2)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:696)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:504)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal




Thanks
Ghufran
Scott Dunbar
Ranch Hand

Joined: Sep 23, 2004
Posts: 245
Can you post the section of your server.xml where you define the datasource? It isn't too bad to do but I too had to spend some time to get it working.


<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
 
 
subject: Configuring DataSource in tomcat 4.x