1

I am a newbie on JSP and have an existing application that works well in Tomcat 6.0.45. Now I upgraded to Tomcat 9.0.0.M26. As soon as I have an EL statement in my .jsp, the tomcat throws a NullPointerException when drawing the page:

java.lang.NullPointerException
    java.util.Objects.requireNonNull(Objects.java:203)
    javax.el.CompositeELResolver.add(CompositeELResolver.java:47)
    org.apache.jasper.el.ELContextImpl.<clinit>(ELContextImpl.java:87)
    org.apache.jasper.compiler.Validator$ValidateVisitor.prepareExpression(Validator.java:1619)

I have tested to remove almost everything from the application. The simplest code I have come up with that causes the exception is

            <c:if test="${4.0>= 3}">This is true!</c:if>

I have suspected old, outdated or jar conflicts but not found any solution. These versions are what I use know:

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>javax.el</groupId>
        <artifactId>javax.el-api</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.0</version>
        <scope>provided</scope>
    </dependency>

What part have I missed?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
buzztr
  • 75
  • 14
  • 3
    You're not supposed to provide JSP and EL libraries yourself via the webapp. This is supposed to be already provided by Tomcat. Remove them or mark them `provided` and retry. – BalusC Sep 12 '17 at 06:52
  • Yes, you were right. Your advice helped me find lots of strange inconsistencies, outdated versions and dependencies in the 100+ pom files of this old project. It took almost a week to find and fix them, but when all this was solved, it worked. – buzztr Sep 19 '17 at 13:56
  • I found a number of other good advice during my search to fix this: [link](https://stackoverflow.com/questions/8701307/the-absolute-uri-http-java-sun-com-jsp-jstl-core-cannot-be-resolved-in-either) [link](https://stackoverflow.com/questions/4928271/how-to-install-jstl-the-absolute-uri-http-java-sun-com-jstl-core-cannot-be-r/4928309#4928309) – buzztr Sep 19 '17 at 14:08

0 Answers0