1 Reply Latest reply on Apr 29, 2014 3:37 AM by mail2zaslam

    Unable to add classpath entry at runtime in jboss 7

    mail2zaslam

      Hi,

       

      I am migrating an application form weblogic 10 to jboss 7.

      i have spring code which needs a property file and a log4j jar from specific location to be present in classpath.

       

      Below is the code i ahve used to add the classpath entry:

       

      // Define our jar file with a "InteractionHandler.properties" file in the 'test' package.

              URL myProp = new File("D:/home/esap/apps/InteractionHandler/conf/").toURL();

       

              // Set up a URLClassLoader with the new Jar adn property file in it.

              URLClassLoader loader = null;

              try {

                  ClassLoader parentLoader = ClasspathPropertLoader.class.getClassLoader();

                  loader = new URLClassLoader(

                          new URL[] { myProp }, parentLoader);

              } catch (Exception murle) {

                  murle.printStackTrace();

              }

              ClasspathPropertLoader obj = new ClasspathPropertLoader();


      i can read the files under this classpath entry from a standalone class.

      but if same code i am using on jboss 7, this doesnt seem to be working.


      can anyone guide me with this , i am stuck for last 2 days


      Thanks in advance

      Zubair

        • 1. Re: Unable to add classpath entry at runtime in jboss 7
          mail2zaslam

          Can i add classpath directory at runtime in jboss 7 (EAP6.1 or EAP 6.2) ?

          i am able to do that in a simple java class but since JBOSS uses modular classloading startegy is there any way to do it ?

           

          I need to load a property file inoto classpath which is later used by Spring "ReloadablePropertiesFactoryBean" .