11 Replies Latest reply on Feb 22, 2009 10:18 PM by abhinav.ind

    classpath in war, jboss5

      i hav a sar in deploy.last folder. there is a war in that sar. i hav to access a xsl file kept in web-inf/classes/com/portal/layout/tabColumn/file.xsl
      jboss is not able to find it.
      if i keep this xsl file in a jar n put that jar in default/lib folder then its able to pick that file.

      <bean name="WarClassLoaderDeployer" class="org.jboss.web.tomcat.service.deployers.WarClassLoaderDeployer">
       <property name="relativeOrder">-1</property>
      
       <property name="includeWebInfInClasspath">true</property>
       <property name="filteredPackages">javax.servlet,org.apache.commons.logging</property>
      
       </bean>


       <!-- Get the flag indicating if the normal Java2 parent first class
       loading model should be used over the servlet 2.3 web container first
       model.
       -->
       <property name="java2ClassLoadingCompliance">true</property>
       <!-- A flag indicating if the JBoss Loader should be used. This loader
       uses a unified class loader as the class loader rather than the tomcat
       specific class loader.
       The default is false to ensure that wars have isolated class loading
       for duplicate jars and jsp files.
       -->
       <property name="useJBossWebLoader">true</property>
       <!-- The list of package prefixes that should not be loaded without
       delegating to the parent class loader before trying the web app
       class loader. The packages listed here are those tha are used by
       the web container implementation and cannot be overriden. The format
       is a comma separated list of the package names. There cannot be any
       whitespace between the package prefixes.
       This setting only applies when UseJBossWebLoader=false.
       -->
       <property name="filteredPackages">javax.servlet,org.apache.commons.logging</property>


      i want jboss to pick it from my war only. is there any configuration required to do it?

        • 1. Re: classpath in war, jboss5
          jaikiran

           

          "abhinav.ind" wrote:
          there is a war in that sar.


          That's the first time i am hearing a war being packaged in a sar. Any specific reason you are doing that?


          • 2. Re: classpath in war, jboss5

            well it works with jboss4.0.2. also we have a common build for multiple projects hence every project ends up in a sar.
            watever in temp folder i get to see the temporary war folder so it means jboss is ablt to pick it form sar.

            • 3. Re: classpath in war, jboss5

              well u can check http-invoker.sar in deploy folder there is invoker.war inside it. wat do u say abt this :)

              • 4. Re: classpath in war, jboss5
                jaikiran

                 

                "abhinav.ind" wrote:
                well u can check http-invoker.sar in deploy folder there is invoker.war inside it. wat do u say abt this :)


                I would say, i did not notice that earlier ;-)

                • 5. Re: classpath in war, jboss5

                  so can u help me with my problem. y doesnt jboss5 recognises classpath from WEB-INF/classes

                  • 6. Re: classpath in war, jboss5
                    jaikiran

                     

                    i hav to access a xsl file kept in web-inf/classes/com/portal/layout/tabColumn/file.xsl
                    jboss is not able to find it.


                    I believe it's your code which is trying to find it and not JBoss. Please post that relevant piece of code where you are trying to access this.


                    • 7. Re: classpath in war, jboss5

                      code for accessing both files is same. its just that classLoader finds the one kept in jar but fails to find the one kept in war packaged in sar.


                      public static URL getResourceAsURL(Class requestingClass, String resource) throws ResourceMissingException {
                       URL resourceURL = requestingClass.getResource(resource);
                      
                       if (resourceURL == null) {
                       throw new ResourceMissingException(resource,"Resource not found");
                      
                       }
                       return resourceURL;
                       }
                      


                      First case: File in jar
                      input to above function: class org.jasig.portal.UserInstance, /org/jasig/portal/layout/AL_TabColumn/AL_TabColumn.xsl
                      output: vfszip:/D:/jboss5/server/default/deploy/deploy.last/12uPortal.sar/uPortal.jar/org/jasig/portal/layout/AL_TabColumn/AL_TabColumn.xsl

                      Second case: File in war
                      input to above function: class org.jasig.portal.UserInstance, /com/nubridges/portal/layout/AL_TabColumn/nuBridges/nuBridges-menu.xsl
                      output: /com/nubridges/portal/layout/AL_TabColumn/nuBridges/nuBridges-menu.xsl


                      now if i package file in second case in to a jar then it works. is it related to class loading? if yes then can u give me a link where i can study new class loading fundamentals implemented in jboss5. installation guide dint help me.
                      earlier there was unified class loader for each webapp which were kept in one repository. now things seem different. though it says that UCL is replaced by BaseClassLoader but my webapp seems to be laoded by NoAnnotationURLClassLoader.

                      thanks



                      • 8. Re: classpath in war, jboss5
                        alesj

                         

                        "abhinav.ind" wrote:
                        but my webapp seems to be laoded by NoAnnotationURLClassLoader.

                        I really doubt that's true.


                        • 9. Re: classpath in war, jboss5

                          ok. can u suggest me where i can find detail content of class loading, how to configure it and other documentation. there must be something regarding this.

                          • 10. Re: classpath in war, jboss5
                            alesj
                            • 11. Re: classpath in war, jboss5

                              thanks alesj :)