After adding REST web services through NetBeans index.jsp no longer runs, throws error:org.apache.jasper.JasperException: Unable to compile class for JSP

View: New views
3 Messages — Rating Filter:   Alert me  

After adding REST web services through NetBeans index.jsp no longer runs, throws error:org.apache.jasper.JasperException: Unable to compile class for JSP

by gf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry all for the cross post. I posted this under nbusers yesterday and this morning I realized there was a J2ee forum.

Here is my post:

Hello all,
I have a problem with my web-application.
I created a RESTful web service using Netbeans 6.1. This works fine.
I tried to access index.jsp and get a .
org.apache.jasper.JasperException: Unable to compile class for JSP

The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory.


I tried a few things to resolve my problem, but I still get the error(see full stack trace below):
org.apache.jasper.JasperException: Unable to compile class for JSP
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory.


Here is what I did to test:
In Netbeans 6.1
1. Create a new general web application, named it and selected Apache Tomcat 6.0.16 (the integrated one), select NO frameworks.
2. Test index.jsp (the one created by default), received "Hello World". [so far so good]
3. Right clicked on project root (in projects tab) and selected "New RESTful web services from patterns".
4. Select Container-item, clicked Next.
5. accepted defaults for all except created a custom Resource Package location.
6. Clicked finish.
7. Restarted tomcat and ran index.jsp received "Hello World" again.
8. Right click project root and select "Clean and Build".
9. Restarted Tomcat and ran index.jsp and received the following error again:
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 22 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

Libraries installed in this project are:
Jersey (JSR 311-RI) Libraries (Installed by Net Beans when creating REST web services).

Any Ideas?
Google search did not return anything relavent.
Seems like this could be a bug as I did nothing extra after Netbeans did its thing, dunno.
Perhaps someone else could try the above as it only takes less than a minute or two to duplicate.
TIA!

Re: After adding REST web services through NetBeans index.jsp no longer runs, throws error:org.apache.jasper.JasperException: Unable to compile class for JSP

by maniezhilan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Please remove the javaee.jar from your project lib. It clashes with jsp-api.jar, servlet-api.jar


gf wrote:
Sorry all for the cross post. I posted this under nbusers yesterday and this
morning I realized there was a J2ee forum.

Here is my post:

Hello all,
I have a problem with my web-application.
I created a RESTful web service using Netbeans 6.1. This works fine.
I tried to access index.jsp and get a .

org.apache.jasper.JasperException: Unable to compile class for JSP

The method getJspApplicationContext(ServletContext) is undefined for
the type JspFactory.



I tried a few things to resolve my problem, but I still get the error(see
full stack trace below):

org.apache.jasper.JasperException: Unable to compile class for JSP
The method getJspApplicationContext(ServletContext) is undefined for
the type JspFactory.



Here is what I did to test:
In Netbeans 6.1
1. Create a new general web application, named it and selected Apache Tomcat
6.0.16 (the integrated one), select NO frameworks.
2. Test index.jsp (the one created by default), received "Hello World". [so
far so good]
3. Right clicked on project root (in projects tab) and selected "New RESTful
web services from patterns".
4. Select Container-item, clicked Next.
5. accepted defaults for all except created a custom Resource Package
location.
6. Clicked finish.
7. Restarted tomcat and ran index.jsp received "Hello World" again.
8. Right click project root and select "Clean and Build".
9. Restarted Tomcat and ran index.jsp and received the following error
again:
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 22 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for the
type JspFactory

Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

Libraries installed in this project are:
Jersey (JSR 311-RI) Libraries (Installed by Net Beans when creating REST web
services).

Any Ideas?
Google search did not return anything relavent.
Seems like this could be a bug as I did nothing extra after Netbeans did its
thing, dunno.
Perhaps someone else could try the above as it only takes less than a minute
or two to duplicate.
TIA!

Re: After adding REST web services through NetBeans index.jsp no longer runs, throws error:org.apache.jasper.JasperException: Unable to compile class for JSP

by maniezhilan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi ,

Make sure u remove the jsp-api.jar added by the jersey libraries. Since tomcat also has one jsp-api.jar.


gf wrote:
Sorry all for the cross post. I posted this under nbusers yesterday and this
morning I realized there was a J2ee forum.

Here is my post:

Hello all,
I have a problem with my web-application.
I created a RESTful web service using Netbeans 6.1. This works fine.
I tried to access index.jsp and get a .

org.apache.jasper.JasperException: Unable to compile class for JSP

The method getJspApplicationContext(ServletContext) is undefined for
the type JspFactory.



I tried a few things to resolve my problem, but I still get the error(see
full stack trace below):

org.apache.jasper.JasperException: Unable to compile class for JSP
The method getJspApplicationContext(ServletContext) is undefined for
the type JspFactory.



Here is what I did to test:
In Netbeans 6.1
1. Create a new general web application, named it and selected Apache Tomcat
6.0.16 (the integrated one), select NO frameworks.
2. Test index.jsp (the one created by default), received "Hello World". [so
far so good]
3. Right clicked on project root (in projects tab) and selected "New RESTful
web services from patterns".
4. Select Container-item, clicked Next.
5. accepted defaults for all except created a custom Resource Package
location.
6. Clicked finish.
7. Restarted tomcat and ran index.jsp received "Hello World" again.
8. Right click project root and select "Clean and Build".
9. Restarted Tomcat and ran index.jsp and received the following error
again:
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 22 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for the
type JspFactory

Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

Libraries installed in this project are:
Jersey (JSR 311-RI) Libraries (Installed by Net Beans when creating REST web
services).

Any Ideas?
Google search did not return anything relavent.
Seems like this could be a bug as I did nothing extra after Netbeans did its
thing, dunno.
Perhaps someone else could try the above as it only takes less than a minute
or two to duplicate.
TIA!