Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Bean class not found

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a very simple problem (not for me !) I have JSP with the following header:
<%@ page import="x.y.z.auction.*" errorPage="/error.jsp" %>
<jsp:useBean id="auction" class="AuctionBean" scope="request" />
....
It gives me the error java.lang.ClassNotFoundException: AuctionBean. The AuctionBean.class file is present in auction/WEB-INF/classes/x/y/z
However, if I change the second line in the JSP to
<jsp:useBean id="auction" class="x.y.z.auction.AuctionBean" scope="request" /> it works perfectly.
Why is it not working with only the class name ?
Thanks in advance,
Anoop
[This message has been edited by Nair Anoop (edited November 12, 2001).]
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's the difference between the two second lines?
 
Nair Anoop
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thsnks for pointing out my typo, I have edited the oringinal post to reflect the change in the second line (Where I use the fully qualified class name).
Anoop
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the autoexec.bat specify the classpath as:
set path=c:\..\..\x\y\z;
Hope this will solve ur prob..
Pranit..

Originally posted by Nair Anoop:

The AuctionBean.class file is present in auction/WEB-INF/classes/x/y/z

[This message has been edited by Nair Anoop (edited November 12, 2001).]


 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which Servlet/JSP engine giving this problem?
------------------
Sreenivasa Kumar Majji
Sun Certified Java Programmer
SCJP Mock Test
 
Nair Anoop
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Tomcat 4.01.
~ Anoop
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems to me that your bean class has package statement.
If it does have one then you know that the class is always referred with it's package name where ever you are using it.just importing will not suffice.
note that the built in classes in jdk are placed in packages but they don't have a package statement declared in them.
Hope this helps,
Manjunth
[This message has been edited by Manjunath Subramanian (edited November 13, 2001).]
 
Nair Anoop
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are absolutely right. My Bean class has a package statement so that it is a part of the same package. How can we make it a part of the package without using a package statement. Could you please elaborate on that.
Thanks for your help,
Anoop
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The simplest way (and the only way i know) is to put these classes manually in which ever package you want without giving a package statement in the class

[This message has been edited by Manjunath Subramanian (edited November 13, 2001).]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic