Problem here is that the Hello.class contains bytecode for the Hello
class, not the bookstore.Hello class. Putting the class file in a
different directory does not change the package - you're trying to
refer to a class by the wrong package name (this is the "wrong name"
error).
In order to get this to run, you'd have to put the bookstore
directory in the classpath, and then have hello.code=Hello in the
servlets.properties file.
>hello.code=bookstore.Hello doesn't seem to be right, as
>bookstore.Hello is not a java code file.
>
>All java gurus, correct me if I am wrong.
>
>-----Original Message-----
>From: Carlos [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, January 31, 2001 1:02 PM
>To: [EMAIL PROTECTED]
>Subject: Help to run Duke's Bookstore
>
>
>This is a simple one.
>Using an all-Sun trivial software ...
>
>I have been able to run a Hello servlet by just placing the classcode
>in the c:\jsdk2.1\examples\WEB-INF\servlets directory
>and calling in Netscape as http://localhost:8080/examples/servlet/Hello
>That's fine.
>
>The trouble with Duke's Bookstore is the same as the Hello example
>when it is located in a sub-directory such as a bookstore.
>So, even before testing the more ellaborate Duke's Bookstore,
>I inserted the line
> hello.code=bookstore.Hello
>in the c:\jsdk2.1\examples\WEB-INF\servlets.properties
>and moved the Hello.class to the
> c:\jsdk2.1\examples\WEB-INF\servlets\bookstore directory,
>restarted the startserver.bat, and calling in Netscape as
>http://localhost:8080/examples/servlet/hello
>
>it produced the following warning:
>Error: 500
>
>Internal Servlet Error:
>
>java.lang.NoClassDefFoundError: bookstore/Hello (wrong name: Hello)
> at java.lang.ClassLoader.defineClass0(Native Method)
>
>What went wrong?
>What else I need to do to make the relocated Hello
> and theDuke's bookstore run?
>
>Thanks for any help.
>Carlos
>PS: Obviously, in the the case of Duke's bookstore I inserted
>servlets.properties
> the relavante excerpt:
>
> # This file contains the properties for the Duke's Bookstore servlets.
>
> # Duke's Book Store -- main page
> bookstore.code=BookStoreServlet
>
> # View all the books in the bookstore
> catalog.code=CatalogServlet
>
> # Show information about a specific book
> bookdetails.code=BookDetailServlet
>
> # See the books that you've chosen to buy
> showcart.code=ShowCartServlet
>
> # Collects information for buying the chosen books
> cashier.code=CashierServlet
>
> # Provide a receipt to the user who's bought books
> receipt.code=ReceiptServlet
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html