Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Cannot compile class using JSP

I am a student who just study JSP not more than 1 month. I have a problem which is difficult for me to tackle. The problem is:

I try to run a program. However, after running in Tomcat 4.1.18, it generates the error message. Is it the problem of missing .jar file? Or others? Please help me to solve. Thanks a lot!

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

An error occurred at line: 0 in the jsp file: /jsp/sample1.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\jspsmartfile\jsp\sample1_jsp.java:7: package com.jspsmart.file does not exist
import com.jspsmart.file.*;
^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\jspsmartfile\jsp\sample1_jsp.java:42: package com.jspsmart.file does not exist
com.jspsmart.file.SmartFile mySmartFile = null;
^



An error occurred at line: 0 in the jsp file: /jsp/sample1.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\jspsmartfile\jsp\sample1_jsp.java:44: package com.jspsmart.file does not exist
mySmartFile = (com.jspsmart.file.SmartFile) pageContext.getAttribute("mySmartFile", PageContext.PAGE_SCOPE);
^



An error occurred at line: 0 in the jsp file: /jsp/sample1.jsp

Generated servlet error:
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\jspsmartfile\jsp\sample1_jsp.java:47: package com.jspsmart.file does not exist
mySmartFile = (com.jspsmart.file.SmartFile) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.jspsmart.file.SmartFile");
^
4 errors


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:340)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
0
piglegshing
Asked:
piglegshing
1 Solution
 
mglxxxCommented:
The error seems to be due to a missing jar.
Do you know which jar contains the package com.jspsmart.file? Put that jar into WEB-INF\lib
directory under your context root (should
be C:\Program Files\Apache Group\Tomcat 4.1\webapps\jspsmartfile\WEB-INF\lib on your machine).
The jar needs to have the extension 'jar'. If it's a
'zip' change the file's extension to 'jar'
when you copy it to the 'lib' directory.

After a Tomcat restart you should be in business.
0
 
kennethxuCommented:
download jspsmartfile if you haven't did so, from http://www.jspsmart.com/

put the downloaded jar file into
<tomcat-install-dir>\webapps\XXX\WEB-INF\lib
XXX is where your jsp page under.
0
 
cheekycjCommented:
step by step install/config guide to jspsmartupload:
http://www.jspsmart.com/liblocal/docs/en/jspsmartupload/help/setup.htm#Overview
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
kennethxuCommented:
I think you have already downloaded jspSmartFile.zip, so

1. unzip it to a directory say "smartfiledownload"
2. copy whole dir jspsmartfile to <tomcat-install-dir>/webapps
3. (important) open DOS windows and CD to <tomcat-install-dir>/webapps/jspsmartfile, issue command "ren Web-inf WEB-INF", because tomcat4 is case sensitive.
4. start or restart your tomcat

let us know if you still have problem. thanks.
0
 
cheekycjCommented:
pigleshing:  The directions from jspsmart.com should work.  Hava you tried those.  They are very simple and straightforward.

CJ
0
 
kennethxuCommented:
CJ, he's looking for jspsmartFILE, not jspsmartUPLOAD :)
0
 
kennethxuCommented:
CJ, let's don't confuse him. I personally just tried jspsmartfile and it seems that the zip file has case problem need to be fixed during installation.

pigleshing, try out the steps I gave you and let us know if you still have problem.
0
 
cheekycjCommented:
your telling me that the people who developed the library don't have correct instructions.

If they didn't they would have so many complaints that they would be forced to fix the instructions.

All I am saying is, follow what they "officially" tell you to do.  If that doesn't work, that is when you try other solutions.

Why try a home made recipe when the offical one hasn't been tried yet.

CJ
0
 
kennethxuCommented:
CJ, have you read the instruction? I did. the instruction is for tomcat 3.0, it also ask you to install apache web server 1.3. are you suggesting to downgrade to tomcat3 and install apache 1.3?

the FACT is tomcat 3.0 is not dir name case sensitive but 4.1 does!

I have just installed it and it is running on my tomcat 4.1.18, the only change I have to made is rename the web-inf dir to all uppercase.
0
 
kennethxuCommented:
CJ: in addtion, the link you provided is to doc of jspsmartUPLOAD, which is not what we are talking about.
0
 
piglegshingAuthor Commented:
You are very helpful. If you do not minded, I may have other questions to ask you. Please forgive me!!
0
 
kennethxuCommented:
no problem, just post a comment.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now