2 Replies Latest reply on Jan 27, 2003 12:20 PM by timhague

    Problem loading Struts app w/Java 2 Security

    mervinw

      I receive the following error message upon starting JBoss with a Struts application (.war) and Java 2 Security enabled. I am using the default security policy, which grants the "AllPermission ".

      Please help!

      ======================================================
      . . .
      10:45:43,679 INFO [PropertyMessageResources] Initializing, config='resources.ApplicationResources', returnNull=true
      10:45:44,530 ERROR [Digester] Begin event threw exception
      java.lang.ClassNotFoundException: No ClassLoaders found for: org.apache.struts.tiles.xmlDefinition.XmlDefinition
      . . .
      10:45:44,540 ERROR [Engine] StandardWrapperValve[action]: Allocate exception for servlet action
      javax.servlet.ServletException: Error while parsing file '/WEB-INF/tiles-defs.xml'. Error at (39, 48: No ClassLoaders found for: org.apache.struts.tiles.xmlDefinition.XmlDefinition
      . . .
      10:45:44,540 ERROR [Engine] ----- Root Cause -----
      org.apache.struts.tiles.DefinitionsFactoryException: Error while parsing file '/WEB-INF/tiles-defs.xml'. Error at (39, 48: No ClassLoaders found for: org.apache.struts.tiles.xmlDefinition.XmlDefinition
      . . .
      10:46:35,624 INFO [PropertyMessageResources] Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
      10:46:37,307 INFO [PropertyMessageResources] Initializing, config='resources.ApplicationResources', returnNull=true
      10:46:38,168 ERROR [Digester] Begin event threw exception
      java.lang.ClassNotFoundException: No ClassLoaders found for: org.apache.struts.tiles.xmlDefinition.XmlDefinition
      . . .
      10:46:38,168 ERROR [Engine] StandardWrapperValve[action]: Allocate exception for servlet action
      javax.servlet.ServletException: Error while parsing file '/WEB-INF/tiles-defs.xml'. Error at (39, 48: No ClassLoaders found for: org.apache.struts.tiles.xmlDefinition.XmlDefinition
      . . .
      10:46:38,178 ERROR [Engine] ----- Root Cause -----
      org.apache.struts.tiles.DefinitionsFactoryException: Error while parsing file '/WEB-INF/tiles-defs.xml'. Error at (39, 48: No ClassLoaders found for: org.apache.struts.tiles.xmlDefinition.XmlDefinition
      . . .

        • 1. Re: Problem loading Struts app w/Java 2 Security
          gfloodga

          Marvin,

          I replied to your post while the forums where in "PHP" mode, and unfortunately the post was lost...

          However, in that post I described a "workaround" and said I would work it out, as I had had the same issues.

          I now think I know the answer but have not had time to try it !. After much classloading hell elsewhere, I believe that the tile XMLDefinition class is failing to load (ClassNotFound...) because it is failing to load it's dependancy classes. Now I may be wrong here, but let me try to explain - hopefully giving you some clues ...

          JBOSS uses some of the commons-digester and others jars. So does tiles ! so the hack I suggested of dumping it in the lib folder of the config (i.e. default/lib) would work (this is BAD), but I was unsure why. I now think I know.

          If you dump it there, then it is loaded by the JVM (?) classloader, which of course has the other commons classes under its wing.

          Now, if you include this tiles jar in the war (say under WEB-INF/lib) then you will get the tiles jar loaded by the WEB classloader. I think beacuse some of the classes are loaded from a different classloader, the WEB classloader cannot load the classes(imports) that tiles needs because they are loaded elsewhere.

          So maybe, something to try is:

          put the tiles jar in your ear. The add it to the classpath of the war file you produce (inside the manifest.mf) this should then force the tiles jar to be loaded where it can get all it's dependant classes.

          I am waffling on, but this is my take on things, I am going to try it and post when I have - if anybody thinks this is cobblers - please correct me !

          regards

          Gareth Floodgate

          • 2. Re: Problem loading Struts app w/Java 2 Security
            timhague

            I've been having the same problems when deploying a war inside an ear. I've fixed it in two ways:

            1. Placing all my war library jar files in <JBoss\Tomcat>\server\lib.

            2. Doing what Gareth suggests - copying my war library jars to library\ dir within my ear and referencing them in the META_INF\MANIFEST.MF as library\whatever.jar within the WAR.

            I couldn't get it to work using WEB_INF\MANIFEST.MF referencing WEB_INF\lib files - they get loaded by JBoss OK but it doesn't help with the classloader issues in XMLDefinition...

            I am using the fixed version of ValidatorResourcesInitializer from Imagee - http://jboss.org/forums/thread.jsp?forum=50&thread=25378 as well.

            For info I'm using jboss-3.2.0RC1_tomcat-4.1.18

            Hope this saves you some work Gareth!

            Cheers,

            Tim.