3 Replies Latest reply on Aug 5, 2010 4:16 AM by Giancarlo Rosso

    Question on using JNDIBindingServiceMgr

    Todd Nash Newbie

      If I have an mbean definition as described below, where do I put this? Does this go in jboss-service.xml or some other file and then what directory under the server directory?




      <jndi:bindings
      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
      xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd">
      <jndi:binding name="url/globalProperties">
      <jndi:value type="java.net.URL">file:///c:/eRegistry/WebContent.RT/global.properties</jndi:value>
      </jndi:binding>

      </jndi:bindings>


        • 1. Re: Question on using JNDIBindingServiceMgr
          Scott Stark Master

          As shown this is not a valid mbean specification, but its probably due to not using the code tags. It can go into either the conf/jboss-service.xml, or another *-service.xml in the deploy directory. See the jmx chapter of the server does for info on mbean deployments.

          • 2. Re: Question on using JNDIBindingServiceMgr
            Andrea Leoncini Newbie

            hi

             

            I'm using jb 5, I have created a file named hostinfo-service.xml, it contains following xml:

             

            <?xml version="1.0" encoding="UTF-8"?>
            <mbean code="org.jboss.naming.JNDIBindingServiceMgr" name="jboss.apps:name=keygen">
                <attribute name="BindingsConfig" serialDataType="jbxb">
                    <jndi:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
                            xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
                            xs:schemaLocation="urn:jboss:jndi-binding-service
                            resource:jndi-binding-service_1_0.xsd">
                        <jndi:binding name="bindproperty/address">
                            <java:properties xmlns:java="urn:jboss:java-properties"
                                    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
                                    xs:schemaLocation="urn:jboss:java-properties
                                    resource:java-properties_1_0.xsd">
                                <java:property>
                                    <java:key>host.address</java:key>
                                    <java:value>127.0.0.1</java:value>
                                </java:property>
                            </java:properties>
                        </jndi:binding>
                    </jndi:bindings>
                </attribute>
            </mbean>

             

            but I can't use it: first of all when I put it in the deploy dir I don't see any kind of log as well as I touch (for example) mail-service.xml

            second I get an exception (javax.naming.NameNotFoundException: address not bound) using:

             

                 InitialContext ctx;
                    Properties props = new Properties();
                    try {
                        ctx = new InitialContext();
                        props =(Properties) ctx.lookup("bindproperty/address");
                    } catch (NamingException e) {
                        e.printStackTrace();
                    }

             

            is there something wrong?

            any comment or suggestion?

             

            TIA

            andrea

            • 3. Re: Question on using JNDIBindingServiceMgr
              Giancarlo Rosso Newbie

              You can find a solution in a similar thread.

              I was looking a solution to lookup properties defined as Properties in properties-service.xml. I know one can use system.getProperties(), but is there a way to use annotations?

              Thanks.