Hi I'm getting following error when I'm trying to access jsp page in my gwt project. Other pages which are not jsp pages are acessing fine.
It is strange that I'm able to see JSP file when GWT SDK is moved to bottom in build path order which is giving another error that GWT SDK is not installed
Can any one help me please ?
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
2016/01/07 14:30:51:128 IST [ERROR] Compiler - Javac exception <Compile failed; see the compiler error output for details.>Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:933)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:379)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
at com.rapapp.gwt.server.common.util.CompressionFilter.doFilter(CompressionFilter.java:113)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at com.rapapp.gwt.server.common.util.CacheFilter.doFilter(CacheFilter.java:69)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
Generated servlet error:
2016/01/07 14:30:51:129 IST [ERROR] Compiler - Env: Compile: javaFileName=/C:/Users/USER/AppData/Local/Temp/jetty-127.0.0.1-8888-war-_-any-//org/apache/jsp\login_jsp.java
As you are not providing login.jsp
file, So I want to share couple of suggestions to solve this issue.
Use latest tomcat - http://www.howopensource.com/2015/07/unable-to-compile-class-for-jsp-the-type-java-util-mapentry-cannot-be-resolved/
The jsp-api
is provided by your Servlet container
. Use at least 2.1
version. Change the dependency in your pom.xml
<dependency> <groupId>javax.servlet</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency>
class name
will be written with package name
. As an example,<%@ page import="com.Test.Person" %> <html> <head></head> <body> <jsp:useBean id="person" class="com.Test.Person" scope="request" /> <jsp:setProperty name="person" property="name" value="Tripti" /> This JSP Page is created by:<jsp:getProperty name="person" property="name" /> </body> </html>
.java
and .class
files generated by the
JSP parser they are used by the web application. Sometimes these get
corrupted or cannot be found. This may occur after a patch or
upgrade that contains modifications to JSPs.Resolution
<JIRA_INSTALL>/work
folder if using
standalone JIRA
or <CATALINA_BASE>/work
if using EAR/WAR
installation.<JIRA_INSTALL|CATALINA_BASE>/work
directory.There are also some other ways--
Classes not within a package are discouraged in modern Java, to the point where they don't work in a number of cases. Put your classes into packages (use a package statement at the top of the .java file)--all of them.
This problem is generated by the default values used by JspServlet, which compiles using 1.4 for source/target values.
You can configure this servlet by adding
<servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>compilerSourceVM</param-name> <param-value>1.5</param-value> </init-param> <init-param> <param-name>compilerTargetVM</param-name> <param-value>1.5</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet>
There is one more issue as you can't configure JspServlet with the current jasper-compiler-5.0.28
. You should download jasper-compiler-5.0.30
and make sure is in your classpath before gwt
. There are other latest jasper compiler jars out-there but i'm not sore of how compatible are with jakarta-tomcat-5.0.28
https://code.google.com/archive/p/raisercostin/wikis/GwtEclipsePluginDebug.wiki
This maybe caused by jar conflict. Remove the servlet-api.jar
in your servlet/WEB-INF/
directory, %Tomcat home%/lib
already have this lib.
Every time I have seen those errors the reason was jasper could not find
the java compiler. Try and put tools.jar
in your common/lib
and see if the
service works then..