4

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.

Eric Huang
  • 1,114
  • 3
  • 22
  • 43

1 Answers1

2

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:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Yes, thank you. when I mentioned el-api.jar file I was looking at Tomcat's lib folder. I do not have el-api.jar in my /WEB-INF/Lib. The reason I suspect something wrong with the jar is because... well, its just an odd weird problem I am having right now.... But thank you for giving your input... – Eric Huang Jul 31 '13 at 22:25
  • That's odd. At least, fact is, your runtime classpath is a mess. Have you ever fiddled around with loose servletcontainer-specific JAR files? E.g. in JDK/JRE's `/lib` or `/lib/ext` in a careless attempt to fix compilation errors? – BalusC Jul 31 '13 at 22:27
  • I wish I did, then I at least I know I did something bad.... I am going to re-install tomcat and my IDE, see if it fixes things... Thank you – Eric Huang Jul 31 '13 at 23:45