View Full Version : 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:
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)
vi prego aiutatemi :cry:
^TiGeRShArK^
08-01-2007, 08:48
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:
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)
vi prego aiutatemi :cry:
sicuro di aver rispettato la struttura corretta dei package sotto web-inf/classes? :fagiano:
puoi postare la struttura della directory web-inf?
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:
Report.class
Survey.class
ColumnReport.class
ReportSchema.class
^TiGeRShArK^
08-01-2007, 13:56
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:
Report.class
Survey.class
ColumnReport.class
ReportSchema.class
mmm..sono un pò arruginito con tomcat dato ke è un pò ke nn lo uso....:mbe:
puoi postare il .java generato della JSP tanto per vedere com'è definito l'import e il punto esatto in cui viene generato l'errore?
ehm..e dove lo trovo? :fagiano:
io so solo che nella pagina jsp c'è un'unica riga non html (che è quella che causa l'errore)
<%Report report=new Report();%>
^TiGeRShArK^
08-01-2007, 15:31
ehm..e dove lo trovo? :fagiano:
io so solo che nella pagina jsp c'è un'unica riga non html (che è quella che causa l'errore)
<%Report report=new Report();%>
se non ricordo male dovrebbero essere sotto la cartella "work" di tomcat.
Prova a vedere se la trovi lì...
è proprio li :D
ecco il 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);
}
}
}
^TiGeRShArK^
08-01-2007, 16:30
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 :Prrr:
aggiungendo all'inizio della pagina
<%@page import="Report"%>
l'inizio del .java generato diventa
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import Report;
e mi appare l'errore sulla pagina generata
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
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.