首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

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

2012-01-23 
请教Struts1.2+MyEclipse5.0+Tomcat5.5的数据源配置问题。请看我的struts-config.xml?xmlversion 1.0 e

请教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)


at   org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at   org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at   org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at   org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at   org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at   org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at   org.apache.catalina.core.StandardService.start(StandardService.java:450)
at   org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at   org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native   Method)
at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at   java.lang.reflect.Method.invoke(Method.java:585)
at   org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at   org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2007-1-18   22:03:43   org.apache.catalina.core.ApplicationContext   log
信息:   Marking   servlet   action   as   unavailable
2007-1-18   22:03:43   org.apache.catalina.core.StandardContext   loadOnStartup
严重:   Servlet   /addressbook   threw   load()   exception
javax.servlet.UnavailableException:   org/apache/commons/pool/impl/GenericObjectPool
at   org.apache.struts.action.ActionServlet.init(ActionServlet.java:368)
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)
at   org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at   org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at   org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at   org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at   org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at   org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at   org.apache.catalina.core.StandardService.start(StandardService.java:450)
at   org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at   org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native   Method)
at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at   java.lang.reflect.Method.invoke(Method.java:585)


at   org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at   org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

[解决办法]
Most likely, this is due to an incorrect or missing library dependency.
多数情况下,这是由于导入了不正确的,或者是没有导入相关的jar包出除了这些你的mysql驱动包也应该放进去!
[解决办法]
<struts-config>
<data-sources>
<data-source type= "org.apache.commons.dbcp.BasicDataSource ">
<set-property property= "driverClassName " value= "com.microsoft.jdbc.sqlserver.SQLServerDriver " />
<set-property property= "url " value= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=DB12315 "/>
<set-property property= "username " value= "dba " />
<set-property property= "password " value= "zzxgy " />
<set-property property= "maxActive " value= "20 " />
<set-property property= "maxWait " value= "5000 " />
<set-property property= "defaultAutoCommit " value= "true " />
<set-property property= "defaultReadOnly " value= "false " />
<set-property property= "removeAbandoned " value= "true " />
<set-property property= "removeAbandonedTimeout " value= "120 " />
<set-property property= "encoding " value= "false " />
</data-source>
</data-sources>
<form-beans >
[解决办法]
commons-pool-1.2.jar这个包是不是有问题啊?
你看看他里面有没有你需要的
org/apache/commons/pool/impl/GenericObjectPool
报错是找不到这个类.

热点排行