Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-1567

[JBoss Fuse 6.1] java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • jboss-fuse-6.2
    • jboss-fuse-6.1
    • None
    • None
    • % %

    Description

      I have a Camel blueprint route using camel-jms endpoint to interact with Weblogic MQ. The camel-jms endpoint looks up remote connection factory using JNDI. For instance:

      <bean id="jmsIn" class="org.apache.camel.component.jms.JmsComponent">
          <property name="connectionFactory" ref="jmsInConnectionFactory" />
        </bean>
      
       <!-- JNDI lookup for remote connection factory -->
        <!-- Defines the Client connection to the JNDI Server -->
        <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
          <property name="environment">
            <props>
              <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
              <prop key="java.naming.provider.url" value="t3://localhost:7001" />
              <prop key="java.naming.security.principal" value="" /> <!-- TODO: fill in principal -->        
             <prop key="java.naming.security.credentials" value="" /> <!-- TODO: fill in password -->
            </props>
          </property>
        </bean>
      
        <!-- Gets a Weblogic JMS Connection factory object from JDNI Server by jndiName -->
        <bean id="jmsInConnectionFactoryJndiLookupFactory" class="org.springframework.jndi.JndiObjectFactoryBean" init-method="afterPropertiesSet">
          <property name="jndiTemplate" ref="jndiTemplate" />
          <property name="jndiName" value="dummyConnectionFactory" />
          <property name="proxyInterface" value="javax.jms.ConnectionFactory" />  
        </bean>
      
      <bean id="jmsInConnectionFactory" factory-ref="jmsInConnectionFactoryJndiLookupFactory" factory-method="getObject" />
      

      This camel blueprint bundle is very simple and it only contains a single blueprint.xml and it imports all necessary packages including weblogic packages such as "weblogic.jndi" etc.

      I also installed weblogic thin client jar wlthint3client-12.1.1.0.jar using "wrap" protocol into JBoss Fuse container.

      When I tried to install this camel blueprint bundle to JBoss Fuse 6.1 GA (610379) container, I got following error:

      Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)[:1.6.0_65]
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)[:1.6.0_65]
      at javax.naming.InitialContext.init(InitialContext.java:223)[:1.6.0_65]
      at javax.naming.InitialContext.<init>(InitialContext.java:197)[:1.6.0_65]
      at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136)[121:org.apache.servicemix.bundles.spring-context:3.2.8.RELEASE_1]
      at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103)[121:org.apache.servicemix.bundles.spring-context:3.2.8.RELEASE_1]
      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)[121:org.apache.servicemix.bundles.spring-context:3.2.8.RELEASE_1]
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)[121:org.apache.servicemix.bundles.spring-context:3.2.8.RELEASE_1]
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)[121:org.apache.servicemix.bundles.spring-context:3.2.8.RELEASE_1]
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
      ...
      Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)[:1.6.0_65]
      at java.security.AccessController.doPrivileged(Native Method)[:1.6.0_65]
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)[:1.6.0_65]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)[:1.6.0_65]
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)[:1.6.0_65]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_65]
      at java.lang.Class.forName0(Native Method)[:1.6.0_65]
      at java.lang.Class.forName(Class.java:249)[:1.6.0_65]
      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)[:1.6.0_65]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)[:1.6.0_65]
      ... 69 more

      However, when I used the same test case and tried to deploy it to JBoss Fuse 6.0 (60024), it worked fine.

      I looked into it further and I found that the difference was that with JBoss Fuse 6.1 GA, it was Damon Thread (Karaf Shell Console Thread) tried to load weblogic.jndi.WLInitialContextFactory class using it's sun.misc.Launcher$AppClassLoader. However, with JBoss Fuse 6.0, it was a thread from a thread pool (pool-mytestbundle-1.0-thread-1) to try to load weblogic.jndi.WLInitialContextFactory class using it's BundleWiringImpl$BundleClassLoadJava5. That's why it worked fine with JBoss Fuse 6.0 but not JBoss Fuse 6.1 GA.

      Anyone got an idea why 6.1 behaves differently?

      Attachments

        Issue Links

          Activity

            People

              janstey@redhat.com Jonathan Anstey
              rhn-support-qluo Joe Luo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: