我有一个在Tomcat 6上运行良好的应用程序。我现在已将该应用程序移至Tomcat 7,并且JSP抛出了编译异常以下的错误。
Mar 21, 2014 12:05:56 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [jsp] in context with path [/core-tool-5.0] threw exception [Unable to compile class for JSP: An error occurred at line: 22 in the generated java file The type welcome_jsp must implement the inherited abstract method JspSourceDependent.getDependants() An error occurred at line: 28 in the generated java file The type Map is not generic; it cannot be parameterized with arguments <String, Long> An error occurred at line: 31 in the generated java file _jspx_dependants cannot be resolved to a variable An error occurred at line: 31 in the generated java file The type HashMap is not generic; it cannot be parameterized with arguments <String, Long> An error occurred at line: 32 in the generated java file _jspx_dependants cannot be resolved An error occurred at line: 32 in the generated java file The method valueOf(String) in the type Long is not applicable for the arguments (long) An error occurred at line: 40 in the generated java file The type Map is not generic; it cannot be parameterized with arguments <String, Long> An error occurred at line: 41 in the generated java file _jspx_dependants cannot be resolved to a variable Stacktrace: at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.util.AssertionThreadLocalFilter.doFilter(AssertionThreadLocalFilter.java:54) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.accenture.toolkit.filters.ToolkitAuthenticationFilter.doFilter(ToolkitAuthenticationFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:201) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:5 85) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722)
我查看了jasper为两个tomcat版本创建的java文件,发现了一个重大更改。例如,与行号错误相对应。22,tomcat 6的java文件中的getDependants()方法具有以下签名:
public Object getDependants() { return _jspx_dependants; }
而对于Tomcat 7,这是
public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; }
我几个月前也提出了这个问题。找不到解决方案,所以我切换到了tomcat,但是现在我们需要在tomcat 7上对此代码进行生产发布,因此需要针对此的具体解决方案。
如果有人可以帮助我确定解决该问题所需的纠正方法,那将是很好的
以下是我的应用程序的WEB-INF / lib文件夹中所有jar的列表:
activation-1.1.jar ant-1.6.jar ant-1.7.0.jar ant-launcher-1.7.0.jar aopalliance-1.0.jar asm-3.2.jar asm-4.1.jar asm-analysis-4.1.jar asm-tree-4.1.jar asm-util-4.1.jar aspectjweaver-1.7.2.jar avalon-framework-api-4.2.0.jar avalon-framework-api-4.2.0.jar avalon-framework-api-4.3.1.jar avalon-framework-impl-4.3.1.jar batik-all-1.7.jar batik-anim-1.7.jar batik-awt-util-1.7.jar batik-bridge-1.7.jar batik-css-1.7.jar batik-dom-1.7.jar batik-ext-1.7.jar batik-extension-1.7.jar batik-gvt-1.7.jar batik-js-1.7.jar batik-parser-1.7.jar batik-script-1.7.jar batik-svg-dom-1.7.jar batik-svggen-1.7.jar batik-transcoder-1.7.jar batik-util-1.7.jar batik-xml-1.7.jar cas-client-core-3.2.1.jar commons-beanutils-1.7.0.jar commons-codec-1.3.jar commons-collections-3.2.jar commons-compress-1.4.1.jar commons-digester-1.8.jar commons-discovery-0.4_1.jar commons-el-1.0.jar commons-exec-1.1.jar commons-fileupload-1.2.1.jar commons-io-1.3.2.jar commons-lang-2.4.jar commons-logging-1.1.1.jar commons-validator-1.3.1.jar dom4j-1.6.1.jar fop-1.0.jar geronimo-stax-api_1.0_spec-1.0.1.jar jackson-core-asl-1.9.13.jar jackson-jaxrs-1.9.13.jar jackson-mapper-asl-1.9.13.jar jackson-xc-1.9.13.jar jadretro-1.6.1.jar javassist-3.14.0-GA.jar jaxb-api-2.1.jar jaxb-impl-2.1.jar jaxen-1.1.1.jar jbpmmigration-0.11.jar jdec-20.jar jdom-1.0.jar junit-4.4.jar log4j-1.2.14.jar maven-model-3.0.4.jar mimepull-1.6.jar mysql-connector-java-5.1.22.jar org.eclipse.core.contenttype-3.4.100.v20100505-1235.jar org.eclipse.core.expressions-3.4.200.v20100505.jar org.eclipse.core.filesystem-1.3.0.v20100526-0737.jar org.eclipse.core.jobs-3.5.0.v20100515.jar org.eclipse.core.resources-3.6.0.v20100526-0737.jar org.eclipse.core.runtime-3.6.0.v20100505.jar org.eclipse.equinox.app-1.3.0.v20100512.jar org.eclipse.equinox.common-3.6.0.v20100503.jar org.eclipse.equinox.preferences-3.3.0.v20100503.jar org.eclipse.equinox.registry-3.5.0.v20100503.jar org.eclipse.jdt.core-3.5.1.v_972_R35x.jar org.eclipse.osgi.services-3.2.100.v20100503.jar org.eclipse.osgi-3.6.0.v20100517.jar org.osgi.foundation-1.2.0.jar org-apache-batik-all-1.7-201002241055.jar parboiled-core-1.1.4.jar parboiled-java-1.1.4.jar pegdown-1.2.2-DAVIS.jar plexus-utils-2.0.6.jar pmd-4.3.jar poi-3.7.jar poi-ooxml-3.7.jar poi-ooxml-schemas-3.7.jar redline-1.1.12.jar serializer-2.7.0.jar serializer-2.7.1.jar spring-aop-3.2.4.RELEASE.jar spring-aspects-3.2.4.RELEASE.jar spring-beans-3.2.4.RELEASE.jar spring-context-3.2.4.RELEASE.jar spring-context-support-3.2.4.RELEASE.jar spring-core-3.2.4.RELEASE.jar spring-expression-3.2.4.RELEASE.jar spring-instrument-3.2.4.RELEASE.jar spring-jdbc-3.2.4.RELEASE.jar spring-tx-3.2.4.RELEASE.jar spring-web-3.2.4.RELEASE.jar spring-webmvc-3.2.4.RELEASE.jar stax-api-1.0.1.jar stax-api-1.0-2.jar windup-engine-0.7.0.jar windup-metadata-0.7.0.jar xalan-2.7.0.jar xercesImpl-2.7.1.jar xml-apis-1.3.04.jar xml-apis-ext-1.3.04.jar xmlbeans-2.3.0.jar xmlgraphics-commons-1.4.jar xmlParserAPIs-2.6.2.jar xmlunit-1.4.jar xom-1.0.jar xz-1.0.jar
另外,以下是我的应用程序pom.xml中的依赖项列表
<dependencies> <dependency> <groupId>asm</groupId> <artifactId>asm</artifactId> <version>3.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>avalon-framework</groupId> <artifactId>avalon-framework-api</artifactId> <version>4.2.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.kenai.nbpwr</groupId> <artifactId>org-apache-batik-all</artifactId> <version>1.7-201002241055</version> </dependency> <dependency> <groupId>org.jasig.cas.client</groupId> <artifactId>cas-client-core</artifactId> <version>3.2.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.7.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.3</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-digester</groupId> <artifactId>commons-digester</artifactId> <version>1.8</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.geronimo.bundles</groupId> <artifactId>commons-discovery</artifactId> <version>0.4_1</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-el</groupId> <artifactId>commons-el</artifactId> <version>1.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> <version>1.3.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>commons-validator</groupId> <artifactId>commons-validator</artifactId> <version>1.3.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>fop</artifactId> <version>1.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-stax-api_1.0_spec</artifactId> <version>1.0.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.9.13</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-jaxrs</artifactId> <version>1.9.13</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.13</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-xc</artifactId> <version>1.9.13</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <version>1.1.1</version> <scope>compile</scope> <exclusions> <exclusion> <artifactId>icu4j</artifactId> <groupId>com.ibm.icu</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>jdec</groupId> <artifactId>jdec</artifactId> <version>20</version> <scope>system</scope> <systemPath>C:\Users\kinjal.doshi\Documents\spring-toolkit\migrationtoolkit/src/main/webapp/WEB-INF/lib/jdec-20.jar</systemPath> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-model</artifactId> <version>3.0.4</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.jvnet</groupId> <artifactId>mimepull</artifactId> <version>1.6</version> <scope>compile</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.22</version> </dependency> <dependency> <groupId>pmd</groupId> <artifactId>pmd</artifactId> <version>4.3</version> <scope>compile</scope> <exclusions> <exclusion> <groupId>asm</groupId> <artifactId>asm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.7</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.7</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml-schemas</artifactId> <version>3.7</version> <scope>compile</scope> </dependency> <dependency> <groupId>xalan</groupId> <artifactId>serializer</artifactId> <version>2.7.1</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>system</scope> <systemPath>C:\Users\kinjal.doshi\Apache Software Foundation\apache-tomcat-7.0.32\lib\servlet-api.jar</systemPath> </dependency> <dependency> <groupId>xalan</groupId> <artifactId>xalan</artifactId> <version>2.7.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.7.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> <version>1.3.04</version> <scope>compile</scope> </dependency> <dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis-ext</artifactId> <version>1.3.04</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>2.3.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>xmlgraphics-commons</artifactId> <version>1.4</version> <scope>compile</scope> </dependency> <dependency> <groupId>jsp-api</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>system</scope> <systemPath>C:\Users\kinjal.doshi\Apache Software Foundation\apache-tomcat-7.0.32\lib\jsp-api.jar</systemPath> </dependency> <dependency> <groupId>net.sf.jadretro</groupId> <artifactId>jadretro</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-exec</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.jboss.windup</groupId> <artifactId>windup-engine</artifactId> <version>0.7.0</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-instrument</artifactId> <version>3.2.4.RELEASE</version> </dependency> </dependencies>
终于找到了冲突的jar。它是org.osgi.foundation-1.2.0.jar。但是,我正在使用的另一个依赖项需要此jar,因此需要找到一种解决此问题的方法。