Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-7389

Add support for reloading plugins and libraries classes in tomcat distribution

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5
    • Component/s: None

      Description

      This means to be able to reload classes inside the bundles (or third party jars) that are configured as hot reloadable.
      This is needed to be able to hot reload bundles (containing classes) from Nuxeo IDE (or other tools) when using a tomcat distribution.

      To enable hot reload you should modify the conf/Catalina/localhost/nuxeo.xml context configuration file and replace:

      <Loader className="org.nuxeo.runtime.tomcat.NuxeoWebappLoader"
      loaderClass="org.nuxeo.runtime.tomcat.NuxeoWebappClassLoader" />

      by

      <Loader className="org.nuxeo.runtime.tomcat.NuxeoWebappLoader"
      loaderClass="org.nuxeo.runtime.tomcat.dev.NuxeoDevWebappClassLoader" />

      Then you will be able to reload jars or bundles that ARE NOT in nxserver/bundles or nxserver/lib by specifyin the list of these bundles in the file nxserver/dev.bundles.

      The format of this file is one file path per line (the file corresponding to the bundle JAR or directory).
      Thus, you can point to project bin directories in your Eclipse IDE, or on JARs outside nuxeo server.

      To specify a third party JAR that is not a BUNDLE you must prepend its path with a !.
      YOu can use blank lines or lines starting with # for comments.
      Example:

      /path/to/may/project1/bin
      /path/to/may/project2/bin
      !/path/to/may/thirdparty.jar
      ...


      Here is an explanation of what is doing the NuxeoDevWebappClassLoader:

      after nuxeo was started the dev.bundles files will be tracked (using an interval of 2 seconds) for modifications
      and all bundles or third parties specified in the file will be reloaded.

      Reloading means, recreate a classloader containing the bundle/jars specified in dev.bundles and reinstall the bundles (as OSGi bundles).

      The local classloader that is recreated will be used by the nuxeo webapp classloader (the one corresponding to the nuxeo tomcat webapp) to load classes that are not directly deployed in nuxeo.

      This local classloader will contain only the bundles/jars specified in dev.bundles but will see all the Nuxeo JARS from its parent classloader (the webapp classloader)
      the local classloader will have as parent the nuxeo webapp loader.

      So when loading a class from a Nuxeo bundle it will use the NXClassLoader that will first look in the nuxeo webapp then if the class is not found it will look into the configured children Local class loaders. The local classloader will look for the class only inside the bundles configured through dev.bundles and will not query the parent classloader to avoid infinite loops.

      When a local classloader is directly used by some code to load a class it will first look into the configured dev.bundles then will ask the parent classloader (the Nuxeo webapp classloader) to load the class if needed.

      Each time the dev.bundles file changes the local classloader will be recreated and the old one replaced in nuxoe webapp classloader.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.