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

    Unable to add classpath entry at runtime in jboss 7

    zubair aslam Newbie

      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