14 Replies Latest reply: Nov 19, 2012 5:39 AM by thavaselvan Ayyakannu RSS

JSP Compiler : cannot be resolved to a type

Alexander Hartner Expert

Since upgrading form Jboss 4.2.3 to 5.1 I am no longer able to access the JSP pages

 

In the header.jsp included via prelude in web.xml I am inluding the menu jsp fragment:

 

<%@page contentType="text/html; charset=utf-8"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<jsp:useBean id="now" class="java.util.Date"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<%@include file="menu.jspf"%>
...
</body>
</html>

 

 

And then in menu.jspf

 

<%@page import="java.util.*" %><%
    Map<String, String> menuItems = new LinkedHashMap<String, String>();
...

 

In both files I am inporting the java.util package, however after deployment when I access the page I get the following compilation error

An error occurred at line: 3 in the jsp file: /menu.jspf

Map cannot be resolved to a type

1: <%@page import="java.util.*" %>

2: <%

3:     Map<String, String> menuItems = new LinkedHashMap<String, String>();

I am alos getting other errors that it cant resolve some of my own classed. I tried to fix those by setting the classpath inside the MANIFEST file of my web applications included in the application EAR.

 

EAR:

->WAR1:

-->META-INF/MANIFEST (Contains Class-Path : JAR1)

->WAR2:

-->META-INF/MANIFEST (Contains Class-Path : JAR1)

->JAR:1

-/lib/THIRD_PARTY_LIB1.JAR

-/lib/THIRD_PARTY_LIB2.JAR

-/lib/THIRD_PARTY_LIB3.JAR

 

However since it can't resolve standard java classes like Map, LinkedHashMap and Enumeration I am rather confused as to why this is happening or how I can fix this. I am using JDK 1.5 and JBoss 5.1 GA. I am deploying my EAR to the farm folder.

 

Any suggestion greatly appreciated.