ClassNotFound:ComboPooledDataSource,后跟JasperException:/ struts-tags缺失

时间:2016-08-30 15:32:53

标签: java spring hibernate maven struts2

我已经投入使用Spring / Struts / Hibernate等已经通过Maven为我设置的项目。我没有任何这些技术的先验知识,只是学习我去,我使用Eclipse。

今天我开始研究Solr(该库已经是一个maven依赖项),使用main方法在类中运行代码并确保它正常工作,然后以正确的方式(命令模式)合并Solr。

事情是,一旦我这样做,我开始得到这个:

  

ClassNotFoundException:找不到名为' dataSource'

的bean的类[com.mchange.v2.c3p0.ComboPooledDataSource]

我没有完整的痕迹,因为我没有考虑保存它,我不能再复制它了。这是我的datasource.xml,它抱怨该类缺失:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- connection pool implementation c3p0 http://www.mchange.com/projects/c3p0 --> 
    <bean id="dataSource"
    class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
        <property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
        <property name="jdbcUrl" value="${datasource.url}"/>
        <property name="user" value="${datasource.username}"/>
        <property name="password" value="${datasource.password}"/>
        <property name="acquireIncrement" value="3"/>
        <property name="initialPoolSize" value="3"/>
        <property name="minPoolSize" value="3"/>
        <property name="maxPoolSize" value="150"/>
        <property name="testConnectionOnCheckin" value="true"/>
        <property name="idleConnectionTestPeriod" value="300"/>
        <property name="preferredTestQuery" value="select 1"/>
    </bean>

</beans>

该课程肯定是在Maven Dependencies中。我无法弄清楚错误,所以我又回到了git上的工作版本。现在我在启动服务器时得到以下输出:

Aug 30, 2016 4:03:46 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal                 performance in production environments was not found on the java.library.path: C:\Program     Files\Java\jdk1.8.0_91\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.8.0_91/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_91/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_91/bin/../jre/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Interwoven\WorkSite\;C:\Program Files\Common Files\Philips Speech Shared\Components;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;"C:\typesafe-activator-1.3.10\activator-dist-1.3.10\bin";"C:\Programs\sbt\bin";C:\Programs\eclipse;;.
Aug 30, 2016 4:03:46 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Aug 30, 2016 4:03:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 500 ms
Aug 30, 2016 4:03:46 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 30, 2016 4:03:46 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.45
Aug 30, 2016 4:03:47 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor com.pinsentmasons.clauseextract.web.xml
Aug 30, 2016 4:03:47 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Aug 30, 2016 4:03:47 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 30, 2016 4:03:47 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15  config=null
Aug 30, 2016 4:03:47 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 304 ms

现在,当我加载网页时,我得到以下内容:

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /index.jsp(2,41) File "/struts-tags" not found
    at             org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    at       org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:163)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:450)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1400)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:130)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:612)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
    at java.lang.Thread.run(Thread.java:745)

这个版本的代码在提交时工作得很好,所以我可以假设代码不再有问题了。我试过清理项目并进行Maven更新无济于事。我很失落。

1 个答案:

答案 0 :(得分:0)

所以我发现问题与类甚至我自己的代码无关,但这是Tomcat的一个问题。

我正在清理项目并通过Maven进行更新项目,但是我没有清理Tomcat服务器,一旦我清理并重新发布项目,一切都恢复到工作状态。