当前位置: 代码迷 >> J2EE >> tomcat5.5,oracle10g连接池有关问题
  详细解决方案

tomcat5.5,oracle10g连接池有关问题

热度:201   发布时间:2016-04-22 03:37:25.0
tomcat5.5,oracle10g连接池问题
我用tomcat的admin界面做成的jndi,
conf/server.xml如下
  <Resource
  name="jdbc/c2ms"
  type="javax.sql.DataSource"
  password="xp4b"
  driverClassName="oracle.jdbc.driver.OracleDriver"
  maxIdle="2"
  maxWait="5000"
  username="xp4b"
  url="jdbc:oracle:thin:@192.168.2.80:1521:oracl"
  maxActive="4"/>
conf/context.xml如下<Context>
  <!-- Default set of monitored resources -->
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
  <ResourceLink name="jdbc/c2ms" global="jdbc/c2ms" type="javax.sql.DataSource"/>
  <!-- Uncomment this to disable session persistence across Tomcat restarts -->
  <!--
  <Manager pathname="" />
  -->
</Context>
我的应用程序的web.xml如下
<resource-ref>
<description>Oracle Datasource C2MS</description>
<res-ref-name>jdbc/c2ms</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
代码如下
  String dataSource = "jdbc/c2ms";
Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
c2msDataSource = (DataSource) envCtx.lookup(dataSource);
可是运行起来泡下面的异常是什么原因:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at jp.fxis.webapp.dao.impl.ConnectionPool.getConnection(ConnectionPool.java:65)
at jp.fxis.webapp.dao.impl.DAOBase.getStatement(DAOBase.java:20)
at jp.fxis.webapp.dao.impl.KoseiShubetsuTableIOImpl.getDesigmenuList(KoseiShubetsuTableIOImpl.java:31)
at jp.fxis.webapp.action.LoginAction.doAction(LoginAction.java:47)
at jp.fxis.webapp.action.BaseAction.execute(BaseAction.java:135)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at jp.fxis.webapp.utility.CharEncodingFilter.doFilter(CharEncodingFilter.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)