1 2 Previous Next 17 Replies Latest reply on May 22, 2013 3:03 PM by frolovmx Go to original post
      • 15. Re: Get ear name
        viggo.navarsete

        I would say that if you really need the name of the EAR file, then you do something wrong, either the way you package your application, or how you refer to modules. When running JBoss 7.x there should really be no reason for needing the EAR name since you can use CDI to inject resources, you hardly need to know about JNDI at all. With earlier version of JBoss there is a different story but my point is that if you find yourself needing the name of the EAR file, then you should rethink your solution.

        • 16. Re: Get ear name
          lkasprzy

          I have remote communication betwen client (on tomcat) to jboss and jboss to jboss, so I don't see easy way to resolve this.

          In previous Jboss versions with RemoteBinding it was very easy, also in weblogic there is simple way with mappedName in Stateless annotation.

          Mayby request https://issues.jboss.org/browse/EJBTHREE-648 will be realized ?

          • 17. Re: Get ear name
            frolovmx

            In JBoss 7.1.X you can get the EAR name using JNDI Lookup like this:

            String earName = new InitialContext().lookup("java:app/AppName")
            

             

            or if only global Context is available:

            new InitialContext().list("java:global/").next().getName()
            
            1 2 Previous Next