• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Suffering Reverse(s) [Servlets-2]

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
village idiot
Posts: 1207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carol Murphy wrote:Doncha love it when you figure it out!


Yes indeed. It feels so good when we stop!
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a 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
    Bookmark Topic Watch Topic
  • New Topic