4 Replies Latest reply on May 19, 2009 7:22 AM by jaikiran

    Struts + ClassLoading

    thanz

      Hello

      We are using JBoss 5.0.1 and we try to make a new Web App.

      So, first we have an EAR with all jars in it.
      Then we have a WAR which contains just the core.
      The EAR get deployed, we can start it and we see the page(index).

      But when we try to add struts(1.x.x) we get some problems.

      Fist, when we add struts.jar to the EAR the class-Loader doesnt find it.
      We get the error :

      2009-05-19 09:54:10,156 WARN [org.jboss.wsf.container.jboss50.deployer.JAXWSDeployerHookPreJSE] (main) Cannot load servlet class: org.apache.struts.action.ActionServlet
      


      When we add struts.jar to WEB-INF/lib in the WAR he finds it.
      In our other Project we have all jars in the EAR and everything works fine.


      Our 2nd Problem :

      In struts-config.xml we defined that the MessageResourceFactory Class is in a specific package. We added that JAR to the EAR but he cant find it.


      package not found xx.xx.xxx.xxx_xxxxx.xxx.mymessageresource
      defined package: xx.xx.xxx.xxx_xxxxx.xxx.mymessageresource
      loadClass org.apache.struts.util.MessageResourcesFactory resolve=false
      


      In the other Project everything works fine :

      package not found xx.xx.xxx.xxx_xxxxx.xxx.mymessageresource
      defined package: xx.xx.xxx.xxx_xxxxx.xxx.mymessageresource
      loaded class locally class xx.xx.xxx.xxx_xxxxx.xxx.mymessageresource.MyMessageResourceFactory{cl=BaseClassLoader@1499c0f{vfszip:/D:/ENTWICKLUNG/dv-java/jboss-5.0.1.GA/server/default/deploy/xxxxxx.ear/} codeSource=(jar:file:/D:/ENTWICKLUNG/dv-java/jboss-5.0.1.GA/server/default/deploy/xxxxxx.ear!/xxx_xxxxxxx.jar <no signer certificates>)}
      


      So why does on Project find the Class in the Jar, and the other doesnt ?
      We are using the same Jboss, we just wanted to do a new EAR.

      Anyone can help ?

        • 1. Re: Struts + ClassLoading
          jaikiran

           

          Fist, when we add struts.jar to the EAR the class-Loader doesnt find it.

          Try placing the jars in EAR/lib folder. The jars in EAR/lib folder will be available to all components in the EAR.

          • 2. Re: Struts + ClassLoading
            jaikiran

             

            So why does on Project find the Class in the Jar, and the other doesnt ?


            Just a guess, maybe the other project uses the Classpath attribute MANIFEST.MF of the jar(s) to point to the struts jar?


            • 3. Re: Struts + ClassLoading
              thanz

              Which Manifest.mf do you mean ? The one from the EAR ? They are both empty :

              Manifest-Version: 1.0
              Class-Path:



              Well...i created an lib Folder in the EAR and put all jar's in it.

              And now everything works in the new Project.
              But i dont know why the old Project works when there all jar's are just in the root of the EAR and not in a lib-Folder ?

              Anyone can explain this :)?

              • 4. Re: Struts + ClassLoading
                jaikiran

                 

                "thanz@gmx.at" wrote:
                Which Manifest.mf do you mean ? The one from the EAR ?


                I meant the MANIFEST.MF files in the jars within the EAR.