8 Replies Latest reply on Jun 24, 2009 1:57 PM by Adam Andrzejewski

    Jboss ear deployment - resourcebundle problem

    Adam Andrzejewski Newbie

      Hello, I have a strange problem with ear deployment.


      I have a multi-module project. One module is being archived to war, others to jars. The war module has some resource bundles, which are used in the application via standard seam messages component.
      And now - when i deploy the whole application on jboss 4.1 AS as an exploaded ear achive (just put the folder my-app.ear into jboss deploy folder) everything is working fine. But when I make an normal ear archive via ant task, or even from the command prompt and deploy it, my resource bundle messages are not being resolved and i recive ie. messageexceptionnodata instead of normal error message (which as i said appears normally when using not archived ear folder).


      The main problem is that in the production enviroment i'm going to run this app at two clusters, and the ear goes into jboss farm folder, which as far as i know does work only with ear archives (exploaded directiories are not supported).


      Any suggestions are warmly welcome

        • 1. Re: Jboss ear deployment - resourcebundle problem
          Adam Andrzejewski Newbie

          Oppss... Sorry, i'm using JBoss 4.2 AS, misspeled that one.

          • 2. Re: Jboss ear deployment - resourcebundle problem
            Stuart Douglas Master

            can you post both your ant tasks for the expoloded deployment and the ant task for the archived deployment?

            • 3. Re: Jboss ear deployment - resourcebundle problem
              Adam Andrzejewski Newbie

              the ant task that creates the ear looks like this




              <project name="edoradca-app-build" default="edoradca-app-build" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
              
               <property name="ivy.config.dir" value="../edoradca-app/dependencies"/>
               
               <property name="build.dir" value="${basedir}/product"/>
               <property name="product.dir" value="${build.dir}"/>
               <property name="exploded.dir" value="${build.dir}/exploded"/>
               <property name="compilation.lib.dir" value="${build.dir}/lib"/>
              <property name="compilation.lib.dir" value="${build.dir}/lib"/>
               <property name="product.version" value="0.1"/>
              
               <ivy:settings id="ivy.instance" file="${ivy.config.dir}/ivy-settings.xml" override="true"/>
               
               <import file="${basedir}/generic-util-build.xml"/>
               <import file="${basedir}/generic-web-build.xml"/>
               <import file="${basedir}/generic-ejb-build.xml"/>
               <import file="${basedir}/generic-ear-build.xml"/>     
               <import file="${basedir}/generic-test-runner.xml"/>
               
               
               <target name="edoradca-app-build" depends="init,build-edr-utility,build-edr-kernel,build-edr-model-ejb,build-edr-api,build-business-modules,build-edr-service-ejb,build-edr-web">
                      
                    <copy file="${build.dir}/edr-utility.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-kernel.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-model-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                   <copy file="${build.dir}/edr-admin-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                   <copy file="${build.dir}/edr-clients-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-calc-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-documents-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-org-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />      
                    <copy file="${build.dir}/edr-policy-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-products-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-schedule-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-api.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />     
                    <copy file="${build.dir}/edr-service-ejb.jar" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
                    <copy file="${build.dir}/edr-web.war" todir="${compilation.lib.dir}/ear-modules" overwrite="true" />
              
                     <antcall target="ear-archive-module">
                         <param name="build.dir" value="${build.dir}"/>
                         <param name="ear.lib.dir" value="${compilation.lib.dir}/ear-libraries"/>
                          <param name="ear.modules.dir" value="${compilation.lib.dir}/ear-modules"/>
                          <param name="ear.misc.dir" value="../edoradca-app/EarContent"/>
                      <param name="product.name" value="edoradca-app.ear"/>
                      <param name="product.version" value="${product.version}"/>
                     </antcall>        
              
               </target>
               
               <target name="init">
               
                    <mkdir dir="${build.dir}" />
                    <mkdir dir="${exploded.dir}" />
                    <mkdir dir="${compilation.lib.dir}" />
                    <mkdir dir="${compilation.lib.dir}/web-libraries" />      
                    <mkdir dir="${compilation.lib.dir}/test-libraries" />      
                    <ivy:resolve settingsref="ivy.instance" file="${ivy.config.dir}/ivy.xml"/>
                   <ivy:retrieve settingsref="ivy.instance" conf="ear-libraries,ear-modules,provided" sync="false" pattern="${compilation.lib.dir}/[conf]/[artifact].[ext]"/>
                        
                      <path id="build.classpath" >
                           <pathelement location="${build.dir}/bin/edr-utility.jar"/>
                           <pathelement location="${build.dir}/bin/edr-kernel.jar"/>
                           <pathelement location="${build.dir}/bin/edr-model-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-admin-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-clients-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-calc-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-documents-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-org-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-policy-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-products-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-schedule-ejb.jar"/>
                           <pathelement location="${build.dir}/bin/edr-api.jar"/>
                           <pathelement location="${build.dir}/bin/edr-service-ejb.jar"/>      
                           <fileset dir="${compilation.lib.dir}/provided" includes="**/*.jar"/>
                           <fileset dir="${compilation.lib.dir}/ear-libraries" includes="**/*.jar"/>
                           <fileset dir="${compilation.lib.dir}/ear-modules" includes="**/*.jar"/>               
                      </path>      
                    
               </target>
               
               <target name="build-edr-utility">            
                     <antcall target="util-archive-module">
                         <param name="project.dir" value="../edr-utility"/>
                         <param name="build.dir" value="${build.dir}"/>
                         <param name="exploded.dir" value="${exploded.dir}"/>
                      <param name="product.name" value="edr-utility.jar"/>
                      <param name="product.version" value="${product.version}"/>
                     </antcall>       
               </target>
              
               <target name="build-edr-kernel">            
                     <antcall target="util-archive-module">
                         <param name="project.dir" value="../edr-kernel"/>
                         <param name="build.dir" value="${build.dir}"/>
                         <param name="exploded.dir" value="${exploded.dir}"/>
                      <param name="product.name" value="edr-kernel.jar"/>
                      <param name="product.version" value="${product.version}"/>
                     </antcall>       
               </target>     
                   
               <target name="build-edr-model-ejb">
                     <antcall target="ejb-archive-module">
                         <param name="project.dir" value="../edr-model-ejb"/>
                         <param name="build.dir" value="${build.dir}"/>
                         <param name="exploded.dir" value="${exploded.dir}"/>
                      <param name="product.name" value="edr-model-ejb.jar"/>
                      <param name="product.version" value="${product.version}"/>
                     </antcall>   
               </target>
              
              
               <target name="build-business-modules">
                         <antcall target="ejb-archive-module">
                              <param name="project.dir" value="../edr-admin-ejb"/>
                              <param name="build.dir" value="${build.dir}"/>
                              <param name="exploded.dir" value="${exploded.dir}"/>
                           <param name="product.name" value="edr-admin-ejb.jar"/>
                           <param name="product.version" value="${product.version}"/>
                          </antcall>         
                         
                         <antcall target="ejb-archive-module">
                              <param name="project.dir" value="../edr-clients-ejb"/>
                              <param name="build.dir" value="${build.dir}"/>
                              <param name="exploded.dir" value="${exploded.dir}"/>
                           <param name="product.name" value="edr-clients-ejb.jar"/>
                           <param name="product.version" value="${product.version}"/>
                          </antcall>
              
                         <antcall target="ejb-archive-module">
                              <param name="project.dir" value="../edr-calc-ejb"/>
                              <param name="build.dir" value="${build.dir}"/>
                              <param name="exploded.dir" value="${exploded.dir}"/>
                           <param name="product.name" value="edr-calc-ejb.jar"/>
                           <param name="product.version" value="${product.version}"/>
                          </antcall>     
                   
                         <antcall target="ejb-archive-module">
                                 <param name="project.dir" value="../edr-documents-ejb"/>
                                 <param name="build.dir" value="${build.dir}"/>
                                <param name="exploded.dir" value="${exploded.dir}"/>
                             <param name="product.name" value="edr-documents-ejb.jar"/>
                             <param name="product.version" value="${product.version}"/>
                         </antcall>              
                         
                         <antcall target="ejb-archive-module">
                                 <param name="project.dir" value="../edr-org-ejb"/>
                                 <param name="build.dir" value="${build.dir}"/>
                                <param name="exploded.dir" value="${exploded.dir}"/>
                             <param name="product.name" value="edr-org-ejb.jar"/>
                             <param name="product.version" value="${product.version}"/>
                         </antcall>
                         
                         <antcall target="ejb-archive-module">
                                 <param name="project.dir" value="../edr-policy-ejb"/>
                                 <param name="build.dir" value="${build.dir}"/>
                                <param name="exploded.dir" value="${exploded.dir}"/>
                             <param name="product.name" value="edr-policy-ejb.jar"/>
                             <param name="product.version" value="${product.version}"/>
                         </antcall>
              
                         <antcall target="ejb-archive-module">
                                 <param name="project.dir" value="../edr-products-ejb"/>
                                 <param name="build.dir" value="${build.dir}"/>
                                <param name="exploded.dir" value="${exploded.dir}"/>
                             <param name="product.name" value="edr-products-ejb.jar"/>
                             <param name="product.version" value="${product.version}"/>
                         </antcall> 
              
                         <antcall target="ejb-archive-module">
                                 <param name="project.dir" value="../edr-schedule-ejb"/>
                                 <param name="build.dir" value="${build.dir}"/>
                                <param name="exploded.dir" value="${exploded.dir}"/>
                             <param name="product.name" value="edr-schedule-ejb.jar"/>
                             <param name="product.version" value="${product.version}"/>
                         </antcall>       
                         
               </target>     
                   
               <target name="build-edr-api"> 
                 <antcall target="util-archive-module">
                        <param name="project.dir" value="../edr-api"/>
                        <param name="build.dir" value="${build.dir}"/>
                        <param name="exploded.dir" value="${exploded.dir}"/>
                     <param name="product.name" value="edr-api.jar"/>             
                     <param name="product.version" value="${product.version}"/>
                 </antcall> 
               </target>     
              
               <target name="build-edr-service-ejb"> 
                 <antcall target="ejb-archive-module">
                        <param name="project.dir" value="../edr-service-ejb"/>
                        <param name="build.dir" value="${build.dir}"/>
                        <param name="exploded.dir" value="${exploded.dir}"/>
                     <param name="product.name" value="edr-service-ejb.jar"/>             
                     <param name="product.version" value="${product.version}"/>
                 </antcall> 
               </target>          
                   
               <target name="build-edr-web" depends="build-edr-web-skin">         
                         <copy file="${build.dir}/edr-web-skin.jar" todir="${compilation.lib.dir}/web-libraries" overwrite="true" />           
                         <antcall target="web-archive-module">
                         <param name="project.dir" value="../edr-web"/>
                           <param name="build.dir" value="${build.dir}"/>
                           <param name="exploded.dir" value="${exploded.dir}"/>
                           <param name="web.lib.dir" value="${compilation.lib.dir}/web-libraries"/>
                          <param name="product.name" value="edr-web.war"/>                 
                        <param name="product.version" value="${product.version}"/>
                        </antcall> 
               </target>
              
                   
              <target name="build-edr-web-skin">
                      <antcall target="util-archive-module">
                             <param name="project.dir" value="../edr-web-skin"/>
                             <param name="build.dir" value="${build.dir}"/>
                             <param name="exploded.dir" value="${exploded.dir}"/>
                          <param name="product.name" value="edr-web-skin.jar"/>             
                          <param name="product.version" value="${product.version}"/>
                      </antcall> 
              </target>



              and there goes more targets later, but they refer to tests modules.


              The not exploaded version is simply run from eclipse.


              I have looked for differences in the archive and the directory, and the only difference is that archive contains manifest file.

              • 4. Re: Jboss ear deployment - resourcebundle problem
                Stuart Douglas Master

                With the archive are the jar and war modules also archives or are they just exploded inside the containing archive?

                • 5. Re: Jboss ear deployment - resourcebundle problem
                  Adam Andrzejewski Newbie

                  The web module is a war archive and other modules are jars inside the ear

                  • 6. Re: Jboss ear deployment - resourcebundle problem
                    Adam Andrzejewski Newbie
                    Ok, i modified the faces-config.xml and added directly message bundle directive



                    `      <application>
                              <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
                              <locale-config>
                                   <default-locale>pl</default-locale>
                                   <supported-locale>pl</supported-locale>
                              </locale-config>
                              <message-bundle>messages</message-bundle>
                         </application>`

                    And now most of the bundles work correctly. I say most because whereever i'm using <s:validateAll> it looks ok, but when i navigate to a page which uses <rich:graphValidator/> i still get unresolved bundles :/
                    • 7. Re: Jboss ear deployment - resourcebundle problem
                      Tekchand Prasad Newbie

                      Add this one in component.xml


                      <core:resource-loader>
                                <core:bundle-names>
                                     <value>LogMessages</value>
                                     <value>Messages</value>
                                     <value>Images</value>
                                     <value>messages</value>
                                </core:bundle-names>
                           </core:resource-loader>




                      Messages refer to Messageen.properties and Images to Imagesen.properties like so...
                      Click HELP for text formatting instructions. Then edit this text and check the preview.

                      • 8. Re: Jboss ear deployment - resourcebundle problem
                        Adam Andrzejewski Newbie

                        My components.xml had this fragment already...


                        I managed to resolve the problem, it was related to this My Link
                        Switching to richfaces 3.3.1 (had 3.2.2) put away the problem, while using <message-bundle> in faces-config.


                        Anyway, why without <message-bundle> it worked in exploaded dir and not in archive still is a mistery for me. But since i've founded a workaround i probably wont search for an answer ;)


                        Thanks for suggestions.