Two Laptop Bag*
The moose likes Cattle Drive and the fly likes Suffering Reverse(s) [Servlets-2] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Suffering Reverse(s) [Servlets-2]" Watch "Suffering Reverse(s) [Servlets-2]" New topic
Author

Suffering Reverse(s) [Servlets-2]

Ed Connery
Ranch Hand

Joined: Mar 11, 2010
Posts: 70
I have Reverse working.

Ignoring "if it ain't broke" (or at least "if it ain't nitpicked yet"), I wanted add it to the same package used for the second version of BeeServlet and I wanted to use what may be a more elegant version using one of the classes in jr.jar.

I renamed the file and class to Reverse2 so that I wouldn't screw up the working version. [I will rename it back before confusing myself on Servlet-3.] I also created reverse2.html with " action='/servlet/Reverse2' "

jr.jar is in C:\Java and I'm successfully using two classes from it in DaysOld.

Using package com.javaranch.drive, I put Reverse2.class in:

C:\Orion\default-web-app\WEB-INF\classes\com\javaranch\drive

I edited C:\Orion\default-web-app\WEB-INF\web.xml accordingly. This had worked fine for the second version of BeeServlet (the packaged version).
When I hit "submit" from reverse2.html I got:

ClassNotFoundException: com.javaranch.common.Str

I tried copying Str.class into the directory with Reverse2.class. Same result.
I tried copying jr.jar into C:\Orion\default-web-app\WEB-INF\classes (meaning just above the \com folder). Same result.

I commented out the package statement, compiled, and placed the new class file in

C:\Orion\default-web-app\WEB-INF\classes

(removing the prior version from "drive" and removing Reverse2 from web.xml). Once again:

ClassNotFoundException: com.javaranch.common.Str

This occurred with both locations of jr.jar. I am at a loss again.

[Edit] Yes, I do have "import com.javaranch.common.*;"

[Edit2] OK, this is mildly embarassing. I'm fairly stubborn about finishing one problem before reading about the next, but I just decided to read on to the next assignment, and at the end of the MVC2 material I found:
"We need to make sure that when orion runs this program it can find the JavaRanch stuff. Copy jr.jar to c:\orion\lib\jr.jar (.jar is the name usually used for a collection of Java stuff. Sometimes we use .zip on JavaRanch because some browsers will garble a .jar file when downloaded - orion expects .jar)."


Guess what worked...
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1194
OMG! You had me ROFLMAO!

Been where you were, done that very thing!
Doncha love it when you figure it out!
Ed Connery
Ranch Hand

Joined: Mar 11, 2010
Posts: 70
Carol Murphy wrote:Doncha love it when you figure it out!

Yes indeed. It feels so good when we stop!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Suffering Reverse(s) [Servlets-2]
 
Similar Threads
Updated servlets assignment page
MVC2-buzz-buzz
My BeeServlet won't buzz
Stuck on MVC BeeServlet Example
BeeServlet and MVC2... again