3 Replies Latest reply on Oct 29, 2011 10:48 AM by jaikiran pai

    java.lang.NoClassDefFoundError: javax/naming/InitialContext

    Rodney Kite Newbie

        Jars in the top level of an ear can not see the InitialContext.

       

        I am trying to expose a utility jar and EJB 3.x entity beans jar to separate ear/war files.  Worked great in JBoss 4.2.3 and were available to external Ears just by including the jars in my main ear.  

       

        If you put your common jars in <main-ear-file>/lib directory then other external ears/wars can not see them as modules  (or I do not know how to expose them as modules when in the lib directory).  If you put them in the top directory of the ear then they are available to other external ears as a module  using deployment.<main-ear-file-name>.ear.utility.jar in the dependencies of the separate ear.   Problem I am having is when you do this the common utility jar files do not see the InitialContext.  If you try to construct an InitialContext in the utility jar you get java.lang.NoClassDefFoundError: javax/naming/InitialContext.

       

       

      My Architecture.  The Main Ear contains most of the Business logic -->

       

      MainEar.ear (MANIFEST.MF references internal jars)

        MainBusinessLogic.jar (Includes session beans etc including in application.xml and has visibility to the InitialContext)

        ejb3EntityBeans.jar  (Need to be streamable to other ears)

        utilities.jar  (Has no visibility to the InitialContext)

       

       

      Separate1.ear

        separate1.war  (Calls MainEar.ear session beans and gets ejb3EntityBeans as result to display with JSF pages)

       

      Separate2.ear

        separate2.war  (Calls MainEar.ear session beans and gets ejb3EntityBeans as result to display with JSF pages)