loadjava Tool causing : ORA-29532: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory

176 views Asked by At

After hours of exhaustive exploration and Oracle Docs and support pages we were unable to solve this issue.

Utility: loadjava

Action: Trying to load a .jar file using loadjava and call Java Class using PL/SQL Api. This java class simply adds a value to JMS queue and return a String with status as SUCCESS. Note: Hello.java worked successfully.

Issue: after a successful load using loadjava, When we execute via Oracle PL/SQL Function, we are getting the following error.

ORA-29532: Java call terminated by uncaught Java exception: javax.jms.JMSRuntimeException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory

Our trials: We thought it is missing some libraries of Weblogic. So we added wlthint3client.jar separately using loadjava utility. We also tried add wlthint3client.jar under "ORACLEHOME\jdk\jre\lib\ext" so that it gets picked up at instance load. But the error keeps happening. We included this as a part of our original jar yet same issue.

We went back to basics, and created both a Hello.java and Hello.class and loaded them using loadjava. With PL/SQL function called this class, and it worked successfully. Only when we load a .jar file it throws this ContextFactory error.

Step 1: under ORACLEHOME command prompt:

loadjava -user userschema/password@instance -verbose -force JMessenger-1.0.jar.

It loaded successfully. Following is the output:

Classes Loaded: 97
Resources Loaded: 13
Sources Loaded: 0
Published Interfaces: 0
Classes generated: 0
Classes skipped: 0
Synonyms Created: 0
Errors: 0

Step 2: Created an PL/SQL function:

CREATE OR REPLACE FUNCTION FUN_CALL_JAVA_TST RETURN VARCHAR2 AS

LANGUAGE JAVA NAME 'xyz.abc.messenger.producer.MessageProducer.testPing() return java.lang.String';

/

Step 3: We wrote a caller:

declare testoutput varchar2(100);

begin testoutput := FUN_CALL_JAVA_TST();

dbms_output.put_line(testoutput);

exception when others then

dbms_output.put_line(sqlerrm);

end;

Same error keeps coming.

  • Java Version in OracleHome installation: java version "1.8.0_201"

  • Java(TM) SE Runtime Environment (build 1.8.0_201-b09)

  • Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode).

So we made sure to use the correct weblogic version libraries.

0

There are 0 answers