gpt4 book ai didi

jsf - java.lang.NoClassDefFoundError : javax/el/ELResolver when running SimpleHelloByEnteringName JSF example 错误

转载 作者:行者123 更新时间:2023-11-28 21:54:34 25 4
gpt4 key购买 nike

我是 JSF 新手。我正在使用 Tomcat 7.0.14 并尝试运行 SimpleHelloByEnteringName 示例,但在启动和运行时出现以下错误

启动控制台消息:

INFO: Deploying web application directory SimpleHelloByEnteringName
Jun 15, 2011 7:35:42 AM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.3 (FCS b03) for context '/SimpleHelloByEnteringName'
Jun 15, 2011 7:35:43 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.

**Jun 15, 2011 7:35:44 AM com.sun.faces.config.processor.NavigationConfigProcessor addNavigationCasesForRule
WARNING: JSF1058: The resource referred to by to-view-id, 'result.jsp', for navigation from '/pages/inputname.jsp', does not start with '/'. This will be added for you, but it should be corrected.**

Jun 15, 2011 7:35:44 AM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/localhost/SimpleHelloByEnteringName/WEB-INF/faces-config.xml for modifications
Jun 15, 2011 7:35:44 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-apr-8081"]
Jun 15, 2011 7:35:44 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Jun 15, 2011 7:35:44 AM org.apache.catalina.startup.Catalina start

尝试运行时出现运行时错误 http://localhost:8081/SimpleHelloByEnteringName/

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/el/ELResolver
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:342)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.lang.NoClassDefFoundError: javax/el/ELResolver
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
java.lang.ClassLoader.defineClass(ClassLoader.java:615)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
java.net.URLClassLoader.access$000(URLClassLoader.java:58)
java.net.URLClassLoader$1.run(URLClassLoader.java:197)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:190)
sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
java.lang.ClassLoader.loadClass(ClassLoader.java:295)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
java.lang.ClassLoader.loadClass(ClassLoader.java:295)
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
org.apache.jasper.runtime.JspFactoryImpl.getJspApplicationContext(JspFactoryImpl.java:220)
org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.lang.ClassNotFoundException: javax.el.ELResolver
java.net.URLClassLoader$1.run(URLClassLoader.java:202)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:190)
sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
java.lang.ClassLoader.defineClass(ClassLoader.java:615)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
java.net.URLClassLoader.access$000(URLClassLoader.java:58)
java.net.URLClassLoader$1.run(URLClassLoader.java:197)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:190)
sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
java.lang.ClassLoader.loadClass(ClassLoader.java:295)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
java.lang.ClassLoader.loadClass(ClassLoader.java:295)
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
org.apache.jasper.runtime.JspFactoryImpl.getJspApplicationContext(JspFactoryImpl.java:220)
org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.14 logs.

这个问题是怎么引起的,我该如何解决?

最佳答案

WARNING: JSF1058: The resource referred to by to-view-id, 'result.jsp', for navigation from '/pages/inputname.jsp', does not start with '/'. This will be added for you, but it should be corrected.

警告与问题无关。 JSF 已经为您修复了它,但它告诉您应该在 faces-config.xml 中自行修复它。


java.lang.ClassNotFoundException: javax.el.ELResolver

然而,这是相当严重的。这可能有多种原因:

  • 您实际上根本没有运行 Tomcat 7.0,而是运行缺少此类的 Tomcat 5.5。仔细检查。

  • 您丢弃了一堆 servletcontainer 特定库,例如 el-api.jarjsp-api.jar 等不同 servletcontainer make/webapp 的 WEB-INF/lib 或 Java 的 JRE/lib 文件夹中的版本(可能是 Tomcat 5.5?)。可能是为了克服编译问题。移动/复制特定于 servletcontainer 的 JAR 是错误的解决方案。撤消它并将它们全部删除。

  • 您的 web.xml 未声明至少符合 Servlet 2.5 规范。由于您提到要使用 Tomcat 7.0,这是一个 Servlet 3.0 容器,您应该声明 web.xml 符合 Servlet 3.0:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
    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"
    id="WebApp_ID" version="3.0">

    <!-- Your config here -->
    </web-app>

更新:哦等等......我在“SimpleHelloByEnteringName”上进行了谷歌搜索,发现这实际上是一个 Roseindia.net(不寒而栗)示例,如下所示: Downloading and Installing "SimpleHelloByEnteringName" JSF Example .我想强调一下,这个网站是 worst互联网上的 Java EE 学习资源。我强烈建议前往其他资源。

关于jsf - java.lang.NoClassDefFoundError : javax/el/ELResolver when running SimpleHelloByEnteringName JSF example 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6360121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com