zjffdu
zjffdu

Reputation: 28794

Throw exception when using maven with eclipse in web-app

I want to use maven integrated with eclipse to develop webapp according this tutorial: http://jacksonps4.me/wordpress/?p=868

But when I open jsp page, it throw NullPointerException as following

SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
    at org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)
    at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
    at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:338)

I googled this bug, it seems that this is caused by put jsp-api.jar under WEB-INF/lib

But actually I did not do that, even when I move the jsp-api dependency from maven, the exception still come out. How can I solve it?

Upvotes: 1

Views: 819

Answers (1)

BalusC
BalusC

Reputation: 1108712

It can also be caused by putting it in lib folder of the JDK/JRE of the machine, which is also covered by the webapp's runtime classpath. It can also be caused by having servlet-api from a different servletcontainer make/version somewhere in the runtime classpath.

I don't do Maven, but I believe that you have to specify them as provided scope in order to not have them to end up in /WEB-INF/lib of the build.

Upvotes: 1

Related Questions