0
votes

I loaded with loadjava tool Jaybird-3.0.9-JDK_1.8 JDBC driver and my java class to Oracle database. All classes were resolved. When I run Java Stored Procedure from Oracle first time got

error ORA-29532: Java call terminated by uncaught Java exception: java.util.ServiceConfigurationError: org.firebirdsql.gds.impl.GDSFactoryPlugin: Error reading configuration file

when the java application was creating connection.

The next calls with the same Oracle connection lead to

ORA-29532: Java call terminated by uncaught Java exception: java.lang.NoClassDefFoundError

After reconnect I get ServiceConfigurationError exception again. The same code works fine from java. Any good idea? Many thanks

1
Please provide the full exception stacktraces. - Mark Rotteveel
Unfornunately, I see in sqldevelper only ORA-29532: Java call terminated by uncaught Java exception: java.util.ServiceConfigurationError: org.firebirdsql.gds.impl.GDSFactoryPlugin: Error reading configuration file ORA-06512: at "C##AGRO_9.POMPA_PKG", line 71 ORA-06512: at "C##AGRO_9.POMPA_PKG", line 74 ORA-06512: at "C##AGRO_9.POMPA_PKG", line 68 29532. 00000 - "Java call terminated by uncaught Java exception: %s" *Cause: A Java exception or error was signaled and could not be resolved by the Java code. *Action: Modify Java code, if this behavior is not intended. - Altiy Zemlytskiy
Will try to write exception stacktrace to database, good idea - Altiy Zemlytskiy
In any case, the first error seems to indicate that whatever loadjava does, it doesn't correctly store the files in META-INF/services, or the way Oracle classloader works disallows loading those files, as a result, Jaybird can't configure some of its parts. Normally, this would cause a fallback to a built-in list, but it looks like this ServiceConfigurationError is thrown where Jaybird doesn't expect it, and thus it isn't caught. The stacktrace would help me identify the cause and where it is thrown. - Mark Rotteveel
For the moment I can't caught it, but still work on it. Many thanks, will continue - Altiy Zemlytskiy

1 Answers

0
votes

Jaybird loads some of its components as plugins through java.util.ServiceLoader, and if that doesn't work, it will fallback to a fixed list of plugins. Unfortunately, in this case a ServiceConfigurationError was thrown where Jaybird didn't expect it, and thus this error wasn't handled and as a result, the loading of the class GDSFactory was terminated (which causes the subsequent NoClassDefFoundError).

Based on your question, I don't know exactly what this failure is, but at a guess either loadjava or the Oracle classloader seems to have corrupted the service definition file (META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin), or otherwise causes an exception when it is read.

I have created bug JDBC-636, to handle this exception in Jaybird 3.0.10, 4.0.2, and in the upcoming Jaybird 5.

Jaybird 3.0.10 and 4.0.2 have been released, so use those versions instead of the snapshots below.

As long as Jaybird 3.0.10 and 4.0.2 have not been released, you can try the 3.0.10-SNAPSHOT or 4.0.2.java8-SNAPSHOT from the Sonatype snapshot repository (https://oss.sonatype.org/content/repositories/snapshots) using Maven or Gradle. Or you can download the jar directly from the snapshot repository (NOTE: these links will break when newer snapshots have been deployed):