softlab Posted November 17, 2011 Posted November 17, 2011 Hi. I'm softlab on johnny and I have a problem. I FTPed my java classes and jars in my "public_html" folder. When I connect to the index.jsp page (directly present under the "public_html" folder), all is ok. When from the index.jsp page I try to load another JSP, which is in a subfolder of the "public_html" folder and imports classes from the jars (present in the "WEB-INF\lib" folder) or any java class in the "WEB-INF\classes" folder, referencing in the import the package they belong (), on the instantiation of the class (FunzioniSessione f = new FunzioniSessione() I get the following error: An error occurred at line: 6 in the generated java fileOnly a type can be imported. it.swlab.util.FunzioniSessione resolves to a package. What is the problem? Java classes and JSP files are under my "public_html" folder, with the structure they have under tomcat (JSPs directly under the "public_html" folder or in its subfolders, java classes in the "WEB-INF\classes" folder and in its subfolders, organized in packages, JARs in the with "WEB-INF\lib" folder). Thanks in advance softlab
softlab Posted November 18, 2011 Author Posted November 18, 2011 Home page is showing correctly, wher I click on "infocar" then happens what described in the topic.
softlab Posted November 19, 2011 Author Posted November 19, 2011 I just saw that link in the past; I tried adding ";" after the last import statement, but no changes. I use NetBeans, and running my web-app under NetBeans doesn't get any error. My JSP pages, apart from the first index.jsp (which is directly under my "public_html" folder), are in subfolders of my "public_html" folder; JARs are in my WEB-INF\lib subfolder. Any other suggestions?
Guest xaav Posted November 24, 2011 Posted November 24, 2011 I can't think of anything else that might be causing the problem. Perhaps there is a log that I can look at?
softlab Posted November 24, 2011 Author Posted November 24, 2011 I have no access to Tomcat logs, whatever log file could I have?
Guest xaav Posted November 25, 2011 Posted November 25, 2011 Upon looking at the logs, I was unable to find any messages that were related to your site.
softlab Posted November 25, 2011 Author Posted November 25, 2011 Here's what happens:- connect to http://softlab.heliohost.org/index.jsp- click on "Infocar" on the right bar. Below is what I get; I want just to point out that "it.jTools.util.FunzioniSessione" is a classs residing in the package "it.jTools.util" (file jTools.jar), present in my "public_html\WEB-INF\lib" folder. HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 6 in the generated java fileOnly a type can be imported. it.jTools.util.FunzioniSessione resolves to a package An error occurred at line: 7 in the jsp file: /index.jspFunzioniSessione cannot be resolved to a type4:
Guest xaav Posted November 25, 2011 Posted November 25, 2011 Sorry, wrong file. Here is the full output shown in the logs: Nov 25, 2011 8:43:42 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 6 in the generated java file Only a type can be imported. it.jTools.util.FunzioniSessione resolves to a package An error occurred at line: 7 in the jsp file: /index.jsp FunzioniSessione cannot be resolved to a type 4: <% 5: synchronized(this) 6: { 7: FunzioniSessione funzioniSessione = new FunzioniSessione(); 8: String percorso = config.getServletContext().getRealPath("/"); 9: funzioniSessione.inizializza(session,request,response,percorso,"infocar"); 10: boolean connesso = session.getAttribute("utenteConnesso") != null; An error occurred at line: 7 in the jsp file: /index.jsp FunzioniSessione cannot be resolved to a type 4: <% 5: synchronized(this) 6: { 7: FunzioniSessione funzioniSessione = new FunzioniSessione(); 8: String percorso = config.getServletContext().getRealPath("/"); 9: funzioniSessione.inizializza(session,request,response,percorso,"infocar"); 10: boolean connesso = session.getAttribute("utenteConnesso") != null; Stacktrace: at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:451) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:307) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:775) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:662) Have you considered jTools.jar might be corrupted or something?
softlab Posted November 27, 2011 Author Posted November 27, 2011 I considered this, but in my environment (NetBeans 7.0.1, Tomcat 7.0.14, Java 1.6.0_27) all is ok. Also sounds strange to me that a different version of Tomcat could cause all these problems.
Guest xaav Posted November 27, 2011 Posted November 27, 2011 Maybe you could try asking on a Java forum?
softlab Posted November 30, 2011 Author Posted November 30, 2011 Yes, I tried. The most significant suggestions were to be sure my JARs were in the classpath (I hope WEB-INF\lib is in the classpath) and to put a ";" after the last "import" statement (tried, with no success); one wanted to see Tomcat logs, but I have no access to them (I tried to ask your forum if I could have control on my context, such as stopping, starting and restarting it, but you said it is not possible).Is my context structure correct (all JSPs and java classes and packages under public_html, JSPs with other subfolders, JARs in WEB-INF\lib subfolder, java classes in WEB-INF\classes subfolder, with other subfolders for java packages).Thanks
softlab Posted December 2, 2011 Author Posted December 2, 2011 Just to be precise: in my last post I wanted to ask a question, but I missed the question mark. So I repost it correctly. Is my context structure correct (all JSPs and java classes and packages under public_html, JSPs with other subfolders, JARs in WEB-INF\lib subfolder, java classes in WEB-INF\classes subfolder, with other subfolders for java packages)? Thanks
Guest xaav Posted December 2, 2011 Posted December 2, 2011 It appears to be correct. Have you tried running your application locally?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now