8 Replies Latest reply: Feb 4, 2013 9:51 AM by Sham Phadtale RSS

classoverirding in jboss

shiva Newbie

we want implement patch processas we ship our app to our client.
we have a EAR file with utility jar files and web apps.every time we fix a issue we want to make a jar(patch.jar) containing only those changes for tha same classes which exists in EAR file utility jars.
How do i force jboss to load classes from patch.jar instead of jar in ear file.

  • 2. Re: classoverirding in jboss
    shiva Newbie

    Thanks peter that worked.Thanks a lot.

  • 3. Re: classoverirding in jboss
    shiva Newbie

    I was trying to put more than one jar files but it seems to be not liking.
    i tried to do like this .
    -Djboss.patch.url=file:/E:/jbossinstall/patch/axeda_patch2.jar;
    file:/E:/jbossinstall/patch/axeda_patch2.jar;

    it always take the first jar and ignores the second one.


    Any ideas???

  • 4. Re: classoverirding in jboss
    Peter Johnson Master

    Set it to the directory:

    -Djboss.patch.url=file:/E:/jbossinstall/patch/

    It should then load all JARs in that directory.

  • 5. Re: classoverirding in jboss
    shiva Newbie

    I want to control in what order jars(setting classpath) files will be loaded so that java can load the a.class from a.jar rather than b.jar when both a.jar and b.jar has the same class.

  • 6. Re: classoverirding in jboss
    Peter Johnson Master

    I can see why you want to do that for patching, but the jboss.patch.url property only allows only a single entry which is either a directory or a file. You could always modify the JBossAS source code to allow a file list for jboss.patch.url.

  • 7. Re: classoverirding in jboss
    shiva Newbie

    Peter,
    The code is in serverImpl.java of jboss-system.jar initBootLibraries() method which is private.

    /**
    * Initialize the boot libraries.
    */
    private RepositoryClassLoader initBootLibraries() throws Exception
    {
    // Build the list of URL for the spine to boot
    List list = new ArrayList();

    // Add the patch URL. If the url protocol is file, then
    // add the contents of the directory it points to
    URL patchURL = config.getPatchURL();
    if (patchURL != null)
    {
    if (patchURL.getProtocol().equals("file"))
    {
    File dir = new File(patchURL.getFile());
    if (dir.exists())
    {
    // Add the local file patch directory
    list.add(dir.toURL());

    // Add the contents of the directory too
    File[] jars = dir.listFiles(new FileSuffixFilter(new String[] { ".jar", ".zip" }, true));

    for (int j = 0; jars != null && j < jars.length; j++)
    {
    list.add(jars[j].getCanonicalFile().toURL());
    }
    }
    }
    else
    {
    list.add(patchURL);
    }
    }

    this code needs to chnage to accept multiple files.I am not sure whether it is good idea to modify as it will be very hard to maintain .Do you have any suggestion!!



  • 8. Re: classoverirding in jboss
    Sham Phadtale Newbie

    Hello all,

     

    I am having similar problem as of Shiva.

    I have sar, ear and war files deployed in JBoss 5.1 AS. After fixing some bug I want to give updated files to client in a patch.

    For this just testing purpose I updated one files logger message, created ear file and put it into patch folder created under ...\server\jboss-5.1.0.GA directory.

    I am starting server by calling run.bat with "-c -Djboss.patch.url=file:/D:/release/server/jboss-5.1.0.GA/patch"

    After server started I check log, it shows old message, that is patch does not got deployed. I also tried with giving ear file name while running run.bat file("-c -Djboss.patch.url=file:/D:/release/server/jboss-5.1.0.GA/patch/app.ear") but no success.

     

    I am not getting what is wrong.

    1. Is patch ear should contain only updated class files with package structure as of actual ear?

    2. Is there any other jboss variable which can block patch deploment?

    3. What should be patch location?