This discussion is archived
3 Replies Latest reply: Sep 26, 2012 11:05 AM by Tom B RSS

ClassNotFoundException for initial-context-factory using foreign JMS p.

user13047709 Newbie
Currently Being Moderated
Hi,

I am currently working on migrating an application from weblogic 9 to weblogic 10 and I bumped into this issue while MDB connecting to JMS.
[Loaded cz.jaksky.riskscenario.beans.RiskScenarioServiceLocalHome from file:/C:/SVN/app-WLS10-FRESH/app-deploy/servers/myserver/tmp/_WL_user/performance/nyubkw/point-interfaces.jar]
<17-Sep-2012 11:01:27 o'clock CEST> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB: PerformanceAsyncRequestBean is unable to connect to the JMS destination: wls.AsyncQueue. The Error was:
javax.naming.NoInitialContextException: Cannot instantiate class: cz.jaksky.common.jms.JMSInitialContextFactory [Root exception is java.lang.ClassNotFoundException: cz.jaksky.common.jms.JMSInitialContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at weblogic.deployment.jms.ForeignOpaqueReference.getReferent(ForeignOpaqueReference.java:182)
at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:96)
at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:377)
at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:209)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at weblogic.jms.common.CDS$2.run(CDS.java:486)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.jms.common.CrossDomainSecurityManager.runAs(CrossDomainSecurityManager.java:131)
at weblogic.jms.common.CDS.lookupDestination(CDS.java:480)
at weblogic.jms.common.CDS.lookupDDAndCalloutListener(CDS.java:345)
at weblogic.jms.common.CDS.access$100(CDS.java:41)
at weblogic.jms.common.CDS$DDListenerRegistrationTimerListener.timerExpired(CDS.java:193)
at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: java.lang.ClassNotFoundException: cz.jaksky.common.jms.JMSInitialContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 23 more

I am using foreign JMS provider with provided mapping. Config follows:
ejb-jar.xml:
<enterprise-beans>
          <message-driven>
               <ejb-name>PortfolioRetrieverAsyncRequestBean</ejb-name>
               <ejb-class>cz.jaksky.common.async.AsynchronousRequestMessageBean</ejb-class>
               <transaction-type>Bean</transaction-type>
               <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
               <message-driven-destination>
                    <destination-type>javax.jms.Queue</destination-type>
                    <subscription-durability>Durable</subscription-durability>
               </message-driven-destination>
               <message-selector>
                    <![CDATA[ Service IN ('PortfolioRetriever')
                  AND MessageType = 'request'
                  AND BigBox = FALSE
                ]]>
               </message-selector>
          </message-driven>
     </enterprise-beans>

weblogic-ejb-jar.xml:
<weblogic-enterprise-bean>
          <ejb-name>PortfolioRetrieverAsyncRequestBean</ejb-name>
          <message-driven-descriptor>
               <pool>
                    <max-beans-in-free-pool>64</max-beans-in-free-pool>
                    <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
               </pool>
               <destination-jndi-name>wls.AsyncQueue</destination-jndi-name>
               <initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
               <connection-factory-jndi-name>ServiceLocatorAsyncQueueFactory</connection-factory-jndi-name>
          </message-driven-descriptor>
          <dispatch-policy>PortfolioAsyncQueueWorkManager</dispatch-policy>
     </weblogic-enterprise-bean>

jmsconfig-jms.xml

<foreign-server name="TibjmsAsyncServer">
<default-targeting-enabled>true</default-targeting-enabled>
<foreign-destination name="AsyncQueue.LOCAL.prgdwm355410.7001">
<local-jndi-name>wls.AsyncQueue</local-jndi-name>
<remote-jndi-name>AsyncQueue.LOCAL.prgdwm355410.7001</remote-jndi-name>
</foreign-destination>
<foreign-connection-factory name="FTQueueConnectionFactory">
<local-jndi-name>ServiceLocatorAsyncQueueFactory</local-jndi-name>
<remote-jndi-name>FTQueueConnectionFactory</remote-jndi-name>
</foreign-connection-factory>
<initial-context-factory>cz.jaksky.common.jms.JMSInitialContextFactory</initial-context-factory>
<connection-url>tcp://JUSD-FTPOIA.jaksky.com:22542,tcp://JUSD-FTPOB.jaksky.com:22543</connection-url>
</foreign-server>

Module containing this MDB is packed as an ear file with following structure:
APP-INF/lib/modules.jar - contains AsynchronousRequestMessageBean class
APP-INF/lib/interface.jar - contains JMSInitialContextFactory (class used for initial-context-factory)
portfolio-async.jar
META-INF/ejb-jar.xml content pasted above
META-INF/webogic-ejb-jar.xml content pasted above

Weblogic system classpath doesn't contain any application sepcific libraries.

This set up was working for weblogic 9 without any problem. I am just wondering what the problem is whether I am faceing class loading issue or JMS configuration issue and how to resolve it.

Edited by: user13047709 on 18-Sep-2012 07:15

Edited by: user13047709 on 18-Sep-2012 07:16
  • 1. Re: ClassNotFoundException for initial-context-factory using foreign JMS p.
    Tom B Expert
    Currently Being Moderated
    Hi,

    When working with a non-WebLogic JNDI provider (or a non-WebLogic JMS provider), the non-WebLogic client classes must be made available to the classloader of the calling application in WebLogic Server. This is usually accomplished by adding them to the system classpath.

    In your case, WebLogic is looking for a proprietary/foreign JNDI Context Factory class named "cz.jaksky.common.jms.JMSInitialContextFactory", which means you need to make sure that a jar/dir that contains the non-WebLogic class "JMSInitialContextFactory.class" is in the classpath.

    The configuration for this should be similar in WL9 and WL10. It could be that your classpath is already setup to reference the foreign class, but it refers to a directory/jar that you haven't setup yet on your WL10 host.

    HTH,

    Tom
  • 2. Re: ClassNotFoundException for initial-context-factory using foreign JMS p.
    user13047709 Newbie
    Currently Being Moderated
    Hi Tom,

    thanks for your reply. I did verified that cz.jaksky.common.jms.JMSInitialContextFactory is present in interfaces.jar and that interfaces.jar is included into APP-INF/lib. Correct me If I am wrong but I was convinced that this location is in classpath for given application (if I can call it this way) - is visible to the application level classloader.
    I switched class loading details on for weblogic and I found that actuall class refered by MDB is loaded from APP-INF/lib/modules.jar but it seems that APP-INF/lib/interfaces.jar is invisible for some reason which I don't uderstand.

    I did check that class path do not reference any jar which actually don't exist as you suggested in your reply. But there were nothing like that, unfortunately.

    Thx
  • 3. Re: ClassNotFoundException for initial-context-factory using foreign JMS p.
    Tom B Expert
    Currently Being Moderated
    This looks like a regression to me since this worked in 9, but not in 10. I recommend contacting customer support to raise the issue and to see if there's already patch. In the mean-time, you can probably work around the problem if you move the jar into the system classpath instead of bundling it with the app...

    HTH,

    Tom

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points