Is this Windows OS?
Yes. Windows 64 bit.
Looks like a differnt issue. Mine is with standard Java classes.
I made some progress on this issue, however I am not convinced that this is the best solution, nor why this only happens with JBoss 5.1 and not JBoss 4.2.3 or other application server.
My web application consists of the following components:
<%@page contentType="text/html; charset=utf-8"%> <%@page pageEncoding="UTF-8"%> <%@page import="java.util.*"%> <%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core" %> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <!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" /> <title>The Title</title> </head> <body> <%@include file="menu.jspf"%>
<%@page import="java.util.*" %> <% Map<String, String> menuItems = new LinkedHashMap<String, String>(); ... %> ...
4.) Many other pages which obtain the header and footer via prelude and code defined in web.xml.
<div> Some JSP page </div>
This worked great in JBoss 4.2.3 however in JBoss 5.1 it stopped working. For some reason the JSP compiler was no longer able to combine all the various import statements correctly. What I had to do to get it working in 5.1 was to add all the required import statements in each JSP page, even though none of them were directly used in the page itself, but only in the related pages
4.) A simple page fixed for 5.1 with import statement
<%@page import="java.util.*"%> <div> Some JSP page </div>
I am not sure if it worked in 4.2.3 due to a loose interpretation of the specification, however this method also worked on other application servers, with 5.1 being the exception. Previously the import in the header page seem sufficient to apply to all pages to which the header was applicable.
I would be most grateful for any insight into this matter and possible alternative solutions.
I created a simple application to illustrate the problem.
The Working.war file specified the page imports on the index.jsp page while the Defective.war specifies the imports on the included header page.
The following error is reported with the defective application:
An error occurred at line: 13 in the jsp file: /header.jspf Map cannot be resolved to a type 10: <body> 11: <h1>Header</h1> 12: <% 13: Map map = new HashMap(); 14: map.put("A", "A"); 15: map.put("B", "B"); 16: map.put("C", "C");
I had a look a the JSP specification (jsp-2_1-fr-spec.pdf) and found the following under the page import directive:
Page authors may use the include-prelude feature (see Section JSP.3.3.5, “Defining Implicit Includes”) in order to have additional packages imported transparently into their pages.
This seems to suggest that what I am trying to do is directly supported by the specification, even though I have to admit it is not very clearly worded.
I also tested this with JBoss 6 and JBoss 5.1 EAP and did not encounter this issue.
Appreciate any input in this issue.
Hm this has been fixed in jbossweb. Update the jbossweb.jar to the latest that will fix the problem.
Thanks. Where do I get this jar (jbossweb.jar) from ? I downloaded https://repository.jboss.org/nexus/content/repositories/releases/jboss/web/jbossweb/ and replaced the jbossweb.jar with jbossweb-2.1.7.GA.jar. This resolved my problem.
By the way, why not just upgrade to JBoss AS 6.0.0.Final, which I guess probably already has this fix?
I replaced jbossweb.jar with jbossweb-2.1.7.GA.jar still I am getting the same error in jboss-5.1.0.GA server
the guess is that you:
1 - didn't remove the old one.
2 - didn't put it in the right profile.
1 - our application deployed in server/default/deploy
2 - I replaced jbossweb.jar with jbossweb-2.1.7.GA.jar in server/default/deploy
3 - nohup log changes get reflected -> Starting Servlet Engine: JBoss Web/2.1.7.GA
4 - still getting the same error
An error occurred at line: 2,477 in the jsp file: /jsp/CustomerView.jsp
Vector cannot be resolved to a type
2477: Vector lv_kwg18_con = customer.getkwg18_conf();
2478: for(int k1=0;k1<lv_kwg18_con.size();k1+=2)
5. Note Its working fine in weblogic server, without importing java.util.* package.
6. If I import java.util.*, then its working fine.
7. any way to solve this issue without importing util package in jsp in JBOSS 5.2 server.
The problem is that weblogic server incorrectly import java.util.* (According the specs it shouldn't).