• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServlet not found on Laptop, but found on Desktop

 
Vince Mansel
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
This thread started here but we have stalled on our efforts to resolve..
http://www.coderanch.com/t/487709/Cattle-Drive/BeeServlet-MVC-again

I would like to re-introduce here for folks that are likely more focused on servlet issues:

I get this error in my browser on one machine (a WinXP laptop), but not on another (a WinXP desktop) with the identical jdk, Orion server and jr.jar files.

http://localhost/servlet/NowServlet

500 Internal Server Error
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)

Configuration:
jdk1.6.0_17 and Orion 2.0.7
jr.jar is located here: http://www.javaranch.com/common.jsp
My CLASSPATH: .;C:\Java;C:\Java\jr.jar;C:\orion\orion.jar

So now that I replicated the issue that I have on a Windows laptop (WinXP Pro, SP3)
and resolved it on my Windows Desktop (WinXP Home, SP2),
the issue appears to be this, in the form of some questions:

Is there a difference between the CLASSPATH used for javac compilation, and the CLASSPATH used
for servlets during runtime?

Is there a procedure for monitoring or determining what is different under-the-hood between my two machines
as it relates to determining where the servlet is looking for HttpServlet?

Supporting Info: Invoking a class that extends HttpServlet directly from my servlet works.
Invoking a class that extends LogServlet (that extends HttpServlet) from my servlet does not work on my laptop.

This is working on laptop and desktop

This works on desktop, but not on laptop...


One other piece of info:

If I replace this in my code:



it yields this on both machines:


If you can help out, I can supply additional orion configuration information as needed.

Thank in advance for pointers or additional help...

Vince

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65125
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a difference between the CLASSPATH used for javac compilation, and the CLASSPATH used
for servlets during runtime?
Absolutely. The having nothing to do with each other. Nothing.

The classpath during run-time consists of standard locations (such as WEB-INF/classes and WEB-INF/lib) and container-specific configuration (such as Tomcat's lib folder).
 
Carol Murphy
village idiot
Bartender
Posts: 1203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vince Mansel wrote:

[/code]
This works on desktop, but not on laptop...
[code]
import java.io.*;
import javax.servlet.http.*;
import java.util.*;
import com.javaranch.common.*;


[/code]




Did you put a copy of com.javaranch.common where it should go on your laptop?

 
Vince Mansel
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
Thanks for confirming my suspicion.... now if I can only figure out where the servlet
is looking for HttpServlet during run-time. HttpServlet lives in the orion.jar.

Does the following code print the runtime classpath? It appears so, and if so, something in my laptop configuration
is blocking access to HttpServlet.




Carol,
Thanks. I think so... My jr.jar file sits in C:/Java/jr.jar which is where com.javaranch.common lives.
If not, the servlet would not compile.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vince Mansel wrote:
Carol,
Thanks. I think so... My jr.jar file sits in C:/Java/jr.jar which is where com.javaranch.common lives.
If not, the servlet would not compile.


Vince, as per the instructions, the jr.jar file is expected to be in the lib folder of orion. So if you have orion installed at C:/orion then jr.jar should be in C:/orion/lib folder.
 
Vince Mansel
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
per the instructions, the jr.jar file is expected to be in the lib folder of orion. So if you have orion installed at C:/orion then jr.jar should be in C:/orion/lib folder.


Thanks Jaikiran.
Yes, jr.jar is also in C:/orion/lib (for runtime as I understand it).

This issue seems to be something else "under the hood" on my laptop.

Just FYI, on my desktop where it works, if I take jr.jar out of C:/orion/lib i get this error:

java.lang.NoClassDefFoundError: com/javaranch/common/LogServlet

On the laptop were it does not work, if I take jr.jar out of C:/orion/lib i get this error:

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

If I trust this, it implies that, on the laptop, LogServlet is "found" but HttpServlet can not be found from that
version of it.

I did a search on my laptop for all instances of jr.jar, I found the culprit here:

C:\Program Files\Java\jre6\lib\ext

This is where my classpath originally pointed but I decided to change it a few days ago and did not delete the jr.jar file
when I moved my classpath to C:/Java?

Now it is deleted, and my servlet works great on my laptop!

My Bee is buzzin'!!!

Thnaks Carol, Jaikiran and Bear.

Vince
 
Carol Murphy
village idiot
Bartender
Posts: 1203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sweet!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic