2 Replies Latest reply on Jul 9, 2004 5:30 AM by Rene Zanner

    Getting resources in JBoss 3.0.8

    Alex Burton Newbie

      Hi all,

      I am trying to do an XSLT/XML transformation, but when I try to load up my XSLT using getResourceAsStream it always fails... It is running in a Struts action in the web tier.

      What voodoo do i need to peform to get this to work? I have placed the file in just about every JAR/lib imaginable yet still can't load it...

      InputStream in = this.getClass().getClassLoader().getResourceAsStream("/com/mycompany/resource/MBTransform.xsl");

      Many thanks in advance (from me and all the chickens you'll save),
      Alex.

        • 1. Re: Getting resources in JBoss 3.0.8
          Alex Burton Newbie

          Putting my resources in a completely new JAR file and dropping it in the deploy directory seemed to make it work...

          Now can anyone tell me why the class loader has been done this way... so you can't get to resources in the WARs own file or in JARs within the WAR lib directory?!!!!

          Seems fairly like a rather silly thing to do... basically wasted a entire day on this...

          • 2. Re: Getting resources in JBoss 3.0.8
            Rene Zanner Newbie

            Hi Alex,

            "aburton" wrote:
            Hi all,

            ...snip...

            InputStream in = this.getClass().getClassLoader().getResourceAsStream("/com/mycompany/resource/MBTransform.xsl");

            ...snip...



            you should have tried it without the leading slash "/" - this way:


            InputStream in = this.getClass().getClassLoader().getResourceAsStream("com/mycompany/resource/MBTransform.xsl");

            To finish with an old developer word: "On my machine it works...".

            HTH,

            René