急问!!!!!!!!!!!

05-04-18 kevinfield

在配置Struts1.1数据源的时候出现了一个怪问题,请大家帮助看一下

我的数据源在Struts-config.xml配置如下:

<data-sources>

<data-source key="MySql">

<set-property property="driverClassName"

value="com.mysql.jdbc.Driver"/>

<set-property property="url"

value="jdbc:mysql://localhost:3306/managingsystem"/>

<set-property property="username" value="root"/>

<set-property property="password" value="kevinfield"/>

<set-property property="maxActive" value="50"/>

<set-property property="maxWait" value="1500"/>

<set-property property="defaultAutoCommit" value="false"/>

<set-property property="defaultReadOnly" value="false"/>

</data-source>

</data-sources>

我在Action中调用的代码如下:

DataSource dataSource=this.getDataSource(servletRequest,"MySql");

Connection connection=dataSource.getConnection();

但是在运行到相关获取数据源连接的Action的时候却发生如下异常:

javax.servlet.ServletException: Servlet.init() for servlet action threw exception

javax.servlet.ServletException: Servlet.init() for servlet action threw exception

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1071)

at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:687)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

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

JBuilder2005提示的具体异常信息如下:

HTTP Status 500 - type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: Servlet.init() for servlet action threw exception

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)

org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

java.lang.Thread.run(Thread.java:595)

root cause java.lang.NoClassDefFoundError: org/apache/struts/legacy/GenericDataSource

java.lang.ClassLoader.defineClass1(Native Method)

java.lang.ClassLoader.defineClass(ClassLoader.java:605)

java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)

org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)

org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207)

org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)

org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1081)

org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)

javax.servlet.GenericServlet.init(GenericServlet.java:211)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)

org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

java.lang.Thread.run(Thread.java:595)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.Apache Tomcat/5.0.27

初用Struts,不知道除了在Struts-config.xml中配置之外,是不是还要在Tomcat 5.0(我用的服务器)下面配置什么东西吗? 请大家帮忙看一下

kevinfield
2005-04-18 17:15

数据源具体配置信息如下:kevinfield187GGvu0e3.xml

不知道,在Struts中配置数据源的时候是不是除了在Struts-config.xml文件中配置以外,是不是还需要在其他的地方配置相关信息啊?

我用的是:

Tomcat 5.0.27

jdk1.5

JBuilder 2005