Calling class from servlet gives 500

I have a servlet that works fine by itself, and another class that works fine by itself. However, when I try to create a new instance of the class using the servlet and access a method in the class such as:

Servlet code

Object a = new Object()

a.method

the server returns 500.

Is there some security aspect to calling classes from servlets that may be causing this?

[402 byte] By [Quasara] at [2007-10-2 4:44:24]
# 1
The method might be throwing an exception.
hermionea at 2007-7-16 0:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
What does the server log say?
hermionea at 2007-7-16 0:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
no, it means that either you deployed it incorrectly or you gave the wrong URL to invoke it.%
duffymoa at 2007-7-16 0:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Thanks for the replies which have tracked the problem down.

The Server log says:

NoClassDefFoundError: oracle/jdbc/driver/OracleDriver

This class is needed by the class being called by the servlet.

The missing class is in a jar file which is put on the classpath when running the class in a standalone environment. I don't know if it's possible to put this jar on the classpath in the Server environment.

However a solution is to explode the jar file and put the exploded classes in the WEB-INF/classes of the Server. The only disadvantage is that they get wiped out every time I re-deploy the application war file.

Quasara at 2007-7-16 0:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Yes, it's possible to put the jar file in your classpath in a servlet environment. Put it in the WEB-INF/lib directory.
DrClapa at 2007-7-16 0:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Thanks. That's a much easier way of doing it.
Quasara at 2007-7-16 0:49:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...