包含无效的表达式:javax.el.E​​LException: [英] contains invalid expression(s): javax.el.ELException:

查看:124
本文介绍了包含无效的表达式:javax.el.E​​LException:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行时错误:

index.jsp(12,8) PWC6038: "${sqlStatement == null}" contains invalid expression(s):
javax.el.ELException: Unable to find ExpressionFactory of type:
    org.apache.el.ExpressionFactoryImpl
    org.apache.jasper.JasperException: : javax.el.ELException: Unable to find ExpressionFactory of type: org.apache.el.ExpressionFactoryImpl

问题:

  1. 我该如何调试呢?
  2. 找不到类型为org.apache.el.E​​xpressionFactoryImpl<的ExpressionFactory-这是什么意思?

这就是我所拥有的

  • NetBeans IDE 7.3
  • Tomcat 7.0
  • MySql连接

这是Murach的书中的一个简单的sql网关

This is a simple sql gateway from Murach's book

index.jsp

index.jsp

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 

    <c:if test="${sqlStatement == null}">
        <c:set var="sqlStatment" value="select * from User" />
    </c:if>

    <h1>The SQL Gateway</h1>
    <p>Enter an SQL statement and click the execute button. Then, information about the<br/>
    statement will appear at the bottom of this page.
    </p>

    <p><b>SQL Statement:</b></p>

    <form action="SqlGateway" method="POST">

        <textarea name="sqlStatement" cols="60" rows="8">${sqlStatement}</textarea>
        <br/><br/>
        <input type="submit" value="Execute">

    </form>

    <p><b>SQL result:</b></p>
    <p>${sqlResult}</p>

web.xml

    <servlet>
    <servlet-name>SqlGatewayServlet</servlet-name>
    <servlet-class>sql.SqlGatewayServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>SqlGatewayServlet</servlet-name>
    <url-pattern>/SqlGateway</url-pattern>
</servlet-mapping>

我认为servlet没什么问题,但是如果您需要我发布它,请告诉我.

I don't think there is anything wrong with the servlet, but if you need me to post it please let me know.

推荐答案

我的el-api.jar文件是否有问题

您应该在您的Web应用程序的/WEB-INF/lib中具有任何特定于servlet容器的JAR文件. Servlet容器本身应该已经提供了特定于Servlet容器的JAR文件.

You should not have any servletcontainer-specific JAR file in your webapp's /WEB-INF/lib. Servletcontainer-specific JAR files are supposed to be already provided by the servlet-container itself.

查看Tomcat的/lib文件夹,它已经附带了内部库,JSP,Servlet和EL库.您不需要通过您的Web应用程序提供任何一个.如果仍然这样做,则运行时类路径可能会陷入灾难,因为存在重复的不同版本库.在您的特定情况下,您可能通过Web应用程序提供了一个随机下载的EL API,该API与运行时类路径中找到的EL impl不匹配,因此无法通过抽象工厂模式找到正确的impl.

Look in Tomcat's /lib folder, it already ships internal libraries, JSP, Servlet and EL libraries. You do not need to supply any of them via your webapp. If you still do it, the runtime classpath may end up in a disaster because there are duplicate different versioned libraries. In your specific case, you likely supplied a randomly downloaded EL API via your webapp which didn't match the EL impl found in the runtime classpath and thus the right impl can't be found via the abstract factory pattern.

因此,如果您在/WEB-INF/lib中摆脱了特定于servlet容器的JAR,那么一切应该都很好. /WEB-INF/lib应该仅包含 库,这些库特定于webapp本身,而servlet容器尚未提供.

So, if you get rid of servletcontainer-specific JARs in /WEB-INF/lib, then all should be well. The /WEB-INF/lib should contain only libraries which are specific to the webapp itself and are not already provided by the servletcontainer.

这篇关于包含无效的表达式:javax.el.E​​LException:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆