-
1. Re: JSP Compiler : cannot be resolved to a type
jaikiran Jun 14, 2011 5:51 AM (in response to ejb3workshop)Is this Windows OS?
-
2. Re: JSP Compiler : cannot be resolved to a type
ejb3workshop Jun 14, 2011 5:56 AM (in response to jaikiran)Yes. Windows 64 bit.
-
3. Re: JSP Compiler : cannot be resolved to a type
jaikiran Jun 14, 2011 6:09 AM (in response to ejb3workshop)See if it's related to https://community.jboss.org/message/563416#563416
-
4. Re: JSP Compiler : cannot be resolved to a type
ejb3workshop Jun 14, 2011 6:22 AM (in response to jaikiran)Looks like a differnt issue. Mine is with standard Java classes.
-
5. Re: JSP Compiler : cannot be resolved to a type
ejb3workshop Jun 15, 2011 12:34 AM (in response to ejb3workshop)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:
1.) header.jspf
<%@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"%>
2.) footer.jspf
</body> </html>
3.) 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.
-
6. Re: JSP Compiler : cannot be resolved to a type
ejb3workshop Jun 15, 2011 3:26 AM (in response to ejb3workshop)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.
-
Defective.war 2.7 KB
-
Working.war 2.7 KB
-
-
7. Re: JSP Compiler : cannot be resolved to a type
jfclere Jun 15, 2011 4:21 AM (in response to ejb3workshop)Hm this has been fixed in jbossweb. Update the jbossweb.jar to the latest that will fix the problem.
-
8. Re: JSP Compiler : cannot be resolved to a type
ejb3workshop Jun 15, 2011 7:14 AM (in response to jfclere)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.
-
9. Re: JSP Compiler : cannot be resolved to a type
jaikiran Jun 15, 2011 8:35 AM (in response to ejb3workshop)By the way, why not just upgrade to JBoss AS 6.0.0.Final, which I guess probably already has this fix?
-
10. Re: JSP Compiler : cannot be resolved to a type
thavaselvan Nov 16, 2012 7:24 AM (in response to ejb3workshop)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
-
11. Re: JSP Compiler : cannot be resolved to a type
jfclere Nov 18, 2012 10:37 AM (in response to thavaselvan)the guess is that you:
1 - didn't remove the old one.
2 - didn't put it in the right profile.
-
12. Re: JSP Compiler : cannot be resolved to a type
thavaselvan Nov 19, 2012 2:06 AM (in response to jfclere)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.
-
13. Re: JSP Compiler : cannot be resolved to a type
jfclere Nov 19, 2012 4:14 AM (in response to thavaselvan)7 No.
The problem is that weblogic server incorrectly import java.util.* (According the specs it shouldn't).
-
14. Re: JSP Compiler : cannot be resolved to a type
thavaselvan Nov 19, 2012 5:39 AM (in response to jfclere)thanks Jean