Oracle Driver execution results in InvocationTargetException

I have a simple web service that uses an oracle database. When I test the service internally it works fine, however, calling the web service through my client (on the same machine, but in a different WAR) raises an invocationtarget request. I finally found it was a problem with OracleDriver creation. It doesn't throw any exceptions at all, so I can't find out what the error is.

Googling only provided a solution for using oracle.jdbc.driver.OracleDriver instead of oracle.jdbc.OracleDriver, but it doesn't seem to fix anything. I am using the jar file ojdbc14.jar and as far as I can tell it is included in the classpath for the web service correctly ... as it works when I test the service with a simple main method.

EDIT: InvocationTargetException is thrown by AxisFault from Axis server. Invocationtargetexception is a wrapper class and my attempts to try and retrieve the exception using .getCause () always return null.

I am deploying a service using jboss and include the driver JAR file in the library for the source but not the server. Including the driver in / jboss / server / default / lib resolved it.

0


a source to share


2 answers


2 WARS? I assume your ojdbc.jar is inside the WEB-INF / lib of the WAR webservice.

Perhaps your WAR is inside an EAR, so you should reference the driver in MANIFEST.MF.



More information: http://java.sun.com/j2ee/verified/packaging.html

0


a source


It is difficult to give specific proposals without additional information; However, I have had experience with an Oracle driver trying to connect via native OCI libraries, cannot find those libraries installed on the system, and throws InvocationTargetException. This is all from a very vague memory, so your mileage will almost certainly change.

It's been a while, but if I needed memory, I had a case where the connection url was misconfigured and the OracleDriver (or one of its wrappers) repeated a bunch of possible connection methods trying to find the one that worked. in case the url was configured correctly it never got into the OCI attempt (the thin connection method was tried first) but if the connection url was misconfigured the subtle attempt will fail, causing the OCI attempt which also failed because the client OCI was not installed on the host (resulting in an InvocationTargetException.)



So, some things to check:

  • Is the connection URL valid? If you are using the same connection URL in both places, are you sure that both processes are required for the same network adapter? If they are bound to different network adapters, it can cause strange connection tricks even on the same host.
  • Is the environment the same in both cases - If the OCI client is used in your development environment, it probably depends on several environment variables. If these environment variables are not set the same in the environment where the servlet container is running, I would expect different behavior.
0


a source







All Articles