Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 3rd, 2003, 10:03 PM
Registered User
 
Join Date: Aug 2003
Location: , , Canada.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default package not found error

I'm just starting to learn how to use JSP with the book "Beginning JSP Web Development". In Chapter 4, the book introduces JavaBeans, which I am led to believe are merely regular Java programs that are accessible to the JSP pages. I wrote a simple Java program that takes an ID, looks it up in a file, and returns a line from the file if the ID is found.

I then made 2 JSP pages: one allows the user to enter an ID, and when the submit button is clicked, another JSP page is loaded which requests the line from the file.

My JSP files are in the directory /webapps/grades.
My class file is in the directory /webapps/grades/web-inf/classes/com/grades.

When I load the JSP page, it seems to load fine, but when I click submit, I get a package com.grades not found error. Have I done something wrong here?


Reply With Quote
  #2 (permalink)  
Old August 7th, 2003, 01:34 AM
Authorized User
 
Join Date: Jul 2003
Location: kl, kl, Malaysia.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yuji_chen
Default

can u post the error msg n code as well, from the error u get it same like ur servlet container cant find the class file....
hth

regrad
yuji
Reply With Quote
  #3 (permalink)  
Old August 7th, 2003, 09:44 PM
Registered User
 
Join Date: Aug 2003
Location: , , Canada.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's the full message, the bottom portion is just the Java stack trace.


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: -1 in the jsp file: null

Generated servlet error:
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] C:\Tomcat_4_1\work\Standalone\localhost\grades\res ults_jsp.java:51: package com.grades does not exist
    [javac] com.grades.Grades stud = new com.grades.Grades();
    [javac] ^
    [javac] C:\Tomcat_4_1\work\Standalone\localhost\grades\res ults_jsp.java:51: package com.grades does not exist
    [javac] com.grades.Grades stud = new com.grades.Grades();
    [javac] ^
    [javac] 2 errors



        at org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandler.java:130)
        at org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:293)
        at org.apache.jasper.compiler.Compiler.generateClass( Compiler.java:353)
        at org.apache.jasper.compiler.Compiler.compile(Compil er.java:370)
        at org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:473)
        at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:190)
        at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:256)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2415)
        at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:171)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:172)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
        at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
        at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:223)
        at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:594)
        at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:392)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:565)
        at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:619)
        at java.lang.Thread.run(Thread.java:536)

Reply With Quote
  #4 (permalink)  
Old August 8th, 2003, 04:36 PM
Authorized User
 
Join Date: Aug 2003
Location: Coventry, , United Kingdom.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I might be stating the obvious, but is your WEB-INF directory called WEB-INF, or web-inf? Not sure about Tomcat to be honest, but many web containers are case sensitive. WEB-INF should be all caps.

 - Peter

Reply With Quote
  #5 (permalink)  
Old August 9th, 2003, 09:20 PM
Registered User
 
Join Date: Aug 2003
Location: , , Canada.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually, it's called Web-inf because of the DOS naming conventions. I tried forcing it to be called WEB-INF, but it did not seem so want to let me do that.


Reply With Quote
  #6 (permalink)  
Old August 10th, 2003, 03:54 PM
Authorized User
 
Join Date: Aug 2003
Location: Coventry, , United Kingdom.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's a while ago, but I seem to remember that this turned out just to be a representation thing -- when I started out playing with Orion on Win98 a couple of years ago, it could tell the difference between WEB-INF and Web-inf even though they looked the same in Explorer. Really annoying. My current Win2K box and WinME laptop, on the other hand, are both happy showing WEB-INF as WEB-INF.

 - Peter

Reply With Quote
  #7 (permalink)  
Old August 10th, 2003, 04:27 PM
Registered User
 
Join Date: Aug 2003
Location: , , Canada.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, it works now. I'm using a different computer, and it shows file names the way I type them, and it now saves WEB-INF as that.

Reply With Quote
  #8 (permalink)  
Old October 6th, 2003, 09:59 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

pdenhaan, you rule! I've been staring at this same problem on my test server for two days now. When I copied the context from my live server to my test server, WEB-INF turned into web-inf, and I didn't even notice it, and I've been using tomcat on a daily basis for three years now! I thought for sure it must be a bug in tomcat. Then I saw this posting, and thought you were nuts for even suggesting that might be the problem, but sure enough...

nightsurfer, thanks for posting, and pdenhaan, thanks for "stating the obvious". ;)

--John

Reply With Quote
  #9 (permalink)  
Old October 13th, 2003, 10:20 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I also had the same problem.
I changed the properties of file Web-inf to be share as WEB-INF.
This fixed it for me.



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR: Theme cannot be found ppeessaarr ASP.NET 2.0 Professional 2 July 16th, 2007 09:06 AM
Execute Package Error dgosche BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 2 February 13th, 2006 12:14 PM
"Module not found" error, need help flyfish Access 1 April 29th, 2005 06:23 AM
" Error" Page not found shoakat Classic ASP Databases 1 November 15th, 2004 03:59 AM
Page Not Found Error ztz02 Classic ASP Basics 2 June 25th, 2003 08:52 AM



All times are GMT -4. The time now is 11:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.