Search code examples
jndicorbaweblogic11gjava-11

Simple JNDI lookup from JDK 11 client to Weblogic 10.3.6 (JDK 7) server not working


Server Environment: Weblogic 10.3.6, JDK 1.7

I have a simple working Java SE client application runing with JDK 7. In client I am doing very simple JNDI look of a resource hosted server mentioned above.

Jars in ClassPath: wlthint3client.jar

public static void main(String[] args) throws Exception {
    Hashtable t = new Hashtable();
    t.put(InitialContext.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    t.put(InitialContext.PROVIDER_URL, "t3://localhost:7003/");
    InitialContext ic = new InitialContext(t);

    String jndiName = "weblogic.jdbc.DataSource.Workflow";

    Object obj = ic.lookup(jndiName);
    System.out.println("Found it");
}

I have to upgrade my working Java SE client application from JDK 7 to JDK 11. The server environment remains same.

As soon as I upgrade client to JDK 11, I hit following error. Which is expected because corba jars have been moved out from JDK 11.

Exception in thread "main" java.lang.NoClassDefFoundError: org/omg/CORBA/SystemException
    at weblogic.jndi.WLInitialContextFactoryDelegate.<clinit>(WLInitialContextFactoryDelegate.java:202)
    at weblogic.jndi.spi.EnvironmentManager$DefaultFactoryMaker.<clinit>(EnvironmentManager.java:27)
    at weblogic.jndi.spi.EnvironmentManager.getInstance(EnvironmentManager.java:49)
    at weblogic.jndi.Environment.getContext(Environment.java:315)
    at weblogic.jndi.Environment.getContext(Environment.java:285)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730)
    at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
    at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
    at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
    at com.test.JndiLookupTestJdk11.main(JndiLookupTestJdk11.java:16)

Added jacorb-omgapi-3.8.jar to client classpath to fix above exception.

After this I am hitting following timeout exception and not giving any clue. Server is up and running because my old client is working.

Error is at this line

InitialContext ic = new InitialContext(t);

Stacktrace

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by weblogic.rjvm.MsgAbbrevInputStream (file:/C:/Users/ke64/OneDrive%20-%20Sun%20Life%20Financial/work_eclipse-jee-2018-12-R/jndi-lookup-test-jdk11/lib/wlthint3client.jar) to method java.io.ObjectInputStream.clear()
WARNING: Please consider reporting this to the maintainers of weblogic.rjvm.MsgAbbrevInputStream
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://localhost:7003: Bootstrap to: localhost/0:0:0:0:0:0:0:1:7003' over: 't3' got an error or timed out]
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
    at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:792)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:368)
    at weblogic.jndi.Environment.getContext(Environment.java:315)
    at weblogic.jndi.Environment.getContext(Environment.java:285)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730)
    at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
    at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
    at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
    at com.test.JndiLookupTestJdk11.main(JndiLookupTestJdk11.java:16)
Caused by: java.net.ConnectException: t3://localhost:7003: Bootstrap to: localhost/0:0:0:0:0:0:0:1:7003' over: 't3' got an error or timed out
    at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216)
    at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:165)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:353)
    ... 8 more
Caused by: java.rmi.ConnectException: Bootstrap to: localhost/0:0:0:0:0:0:0:1:7003' over: 't3' got an error or timed out
    at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:365)
    at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:260)
    at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
    at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
    at weblogic.rjvm.RJVMFinder.findOrCreateRemoteCluster(RJVMFinder.java:316)
    at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:205)
    ... 11 more

Questions

  1. Has anyone got it working with configuration? Any idea how to fix this? Do I need to add any specific version of corba jars?
  2. I am thinking that standard J2EE feature of JNDI lookup should work. Is Weblogic 10.3.6 not compatible with JDK 11 client?

Any help is greatly appreciated.


Solution

  • Responding to an old question .. I had to look into a similar scenario recently. Just adding my findings here. Real credit should go to stephen-felts as his reply gave me the idea to try this out.

    Looked at a Spring Boot client on OpenJDK 11 attempting to talk to JMS queues on WebLogic 10.3.6.0 on Oracle JDK 6.

    Trying to use the wlthint3client.jar from 10.3.6 wasn't of much help because of the CORBA dependencies. Following this SAS post for dependencies to add for JDK 11. Could make the ClassNotFound errors go away by adding dependencies org.glassfish.corba:glassfish-corba-org:4.2.4 org.glassfish.pfl: pfl-tf:4.1.2 but still kept seeing the 't3' got an error or timed out exception message as the OP.

    Seeing WLS 14.1.1 is certified for JDK 11, installed that and copied out the bundled wlthint3client.jar from the <WLS_SERVER>/lib folder and configured the SpringBoot client to use it. Could successfully post messages to the queue.

    I couldn't find any official confirmation on the Oracle website though, so I don't know if this approach is good enough to use in a production environment.