Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Bean class not found  RSS feed

 
Nair Anoop
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • 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).]
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Pranit Saha
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • 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).]

 
Sreenivasa Majji
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I am using Tomcat 4.01.
~ Anoop
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!