aspose file tools*
The moose likes JSP and the fly likes Some errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Some errors" Watch "Some errors" New topic
Author

Some errors

Stanley Lin
Greenhorn

Joined: Jan 07, 2011
Posts: 12
To dear friend,
I try some examples from the protege directory. It shows plenty of errors.
who can tell me what wrong with it? thanks.

Sincerely,

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 27 in the generated java file
Only a type can be imported. org.apache.log4j.Category resolves to a package

An error occurred at line: 27 in the jsp file: /index.jsp
Category cannot be resolved to a type
24: */
25: %>
26: <%@ page errorPage="errorPage.jsp" contentType="text/html" import="java.net.URI,java.net.URLEncoder,java.net.URLDecoder, java.util.Iterator,webprotege.*,java.util.ArrayList,org.apache.commons.fileupload.*,java.util.List,java.io.*,edu.stanford.smi.protege.model.*,java.util.ArrayList,java.util.Collection,edu.stanford.smi.protege.util.PropertyList,webprotege.util.ProjectWrapper,java.util.HashMap,java.util.zip.*,org.apache.log4j.*,webprotege.util.*,java.util.Date,java.util.Timer,java.text.SimpleDateFormat,org.apache.log4j.Category"%>
27: <%! protected static Category cat;%>
28: <%
29: cat = Category.getInstance("Index.JSP");
30: User user=(User)session.getAttribute("user");


An error occurred at line: 29 in the jsp file: /index.jsp
cat cannot be resolved to a variable
26: <%@ page errorPage="errorPage.jsp" contentType="text/html" import="java.net.URI,java.net.URLEncoder,java.net.URLDecoder, java.util.Iterator,webprotege.*,java.util.ArrayList,org.apache.commons.fileupload.*,java.util.List,java.io.*,edu.stanford.smi.protege.model.*,java.util.ArrayList,java.util.Collection,edu.stanford.smi.protege.util.PropertyList,webprotege.util.ProjectWrapper,java.util.HashMap,java.util.zip.*,org.apache.log4j.*,webprotege.util.*,java.util.Date,java.util.Timer,java.text.SimpleDateFormat,org.apache.log4j.Category"%>
27: <%! protected static Category cat;%>
28: <%
29: cat = Category.getInstance("Index.JSP");
30: User user=(User)session.getAttribute("user");
31: if(user==null){%>
32: <jsp:forward page="login.jsp" />


An error occurred at line: 29 in the jsp file: /index.jsp
Category cannot be resolved
26: <%@ page errorPage="errorPage.jsp" contentType="text/html" import="java.net.URI,java.net.URLEncoder,java.net.URLDecoder, java.util.Iterator,webprotege.*,java.util.ArrayList,org.apache.commons.fileupload.*,java.util.List,java.io.*,edu.stanford.smi.protege.model.*,java.util.ArrayList,java.util.Collection,edu.stanford.smi.protege.util.PropertyList,webprotege.util.ProjectWrapper,java.util.HashMap,java.util.zip.*,org.apache.log4j.*,webprotege.util.*,java.util.Date,java.util.Timer,java.text.SimpleDateFormat,org.apache.log4j.Category"%>
27: <%! protected static Category cat;%>
28: <%
29: cat = Category.getInstance("Index.JSP");
30: User user=(User)session.getAttribute("user");
31: if(user==null){%>
32: <jsp:forward page="login.jsp" />


An error occurred at line: 35 in the jsp file: /index.jsp
cat cannot be resolved
32: <jsp:forward page="login.jsp" />
33: <%}
34:
35: cat.info("Start of index.jsp file");
36: Constants.initialize(getServletContext());
37: String path = getServletContext().getRealPath(Constants.kbPath);
38: cat.debug("path = " + path);


An error occurred at line: 36 in the jsp file: /index.jsp
The type org.apache.log4j.Category cannot be resolved. It is indirectly referenced from required .class files
33: <%}
34:
35: cat.info("Start of index.jsp file");
36: Constants.initialize(getServletContext());
37: String path = getServletContext().getRealPath(Constants.kbPath);
38: cat.debug("path = " + path);
39: HashMap hashMapPrivateProjects=(HashMap)request.getSession().getAttribute("privateProjects");


An error occurred at line: 38 in the jsp file: /index.jsp
cat cannot be resolved
35: cat.info("Start of index.jsp file");
36: Constants.initialize(getServletContext());
37: String path = getServletContext().getRealPath(Constants.kbPath);
38: cat.debug("path = " + path);
39: HashMap hashMapPrivateProjects=(HashMap)request.getSession().getAttribute("privateProjects");
40: File kbDirectory=new File(path);
41: cat.debug("kbDirectory.exists() = " + kbDirectory.exists());


An error occurred at line: 41 in the jsp file: /index.jsp
cat cannot be resolved
38: cat.debug("path = " + path);
39: HashMap hashMapPrivateProjects=(HashMap)request.getSession().getAttribute("privateProjects");
40: File kbDirectory=new File(path);
41: cat.debug("kbDirectory.exists() = " + kbDirectory.exists());
42: if(kbDirectory.exists()){
43: KBManager.setCurrentKbPath(path);
44:


An error occurred at line: 47 in the jsp file: /index.jsp
cat cannot be resolved
44:
45: /** If the SessionClener has not been launched so far, launch it. **/
46: long timeSinceCleanUp=System.currentTimeMillis()-KBManager.timeSessionCleanerLaunched;
47: cat.debug("timeSinceCleanUp = " + timeSinceCleanUp);
48: if(timeSinceCleanUp > Constants.privateFolderTimeOut){
49: /** It will run in the background and execute a cleanup every 24 hours, deleting
50: /*** All files with last modified date is older than 24 hours **/


An error occurred at line: 60 in the jsp file: /index.jsp
cat cannot be resolved
57:
58: /** Save Projects which may have changed **/
59: long timeSinceProjectSave=System.currentTimeMillis()-KBManager.lastTimeProjectSaved;
60: cat.debug("timeSinceProjectSave = " + timeSinceProjectSave);
61: if(timeSinceProjectSave > Constants.projectSaveInterval){
62: KBManager.saveProjects(); // this automatically updates the last time projects were saved
63: }


An error occurred at line: 73 in the jsp file: /index.jsp
cat cannot be resolved
70: parentDir.mkdirs();
71: }catch (Exception ex){
72: ex.printStackTrace();
73: cat.error("KB Dire Error",ex);
74: }
75: // check if we need to move a private ontology into public domain
76: if(request.getParameter("op")!=null && request.getParameter("op").equalsIgnoreCase("makePublic")) {


An error occurred at line: 78 in the jsp file: /index.jsp
cat cannot be resolved
75: // check if we need to move a private ontology into public domain
76: if(request.getParameter("op")!=null && request.getParameter("op").equalsIgnoreCase("makePublic")) {
77: String ontologyName=URLDecoder.decode(request.getParameter("kb"),"UTF-8");
78: cat.info("Move " + ontologyName + " from private to public");
79: // Move the zip file and then extract all the files in the public directory
80: Project project=null;
81: KnowledgeBase knowledgeBase=null;


An error occurred at line: 83 in the jsp file: /index.jsp
cat cannot be resolved
80: Project project=null;
81: KnowledgeBase knowledgeBase=null;
82: project=(Project)hashMapPrivateProjects.get(ontologyName);
83: cat.debug("(Project)hashMapPrivateProjects.get(ontologyName) = " + project);
84: if(project==null) { // this should NEVER happen
85: knowledgeBase=KBManager.openKB(ontologyName);
86: project=knowledgeBase.getProject();


An error occurred at line: 95 in the jsp file: /index.jsp
cat cannot be resolved
92: String zipFileName=project.getName() + ".zip";
93: File zipFile=new File(path + File.separator+ user.getLogin()+File.separator+zipFileName);
94: if(zipFile.exists()) { // move to the public dir
95: cat.info("Moving file to public");
96: cat.info("Extracting Ontology now");
97: KBManager.extractOntology(zipFile.getAbsolutePath(),parentDir.getAbsolutePath(),path + File.separator+ user.getLogin());
98: // Move file to new directory


An error occurred at line: 96 in the jsp file: /index.jsp
cat cannot be resolved
93: File zipFile=new File(path + File.separator+ user.getLogin()+File.separator+zipFileName);
94: if(zipFile.exists()) { // move to the public dir
95: cat.info("Moving file to public");
96: cat.info("Extracting Ontology now");
97: KBManager.extractOntology(zipFile.getAbsolutePath(),parentDir.getAbsolutePath(),path + File.separator+ user.getLogin());
98: // Move file to new directory
99: File newZipFile=new File(parentDir, zipFile.getName());


An error occurred at line: 105 in the jsp file: /index.jsp
cat cannot be resolved
102:
103: // remove private ontology from the session
104: Project tempProject = (Project) hashMapPrivateProjects.remove(ontologyName);
105: cat.debug("ontologyName = " + ontologyName+ " tempProject = "+tempProject);
106: // if(tempProject!=null){
107: // cat.debug("Putting " + tempProject + " in cache .. with key = " + tempProject.getName());
108: // KBManager.putKBInCache(tempProject.getKnowledgeBase(),tempProject.getName()+".pprj");


An error occurred at line: 153 in the jsp file: /index.jsp
cat cannot be resolved
150: ArrayList nkb = (ArrayList)(it.next());
151: if(((String)nkb.get(0)).equalsIgnoreCase("metaproject.pprj"))
152: continue;
153: cat.debug("Displaying a Public Project " + (String)nkb.get(1));
154: cat.debug("Constants.displayKbs " + Constants.displayKbs);
155: String kb = URLEncoder.encode((String)nkb.get(1),"UTF-8");
156: String status="";


An error occurred at line: 154 in the jsp file: /index.jsp
cat cannot be resolved
151: if(((String)nkb.get(0)).equalsIgnoreCase("metaproject.pprj"))
152: continue;
153: cat.debug("Displaying a Public Project " + (String)nkb.get(1));
154: cat.debug("Constants.displayKbs " + Constants.displayKbs);
155: String kb = URLEncoder.encode((String)nkb.get(1),"UTF-8");
156: String status="";
157: String statusColor="";


An error occurred at line: 172 in the jsp file: /index.jsp
cat cannot be resolved
169: Project project = null;
170: KnowledgeBase knowledgeBase=null;
171: String projectFileName=URLDecoder.decode(kb,"UTF-8");
172: cat.debug("Loading Project " + projectFileName);
173: knowledgeBase=KBManager.openKB(projectFileName);
174: if(knowledgeBase!=null){
175: project=knowledgeBase.getProject();


An error occurred at line: 182 in the jsp file: /index.jsp
cat cannot be resolved
179: /* Creating a zip archive for this ontology */
180: String zipFileName=project.getName()+".zip";
181: File zipFile=new File(parentDir,zipFileName);
182: cat.debug("After creating zip file " + zipFile);
183: cat.debug("After creating zip file " + zipFile.exists());
184: if(zipFile.exists()){
185: // dont do anything if the file already exists


An error occurred at line: 183 in the jsp file: /index.jsp
cat cannot be resolved
180: String zipFileName=project.getName()+".zip";
181: File zipFile=new File(parentDir,zipFileName);
182: cat.debug("After creating zip file " + zipFile);
183: cat.debug("After creating zip file " + zipFile.exists());
184: if(zipFile.exists()){
185: // dont do anything if the file already exists
186: }else{


An error occurred at line: 188 in the jsp file: /index.jsp
cat cannot be resolved
185: // dont do anything if the file already exists
186: }else{
187: // create a zip file for this project
188: cat.info(" Zip File Does not exist. Zipping now ... " );
189: byte[] buffer = new byte[18024];
190: ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(zipFile));
191: FileInputStream fileInputStream = new FileInputStream(new File(parentDir,projectFileName));


An error occurred at line: 192 in the jsp file: /index.jsp
cat cannot be resolved
189: byte[] buffer = new byte[18024];
190: ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(zipFile));
191: FileInputStream fileInputStream = new FileInputStream(new File(parentDir,projectFileName));
192: cat.info(" after creating file input stream " );
193: zipOutputStream.setLevel(Deflater.DEFAULT_COMPRESSION);
194: zipOutputStream.putNextEntry(new ZipEntry(kb));
195: cat.info(" zipFileName = " + zipFile.getAbsolutePath() + " projectFileName = " + projectFileName);


An error occurred at line: 195 in the jsp file: /index.jsp
cat cannot be resolved
192: cat.info(" after creating file input stream " );
193: zipOutputStream.setLevel(Deflater.DEFAULT_COMPRESSION);
194: zipOutputStream.putNextEntry(new ZipEntry(kb));
195: cat.info(" zipFileName = " + zipFile.getAbsolutePath() + " projectFileName = " + projectFileName);
196: int len;
197: while ((len = fileInputStream.read(buffer)) > 0)
198: {


An error occurred at line: 237 in the jsp file: /index.jsp
cat cannot be resolved
234: out.println("<tr valign=top> <td><font color=red> "+ projectFileName +": Could Not Open KB ! </font></td></tr>");
235: }
236: }catch(Exception ex){
237: cat.error("Exception in Public Ontology Section",ex);
238: ex.printStackTrace();
239: }
240: }


An error occurred at line: 79 in the jsp file: /privateIndex.jsp
cat cannot be resolved
76: Iterator iter = privateKbs.iterator();
77: while (iter.hasNext()) {
78: ArrayList nkb = (ArrayList)(iter.next());
79: cat.debug("(String)nkb.get(1) = " + (String)nkb.get(1));
80: String kb = URLEncoder.encode((String)nkb.get(1),"UTF-8");
81: if(kb.toLowerCase().endsWith(".owl")){
82: continue;


An error occurred at line: 103 in the jsp file: /privateIndex.jsp
cat cannot be resolved
100: project=knowledgeBase.getProject();
101: }
102: knowledgeBase = project.getKnowledgeBase();
103: cat.debug("project.getName() = " + project.getName());
104: /* Creating a zip archive for this ontology */
105: String zipFileName=project.getName()+".zip";
106: cat.info("before creating new zip file");


An error occurred at line: 106 in the jsp file: /privateIndex.jsp
cat cannot be resolved
103: cat.debug("project.getName() = " + project.getName());
104: /* Creating a zip archive for this ontology */
105: String zipFileName=project.getName()+".zip";
106: cat.info("before creating new zip file");
107: File zipFile=new File(file11,zipFileName);
108: cat.info("After creating new zip file");
109: cat.info("zipFile is " + zipFile + " projectFileName = " + projectFileName);


An error occurred at line: 108 in the jsp file: /privateIndex.jsp
cat cannot be resolved
105: String zipFileName=project.getName()+".zip";
106: cat.info("before creating new zip file");
107: File zipFile=new File(file11,zipFileName);
108: cat.info("After creating new zip file");
109: cat.info("zipFile is " + zipFile + " projectFileName = " + projectFileName);
110: if(zipFile.exists()){
111: // dont do anything if the file already exists


An error occurred at line: 109 in the jsp file: /privateIndex.jsp
cat cannot be resolved
106: cat.info("before creating new zip file");
107: File zipFile=new File(file11,zipFileName);
108: cat.info("After creating new zip file");
109: cat.info("zipFile is " + zipFile + " projectFileName = " + projectFileName);
110: if(zipFile.exists()){
111: // dont do anything if the file already exists
112: }else{


An error occurred at line: 118 in the jsp file: /privateIndex.jsp
cat cannot be resolved
115: FileInputStream fileInputStream = new FileInputStream(path+java.io.File.separator+projectFileName);
116: zipOutputStream.setLevel(Deflater.DEFAULT_COMPRESSION);
117: zipOutputStream.putNextEntry(new ZipEntry(project.getName()+".pprj"));
118: cat.info(" zipFileName = " + zipFile.getAbsolutePath() + " projectFileName = " + projectFileName);
119: int len;
120: while ((len = fileInputStream.read(buffer)) > 0)
121: {


An error occurred at line: 164 in the jsp file: /privateIndex.jsp
cat cannot be resolved
161: out.println("</tr>");
162:
163: }catch(Exception ex){
164: cat.error("Exception while creating zip File",ex);
165: }
166: }
167: %>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:443)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:345)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:341)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Step 1: move all Java code out of the JSP and into a Java class. Putting Java code into a JSP is a poor practice that has been discredited for over 9 years now.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Some errors