|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Aug 2006
Messaggi: 365
|
Tomcat e classi inutilizzabili
Ciao a tutti,
ormai sto impazzendo per cercare di capire dove sbaglio: sto lavorando ad una semplice applicazione web per l'università che consiste in 4 classi java ed un paio di pagine jsp che le sfruttano..premetto che è la prima volta che sviluppo applicazioni web in j2ee, poiché ho sempre usato php.. allora, ho installato tomcat e l'ho connesso con successo ad apache con jk..ho compilato le classi assieme alla libreria xerces che mi serviva per l'applicazione, ho messo le classi compilate in WEB-INF/classes.. quando parte la pagina jsp che istanzia un oggetto usando una delle classi (Report.class) ottengo il seguente errore: Codice:
org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 26 in the jsp file: /reportCreate.jsp Generated servlet error: Report cannot be resolved to a type An error occurred at line: 26 in the jsp file: /reportCreate.jsp Generated servlet error: Report cannot be resolved to a type org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161) |
|
|
|
|
|
#2 | |
|
Senior Member
Iscritto dal: Jul 2002
Città: Reggio Calabria -> London
Messaggi: 12112
|
Quote:
![]() puoi postare la struttura della directory web-inf?
__________________
|
|
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Aug 2006
Messaggi: 365
|
all'interno di WEB-INF/classes vi sono le seguenti classi (tutte sullo stesso livello) le quali non sono state dichiarate come appartenenti ad alcun package:
|
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Jul 2002
Città: Reggio Calabria -> London
Messaggi: 12112
|
Quote:
![]() puoi postare il .java generato della JSP tanto per vedere com'è definito l'import e il punto esatto in cui viene generato l'errore?
__________________
|
|
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Aug 2006
Messaggi: 365
|
ehm..e dove lo trovo?
io so solo che nella pagina jsp c'è un'unica riga non html (che è quella che causa l'errore) Codice:
<%Report report=new Report();%> |
|
|
|
|
|
#6 | |
|
Senior Member
Iscritto dal: Jul 2002
Città: Reggio Calabria -> London
Messaggi: 12112
|
Quote:
Prova a vedere se la trovi lì...
__________________
|
|
|
|
|
|
|
#7 |
|
Senior Member
Iscritto dal: Aug 2006
Messaggi: 365
|
è proprio li
ecco il codice: Codice:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class reportCreate_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.List _jspx_dependants;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n");
out.write("\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml-strict.dtd\">\n");
out.write("<html>\n");
out.write(" \n");
out.write("\t<head>\n");
out.write("\t\t<title>eGif - Area Reporting</title>\n");
out.write("\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n");
out.write("\t\t<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">\n");
out.write(" </head>\n");
out.write("\t\n");
out.write("\t<body>\n");
out.write(" \t\n");
out.write("\t\t<div id=\"header\">\n");
out.write("\t\t\t<h1 id=\"title\"><span>eGif - Area Reporting</span></h1>\n");
out.write("\t\t</div>\n");
out.write(" \t\n");
out.write("\t\t<div id=\"menu_bar\">\n");
out.write("\t\t\t<ul>\n");
out.write("\t\t\t\t<li><a href=\"./index.html\">Home</a></li>\n");
out.write("\t\t\t\t<li><a href=\"./createCompiledSurveys.html\">Crea questionari</li>\n");
out.write("\t\t\t\t<li><a href=\"\">Visualizza report esistenti</a></li>\n");
out.write("\t\t\t</ul>\n");
out.write("\t\t</div>\n");
out.write("\t\t\n");
out.write("\t\t");
Report report=new Report();
out.write("\n");
out.write("\t\t\n");
out.write("\t\t<div id=\"content\">\n");
out.write("\t\t</div>\n");
out.write("\t\t\t\n");
out.write("\t</body>\n");
out.write("</html>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
|
|
|
|
|
|
#8 |
|
Senior Member
Iscritto dal: Jul 2002
Città: Reggio Calabria -> London
Messaggi: 12112
|
e infatti manca l'import x la tua classe Report nel file generato....
qdo torno a casa se ho un pò di tempo gli do un'okiata.. certo ke qualcuno meno arruginito di me sulle JSP potrebbe anke dare una mano
__________________
|
|
|
|
|
|
#9 |
|
Senior Member
Iscritto dal: Aug 2006
Messaggi: 365
|
aggiungendo all'inizio della pagina
Codice:
<%@page import="Report"%> Codice:
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import Report; Codice:
org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: The import Report cannot be resolved An error occurred at line: 27 in the jsp file: /reportCreate.jsp Generated servlet error: Report cannot be resolved to a type An error occurred at line: 27 in the jsp file: /reportCreate.jsp Generated servlet error: Report cannot be resolved to a type |
|
|
|
|
|
#10 |
|
Senior Member
Iscritto dal: Aug 2006
Messaggi: 365
|
qualche idea?
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 04:43.





















