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

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(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.InitialContext.<init>(
at weblogic.deployment.jms.ForeignOpaqueReference.getReferent(
at weblogic.jndi.internal.WLNamingManager.getObjectInstance(
at weblogic.jndi.internal.ServerNamingNode.resolveObject(
at weblogic.jndi.internal.BasicNamingNode.resolveObject(
at weblogic.jndi.internal.BasicNamingNode.lookup(
at weblogic.jndi.internal.BasicNamingNode.lookup(
at weblogic.jndi.internal.WLEventContextImpl.lookup(
at weblogic.jndi.internal.WLContextImpl.lookup(
at javax.naming.InitialContext.lookup(
at weblogic.jms.common.CDS$
at weblogic.jms.common.CrossDomainSecurityManager.runAs(
at weblogic.jms.common.CDS.lookupDestination(
at weblogic.jms.common.CDS.lookupDDAndCalloutListener(
at weblogic.jms.common.CDS.access$100(
at weblogic.jms.common.CDS$DDListenerRegistrationTimerListener.timerExpired(
Caused by: java.lang.ClassNotFoundException: cz.jaksky.common.jms.JMSInitialContextFactory
at Method)
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at com.sun.naming.internal.VersionHelper12.loadClass(
at javax.naming.spi.NamingManager.getInitialContext(
... 23 more

I am using foreign JMS provider with provided mapping. Config follows:
                    <![CDATA[ Service IN ('PortfolioRetriever')
                  AND MessageType = 'request'
                  AND BigBox = FALSE



<foreign-server name="TibjmsAsyncServer">
<foreign-destination name="AsyncQueue.LOCAL.prgdwm355410.7001">
<foreign-connection-factory name="FTQueueConnectionFactory">

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)
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

    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.


  • 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.

  • 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...




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