当前位置: 代码迷 >> Java Web开发 >> 请问Struts1.2+MyEclipse5.0+Tomcat5.5的数据源配置有关问题
  详细解决方案

请问Struts1.2+MyEclipse5.0+Tomcat5.5的数据源配置有关问题

热度:531   发布时间:2016-04-17 16:55:00.0
请教Struts1.2+MyEclipse5.0+Tomcat5.5的数据源配置问题。
请看我的struts-config.xml
<?xml   version= "1.0 "   encoding= "UTF-8 "?>
<!DOCTYPE   struts-config   PUBLIC   "-//Apache   Software   Foundation//DTD   Struts   Configuration   1.2//EN "   "http://struts.apache.org/dtds/struts-config_1_2.dtd ">

<struts-config>
    <data-sources>
        <data-source   type= "org.apache.commons.dbcp.BasicDataSource ">
    <set-property   property= "driverClassName "   value= "org.gjt.mm.mysql.Driver "/>
    <set-property   property= "url "   value= "jdbc:mysql://localhost:3306/addressbooksample "/>
    <set-property   property= "username "   value= "root "/>
    <set-property   property= "password "   value= "MyNewPassword "/>
</data-source>
    </data-sources>
    <form-beans   />
    <global-exceptions   />
    <global-forwards   />
    <action-mappings   />
    <message-resources   parameter= "com.statestreet.addressbook.struts.ApplicationResources "   />
</struts-config>

我已经将struts-legacy.jar,commons-dbcp-1.2.1.jar,commons-pool-1.2.jar,commons-collections-3.2.jar包放入tomcat的common/lib目录中,/WEB-INF/lib中也有这些包。可是我启动tomcat服务的时候依然有这些错误,请问如何解决?
严重:   Unable   to   initialize   Struts   ActionServlet   due   to   an   unexpected   exception   or   error   thrown,   so   marking   the   servlet   as   unavailable.     Most   likely,   this   is   due   to   an   incorrect   or   missing   library   dependency.
java.lang.NoClassDefFoundError:   org/apache/commons/pool/impl/GenericObjectPool
at   java.lang.Class.getDeclaredConstructors0(Native   Method)
at   java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at   java.lang.Class.getConstructor0(Class.java:2671)
at   java.lang.Class.newInstance0(Class.java:321)
at   java.lang.Class.newInstance(Class.java:303)
at   org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
at   org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:805)
at   org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
at   javax.servlet.GenericServlet.init(GenericServlet.java:211)
at   org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at   org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at   org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
at   org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
at   org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at   org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at   org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at   org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
at   org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
at   org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at   org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
  相关解决方案