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
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Suffering Reverse(s) [Servlets-2]" Watch "Suffering Reverse(s) [Servlets-2]" New topic

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, I put Reverse2.class in:


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


(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

Joined: Mar 15, 2001
Posts: 1202
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:
subject: Suffering Reverse(s) [Servlets-2]
It's not a secret anymore!