3 Replies Latest reply on Feb 1, 2013 12:07 AM by hitjain_83

    Setting class loader in jboss-web.xml

    guyroth

      according to this Jboss article

       

      in order to set the class-loading preferences in my Jboss 5.1,  I need to add this to the jboss-web.xml file:

      <jboss-app> 

      <loader-repository>  

      com.example:archive=unique-archive-name     

      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>  

      </loader-repository>

      </jboss-app>


      my question:

      what is the meaning of the part: com.example:archive=unique-archive-name

      what is the structue of it A:B=C (A=com.example B=archive C=unique-archive-name) stands for? is the content of this line has affect on the class-loading mechanism?

        • 1. Re: Setting class loader in jboss-web.xml
          jaikiran

          The config you posted applies to jboss-app.xml. For jboss-web.xml it should be:

           

           

          <jboss-web>
                <loader-repository>
                   com.example:archive=unique-archive-name
                   <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
                </loader-repository>
          </jboss-web>
          

           

          what is the meaning of the part: com.example:archive=unique-archive-name

          what is the structue of it A:B=C (A=com.example B=archive C=unique-archive-name) stands for? is the content of this line has affect on the class-loading mechanism?

          That's explained in that wiki:

           

           

          The com.example:archive=unique-archive-name strings are JMX ObjectName

          strings. These have no particular significance other than that they must be unique.

          It might be useful to use the same name as used for the .ear, .war, or .sar file.

          For example, for a petstore.ear file, use: com.example:loader=petstore.ear as the repository name.

           

          The loader-repository ObjectName will appear in the JMX-Console (http://localhost:8080/jmx-console/).

          This MBean is great for debugging any class-loading issues which might arise.

          The hierarchical loaders created from the repository wll appear together under the loader-repository domain name,

          com.example in the example.

          • 2. Setting class loader in jboss-web.xml
            guyroth

            Thanks about the repository name.

             

            The syntax that you added was rejected. It was only accepted by JBoss when I wrote:

            <jboss-web>
               <class-loading java2ClassLoadingCompliance="false">
                  <loader-repository>
                     com.example:archive=unique-archive-name
                     <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
                  </loader-repository>
               </class-loading>

            </jboss-web>

             

             

            now the question is what is the attribute java2ClassLoadingCompliance of the 'class-loading' element? can I set it to "true" as well?

             

            • 3. Re: Setting class loader in jboss-web.xml
              hitjain_83

              Sorry for responding to a older thread but just thought this might help.

               

              Hi team,

               

              I am looking to load the app.properties residing directly inside my TestEAR and not within lib (it can be changed to lib/ as well).

              The app.properties has properties for my ejb-jar.xml - can you suggest what is the best way to make the properties available to my ejb-jar.xml (at the time of deployment).

              file: app.properties

                        key1=value1

                        key2=value2

               

              I looked jboss-app and could hardly understand anything from it. Please suggest.

              In my ejb-jar.xml, I have a field represented with ${key1}

               

              I am using JBoss AS 5.1.2

              Prj-structure.png