Reputation: 2859
I have created Servlet with this archetype: http://maciejwalkowiak.github.io/servlet3-maven-archetype/
mvn archetype:generate \
-DarchetypeGroupId=pl.maciejwalkowiak \
-DarchetypeArtifactId=servlet3-webapp-archetype \
-DarchetypeVersion=1.0.1
then I add index.jsp into src/main/webapp directory
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>hello, world</h1>
</body>
</html>
when I run mvn tomcat7:run
and open http://127.0.0.1/mycontext/index.jsp
this error occurs:
HTTP Status 500 - Unable to compile class for JSP:
type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 1 in the generated java file
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
what is the problem?
I'm using java8 but I have following maven-compiler configuration in my maven:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Upvotes: 1
Views: 1850
Reputation: 573
You should double check your Tomcat version. Tomcat 7.0.32 contains a jar that is not fully compatible with Java 8, so upgrading your Tomcat version might help. Take a look at this.
Upvotes: 2
Reputation: 4011
Which JDK are you using? If it's 8 you will have to update Tomcat to 8 as well. If that's not the case, you should try going to the Project menu and select Clean... from there. Then try also cleaning the Server and the Server Working folder by selecting these options from the right click menu.
Upvotes: 1