I am trying to get eclipse neon EE ready for making a JSP/Servlet dynamic web project but it just won't cooperate with me.
this is day 3, i read many manuals and searched online and managed to get it working to a certain extent, but I am stumped now and so much time is lost yet i still haven't even started working on the project!
What I am using is:
- Tomcat v8.0.
- Jre jre1.8.0_101
- Eclipse Java EE IDE for Web Developers (Neon.1 Release (4.6.1) )
now the main problem is that the server won't recognize the Servlets, it also would not accept class calls from within JSP files.
The IDE shows that there is a Servlet and the Servlet mapping in the deployment descriptor but it would still give me a 404
error, i checked inisde the WEB-INF
and there was no web.xml
file so i created it and set the mapping manually yet to no avail.
<servlet>
<servlet-name>ShowText</servlet-name>
<servlet-class>test.ShowText</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ShowText</servlet-name>
<url-pattern>.ShowText</url-pattern>
</servlet-mapping>
Error:
HTTP Status 404 - /sem6/Tomcat-8.0/webapps/sem6/.ShowText
type Status report
message /sem6/Tomcat-8.0/webapps/sem6/.ShowText
description The requested resource is not available.
--------------------------------------------------------------------------------
Apache Tomcat/8.0.37
As for class calls when i call it inside the IDE it recognizes it and auto-completes it and shows no errors, yet the JSP page shows me an error:
An error occurred at line: 4 in the jsp file: /Tomcat-8.0/webapps/sem6/index.jsp
Constants cannot be resolved to a type
1:
2: <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
3: pageEncoding="ISO-8859-1" import="base.Constants" %>
4: <%! Constants c = new Constants(); %>
5: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
6: <html>
7: <head>
An error occurred at line: 4 in the jsp file: /Tomcat-8.0/webapps/sem6/index.jsp
Constants cannot be resolved to a type
1:
2: <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
3: pageEncoding="ISO-8859-1" import="base.Constants" %>
4: <%! Constants c = new Constants(); %>
5: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
6: <html>
7: <head>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:198)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.37 logs.
What is wrong here? why is it doing this?I couldn't get it working at all!
Is there a step by step easy configuration that i can follow for an easy set up?
i want a full integration of the server and the IDE, the IDE still creates the server configuration in a folder in the workspace which bothers me.. but it only contains server configurations