10 Replies Latest reply on Mar 22, 2014 2:35 PM by zerkowski.maciek

    JNDI string binding

    quanlin

      How do I bind an arbitrary string to JNDI in JBOSS7? I used to do it through a mbean in previous AS version. Since JBOSS7 no longer use JMX to manage resources, I can't find the JNDI binding manager in any of the moduels, is there any way to do it? Do I have to write my own subsystem to plug into JBOSS AS7? Thanks

        • 1. Re: JNDI String binding
          jaikiran

          Currently it's not possible to bind arbitrary objects to JNDI. JNDI bindings in AS7 are backed by MSC services. So if you have to bind something to JNDI, you'll have to come up with a binding service to do that. Maybe we could introduce a common JNDI binding service which does that. I don't know if there are any issues introducing such a service, probably not. Please create a feature request in the AS7 JIRA so that someone can take a look.

          • 2. Re: JNDI String binding
            quanlin

            Thanks for the quick reply and I will do some reserch on MSC services. I'll go ahead and create a feature request, please keep me posted when you have such a common service, really appreciate that.

            • 3. Re: JNDI string binding
              quanlin

              This is claimed to be resolved in 7.1.0 beta1

              • 4. Re: JNDI string binding
                anewton

                I see that AS7-1293 marks this issue as resolved.

                But I just downloaded AS7.1beta1b and cannot figure out where this new feature is.

                Is there any documentation on this at all?

                • 5. Re: JNDI string binding
                  seafoxx

                  Hey, I just figured it out:

                  in your /standalone/configuration folder you'll find the standalone.xml where all the subsystems are configured.

                  Within the xml you'll find the following empty tag:

                          <subsystem xmlns="urn:jboss:domain:naming:1.1"/>

                   

                  This would be a simple string binding (string is the default if not specified):

                          <subsystem xmlns="urn:jboss:domain:naming:1.1">

                              <bindings>

                                  <simple name="my/jndi/key" value="MyJndiValue"/>

                              </bindings>

                          </subsystem>

                   

                  you can find a detailed description in the schema /docs/schema/jboss-as-naming_1_1.xsd

                  • 6. Re: JNDI string binding
                    benze

                    Sebastian Kaempfe wrote:

                     

                    Hey, I just figured it out:

                    in your /standalone/configuration folder you'll find the standalone.xml where all the subsystems are configured.

                    Within the xml you'll find the following empty tag:

                            <subsystem xmlns="urn:jboss:domain:naming:1.1"/>

                     

                    This would be a simple string binding (string is the default if not specified):

                            <subsystem xmlns="urn:jboss:domain:naming:1.1">

                                <bindings>

                                    <simple name="my/jndi/key" value="MyJndiValue"/>

                                </bindings>

                            </subsystem>

                     

                    you can find a detailed description in the schema /docs/schema/jboss-as-naming_1_1.xsd

                    Is this only available in AS7.1?  I've got 7.0 installed and the naming schema file in 7.0 shows an empty element.

                     

                    Thanks,


                    Eric

                    • 7. Re: JNDI string binding
                      jaikiran

                      Eric B wrote:

                       

                      Is this only available in AS7.1? 

                      Yes

                      • 8. Re: JNDI string binding
                        benze

                        jaikiran pai wrote:

                         

                        Eric B wrote:

                         

                        Is this only available in AS7.1? 

                        Yes

                        Thanks for the info.  Does this mean that anyone running AS7.0 is out of luck of creating String JNDI bindings?  That would seem like a significant oversight.

                        • 9. Re: JNDI string binding
                          quanlin

                          It is confirmed that this feature is available in AS7.1, so if you want to continue to use AS7.0, you can probably do the same thing as I did, create a dummy web app that only serves the purpose of loading those "JNDI bindings", inside the web.xml of that app,

                           

                          <?xml version="1.0" encoding="UTF-8"?>

                          <web-app version="2.5"

                              xmlns="http://java.sun.com/xml/ns/javaee"

                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

                           

                              <display-name>jndiBinding</display-name>

                              <env-entry>

                                 <env-entry-name>java:global/env/snotel/webAppsRoot</env-entry-name>

                                 <env-entry-type>java.lang.String</env-entry-type>

                                 <env-entry-value>http://localhost:8080/your app namel/</env-entry-value>

                              </env-entry>

                           

                          basically, use the local environment to fulfill the task, but remember one thing, since you are trying to bind the value for other apps to use, you have to make sure, before every other apps trying to hit the binding string here, this dummy app has been loaded first. Be aware of the new domain name of JNDI.

                          • 10. Re: JNDI string binding
                            zerkowski.maciek

                            And do you know if instead of changing standalone.xml file located in configuration folder, there is a possibility in JBoss 7.1 of adding such JNDI binding in some standalone file like it was in case of JBoss 5 with the *-service.xml file? I would like to put such a file together with the war and *-ds.xml into the deployments folder as it was possible in JBoss 5.

                             

                            Regards,

                            Maciek