java.lang.ClassNotFoundException:javax.el.StaticFieldELResolver [英] java.lang.ClassNotFoundException: javax.el.StaticFieldELResolver
问题描述
我正在尝试使用几个星期前正在工作的servlet运行项目(此后未进行任何修改).但是,当我运行它时,现在出现以下错误:
I am attempting to run a project with a servlet that was working a few weeks ago (no modifications have been made since). However, when I run it I now get the following error:
java.lang.ClassNotFoundException: javax.el.StaticFieldELResolver
我已经看到类似的问题,例如 this一个,但是他们的解决方案对我不起作用.我尝试了以下失败:
I've seen similar questions out there such as this one, but their solutions did not work for me. I've tried the following unsuccessfully:
- 除去JDK 1.7和Apache Tomcat 7.0.41.0以外的所有其他库引用
- 将
web.xml
文件从2.5更新到3.0:<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
- 将
sun-web.xml
文件从2.5更新到3.0:<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
- 验证Tomcat库是否包含
el-api.jar
和jsp-api.jar
- 设置
CATALINA_HOME
环境变量以指向Tomcat目录
- Removing all other library references other than JDK 1.7 and Apache Tomcat 7.0.41.0
- Updating the
web.xml
file from 2.5 to 3.0:<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
- Updating the
sun-web.xml
file from 2.5 to 3.0:<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
- Verifying that the Tomcat library includes
el-api.jar
andjsp-api.jar
- Setting the
CATALINA_HOME
environment variable to point to the Tomcat directory
使用的IDE是运行Java 7的Apache Tomcat 7.0.41.0的NetBeans 7.4.
The IDE being used is NetBeans 7.4 running Apache Tomcat 7.0.41.0 with Java 7. Any help is greatly appreciated.
更新:
奇怪的是,如果我选择使用GlassFish而不是Tomcat来运行它,那么它将运行而没有错误.因此,必须与Tomcat服务器存在某种关系.
Oddly, if I choose to run it with GlassFish instead of Tomcat it runs without error. So there must be some relationship to the Tomcat server.
推荐答案
类javax.el.StaticFieldELResolver
是它已在Tomcat 8中提供,但尚未提供通用版本,因此请使用它风险自负.
The class javax.el.StaticFieldELResolver
is part of the EL 3.0 API. AFAIK it is not available in Tomcat 7 versions. It is available in Tomcat 8, but that is not in General Availability yet, so use it as your own risks.
您必须更改了某些内容.
You must have changed something.
这篇关于java.lang.ClassNotFoundException:javax.el.StaticFieldELResolver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!