2 Replies Latest reply on Dec 16, 2014 10:07 AM by Ritesh Mathur

    WAR outside the EAR, not able to reference JAR inside EAR. In wildfly 8

    Ritesh Mathur Newbie

      I am migrating to wildfly 8.2 from Jboss 5.1, I am deploying a Web Service using the resteasy and some EAR which has the code to get the requested data from the DB. Both the EAR which has multiple (6) JAR's, but when I call the Web Service, it is not able to find the EAR and refer it's JAR's

      14:57:48,183 INFO [stdout] (default task-4) InitialContextFactory not defined - using default: org.jnp.interfaces.NamingContextFactory

      14:57:48,184 ERROR [stderr] (default task-4) javax.naming.NameNotFoundException: bpc/AccountManagementService -- service jboss.naming.context.java.bpc.AccountManagementService

      I have 2 seprate deployment of EAR and WAR and both of them are deployed simultaneously and they both get deployed without any hassle.

      why are then not able to integrate is my issue right now.

        • 1. Re: WAR outside the EAR, not able to reference JAR inside EAR. In wildfly 8
          Jay SenSharma Master

          Is your application trying to lookup some resources which are deployed on JBoss 4/5 ?    Because your log snippet shows    [InitialContextFactory not defined - using default: org.jnp.interfaces.NamingContextFactory]  In WildFly 8 that naming context factory is not used. That is used for JBoss 4/5.  So looks like you might have copied some  JARs from your JBoss 5.1 inside your application.  Can you verify that?

           

          Also the error which you are getting [NameNotFoundException: bpc/AccountManagementService] is related to JNDI naming.  And it indicates that your application is trying to lookup something which is not yet bound in the JNDI tree.    So can you check your log that before this error appears in your log, Do you already have that JNDI name bounded in the JNDI.

           

          Can you attach the log ?

           

           

           

          Regarding your query on:

          WAR outside the EAR, not able to reference JAR inside EAR?

              >> By default WARs outside an EAR can not reference the JARs present inside the EAR, Until you configure a dependency using "$WAR/META-INF/MANIFEST.MF"  or "$WAR/WEB-INF/jboss-deployment-structure.xml"  as described in [1]

           

          Example:  By placing similar  "$WAR/WEB-INF/jboss-deployment-structure.xml" it can be achieved.

           

          <jboss-deployment-structure>
              <deployment>
                  <dependencies>
                      <module name="deployment.YOUR_EAR.ear.YOUR_EJB_JAR.jar"/>
                  </dependencies>
              </deployment>
          </jboss-deployment-structure>
          
          
          

            By placing above kind of "jboss-deployment-structure.xml" isnide the WAR we are instructing wildfly to make the JAR "YOUR_EJB_JAR.jar" present inside the EAR "YOUR_EAR.ear" accessible to the WAR.

           

           

          [1] https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly

           

          Also as you are migrating from JBoss 5 to WildFly so a quick look to [2] will be best to know about the JNDI naming/lookup changes.

          [2] How do I migrate my application from AS5 or AS6 to WildFly - WildFly 8 - Project Documentation Editor

          • 2. Re: WAR outside the EAR, not able to reference JAR inside EAR. In wildfly 8
            Ritesh Mathur Newbie

            Hi Jay, Thank you for the answer, it worked for me.