Hello, I posted a similar question to the PLSQL group but was directed to this group. A vendor provided four .java files which I've compiled into our database using CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED [schema].[classname]. I did this using Toad. The source files compiled fine and I can see the classes in our schema browser. I created a PLSQL wrapper function to call one of the java methods. When I run that function I get an error. Since that function returns a string, I Googled and found code I could add to a catch{} block to return the stacktrace as a string so I could see what it was. Below is the stack trace.
java.lang.ClassCastException
at javax.crypto.Mac.getInstance(Mac.java:68)
at Util.hmacSign(UTIL:11)
at DuoWeb.signVals(DUOWEB:95)
at DuoWeb.signRequest(DUOWEB:50)
at DuoWeb.signRequest(DUOWEB:26)
I'm predominantly a PLSQL developer and have a beginner knowledge of java so I'm kind of at a loss at what to do past this. The issue appears to originate in the getInstance method of javax.crypto.Mac. However when I compile the java files in a Java IDE (Eclipse) everything works fine and the method returns what is expected. So my question is, is there something that needs to be done or added to the database in order for the classes to run without error? The .java files are Vendor provided so I don't want to modify the source files.
As extra info, we're on an Oracle 11g database and when I run
select dbms_java.get_ojvm_property(PROPSTRING => 'java.version') as jversion from dual;
I get 1.7.0_231 so I believe the database is running Java version 7.
Thanks a bunch for any insight and help you can provide.