Oracle Java stored librairies won't compile

553 Views Asked by At

I'm looking to store Java libraries inside my Oracle database. Note that this is the first time I'm doing that. That library is pd4ml. It is made up of two jars, which contains the compiled classes.

  • pd4ml.jar
  • ss_css2.jar (required by pd4ml.jar)

As loading them with Toad did not work (Toad said they were loaded successfully, but did they not show up anywhere) I went command line (loadjava) and managed to load ss_css2.jar successfully. All its classes were loaded and compiled.

The second library, pd4ml.jar, was also loaded, but several classes won't compile. I ran ojvmtc to try to resolve references. I got the following message:

The following classes could not be found:

javax/servlet/http/HttpServletResponseWrapper

org/zefer/pd4ml/npdf/parser/c

The first one, if my understanding is correct, should be part of the JRE that is built-in 11g r2. Browsing the sys schema, it does not appear to exist.

The second one is part of the jar library. Now I'm not exactly sure of the structure of compiled Java, I've never had to look into it before, but I have several .class files inside org/zefer/pd4ml/npdf/parser/, these being: c$_b, c$_c.... to c$_g. There is none that is only c.

The library works well on my local machine when passing command line arguments or running it from Eclipse, so it should work. There is no specific error message that shows up when trying to compile them in Toad. I have a feeling it's a dependencies/classpath issue.

Any hints on how I should ensure that classes contained in pd4ml.jar can properly access those in ss_css2.jar , or any potential causes to investigate? Perhaps a way to get detailed error messages from the Java code?

1

There are 1 best solutions below

0
On

The strange class names like c$_b, c$_c.... to c$_g are result of JAR file obfuscation. The obfuscation impacts only non-public classes, so it should not harm.

As I see, in your particular case javax/servlet/http/HttpServletResponseWrapper class is missing (and probably few more) - the classes can be found in servlet-api.jar. Just take the file from any J2EE (or Tomcat) distribution and add the file to your project/application.

In usual scenarios the servlet-api classes are required only when WebApp-specific PD4ML methods are called. And the methods are called only when pd4ml.jar is a part of a web application (that means servlet-api.jar is among the application resources).

As I see now, Oracle database Java sub-system scans for all referenced resources (even if they are not needed in a scenario) and panic if anything is missing.