简体   繁体   中英

contains invalid expression(s): javax.el.ELException:

Error on run time:

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

Questions:

  1. How would I go about debugging this?
  2. Unable to find ExpressionFactory of type: org.apache.el.ExpressionFactoryImpl <-- what does this mean?

This is what I have

  • NetBeans IDE 7.3
  • Tomcat 7.0
  • MySql connection

This is a simple sql gateway from Murach's book

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>

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

Could it be something wrong with my el-api.jar file

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.

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.

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.

See also:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM