我正在尝试将一个Spring MVC应用程序部署到tomcat 7,并且我遇到了可怕的异常:
java.lang.NoClassDefFoundError: javax/el/ExpressionFactory
org.apache.jasper.runtime.JspApplicationContextImpl.getExpressionFactory(JspApplicationContextImpl.java:108)
org.apache.jasper.compiler.Validator$ValidateVisitor.<init>(Validator.java:514)
org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1795)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
我在部署的WEB-INF / lib中没有看到任何常见的嫌疑人(servlet-api.jar,el-api.jar等)。
这是我的pom.xml文件:
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
我基本上是在尝试加载一个简单的jsp页面。我知道Tomcat正在使用Jasper来编译jsp页面,因为它正在解决这个类加载器问题,但我无法弄清楚原因。
我唯一的猜测是,我需要打包一个我不是的库,或者可能将一个库添加到tomcat / lib。
以下是我的WEB-INF / lib
中的jar列表activation-1.1.jar
antlr-2.7.6.jar
aopalliance-1.0.jar
aspectjrt-1.6.6.jar
aspectjweaver-1.6.6.jar
commons-collections-3.2.jar
commons-dbcp-1.2.2.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-lang-2.1.jar
commons-logging-1.1.1.jar
commons-pool-1.3.jar
dom4j-1.6.1.jar
ehcache-core-2.3.0.jar
freemarker-2.3.15.jar
groovy-all-1.8.5.jar
guava-12.0.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-3.3.1.GA.jar
hibernate-entitymanager-4.1.0.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-4.1.0.Final.jar
hsqldb-1.8.0.7.jar
jacks_2.10-2.1.4.jar
jackson-annotations-2.1.4.jar
jackson-core-2.1.4.jar
jackson-core-asl-1.9.9.jar
jackson-databind-2.1.4.jar
javassist-3.15.0-GA.jar
javax.inject-1.jar
jboss-logging-3.1.0.CR2.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jcl-over-slf4j-1.6.6.jar
jettison-1.1.jar
joda-time-1.6.2.jar
jsr305-1.3.9.jar
log4j-1.2.17.jar
logback-classic-1.0.7.jar
logback-core-1.0.7.jar
mail-1.4.6-rc1.jar
mysql-connector-java-5.1.18.jar
ognl-3.0.5.jar
scala-compiler-2.10.1.jar
scala-library-2.10.1.jar
scala-reflect-2.10.0.jar
scalap-2.10.1.jar
slf4j-api-1.7.5.jar
slf4j-log4j12-1.6.6.jar
snakeyaml-1.11.jar
spring-aop-3.2.2.RELEASE.jar
spring-batch-admin-manager-1.3.0.BUILD-20130514.094516-16.jar
spring-batch-admin-resources-1.3.0.BUILD-20130514.094516-17.jar
spring-batch-core-2.2.0.BUILD-20130514.030108-700.jar
spring-batch-infrastructure-2.2.0.BUILD-20130514.030108-714.jar
spring-batch-integration-1.3.0.BUILD-20130514.094516-17.jar
spring-beans-3.2.2.RELEASE.jar
spring-context-3.2.2.RELEASE.jar
spring-context-support-3.2.2.RELEASE.jar
spring-core-3.2.2.RELEASE.jar
spring-expression-3.2.2.RELEASE.jar
spring-integration-core-2.2.3.RELEASE.jar
spring-integration-file-2.2.3.RELEASE.jar
spring-integration-groovy-2.2.3.RELEASE.jar
spring-integration-http-2.2.3.RELEASE.jar
spring-integration-jms-2.2.3.RELEASE.jar
spring-integration-jmx-2.2.3.RELEASE.jar
spring-integration-mail-2.2.3.RELEASE.jar
spring-integration-scripting-2.2.3.RELEASE.jar
spring-integration-stream-2.2.3.RELEASE.jar
spring-integration-twitter-2.2.3.RELEASE.jar
spring-integration-ws-2.2.3.RELEASE.jar
spring-integration-xml-2.2.3.RELEASE.jar
spring-jdbc-3.2.2.RELEASE.jar
spring-jms-3.2.2.RELEASE.jar
spring-oxm-1.5.9.jar
spring-oxm-3.2.2.RELEASE.jar
spring-retry-1.0.2.RELEASE.jar
spring-scala-1.0.0.M2.jar
spring-security-config-3.2.0.M1.jar
spring-security-core-3.2.0.M1.jar
spring-security-crypto-3.1.0.RELEASE.jar
spring-security-web-3.2.0.M1.jar
spring-social-core-1.0.1.RELEASE.jar
spring-social-twitter-1.0.1.RELEASE.jar
spring-tx-3.2.2.RELEASE.jar
spring-web-3.2.2.RELEASE.jar
spring-webmvc-3.2.2.RELEASE.jar
spring-ws-core-1.5.9.jar
spring-xml-1.5.9.jar
thymeleaf-2.0.15.jar
thymeleaf-layout-dialect-1.0.5.jar
thymeleaf-spring3-2.0.15.jar
wsdl4j-1.6.1.jar
xml-apis-1.0.b2.jar
xpp3_min-1.1.4c.jar
xstream-1.3.jar