4 Replies Latest reply on Dec 20, 2005 1:43 PM by andycooper

    RAR deployment classloader?

      I have a RAR that is attempting to load a file from the classpath. When the file is included in the RAR file, things work happily. However, I want to have the file external to the RAR file and can't get that to work - the code in the resource adapter is unable to find it on the classpath. I've tried putting it in the same directory (i.e., deploy/jms) of the server, in the server's lib directory, in JBoss lib directory and JBoss lib/endorsed directory, but nothing appears to work.

      I'm using the default JBoss configuration and was wondering what classloader the RAR file uses and how to get it to find a file on a classpath outside of the RAR.

        • 1. Re: RAR deployment classloader?

          what type of file is it? is it a resource bundle? from what you say, it seems like the best place for that file to be should be inside the RAR file. You should not make any assumptions about the file structure inside the application server

          • 2. Re: RAR deployment classloader?

             

            "galderz" wrote:
            what type of file is it? is it a resource bundle? from what you say, it seems like the best place for that file to be should be inside the RAR file. You should not make any assumptions about the file structure inside the application server



            No, it is an XML configuration file for a JMS implementation. The kicker is that you really want to be able to configure it outside of the RAR file, but it doesn't seem like it is possible given the way that it appears that the RAR classloader doesn't delegate to its parent classloader.


            • 3. Re: RAR deployment classloader?

              Where r u trying to load the configuration file? Is it from an MDB? Remember that according to the spec, an enterprise bean must not use the java.io package to attempt to access files and directories in the file system.

              We had a very similar problem where one of our components needed external XML configuration. We fixed the problem using an MBean that would load the configuration file.

              The MBean's method would take the full path to the file and in order to load it we used twiddle to call the MBean method with the file's full path as parameter.

              Does this help you?

              • 4. Re: RAR deployment classloader?

                 

                "galderz" wrote:
                Where r u trying to load the configuration file? Is it from an MDB? Remember that according to the spec, an enterprise bean must not use the java.io package to attempt to access files and directories in the file system.

                We had a very similar problem where one of our components needed external XML configuration. We fixed the problem using an MBean that would load the configuration file.

                The MBean's method would take the full path to the file and in order to load it we used twiddle to call the MBean method with the file's full path as parameter.

                Does this help you?



                Unfortunately not - I'm trying to use an external JMS provider that is packaged as a RAR file (in other words, not my code otherwise I would have solved the problem :-) ). It contains an XML configuration file that is referenced in ra.xml via "xbean:foo.xml" - in other words it is using the spring framework and apparently the "xbean:" prefix roughly translates to "find this on the classpath".