Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5909

UnsupportedOperationException if a module's resource root defined in jboss-deployment-structure.xml does not exist

    XMLWordPrintable

Details

    Description

      An empty test.war with this will throw UnsupportedOperationException if a resource-root path is specified that does not exist.

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

      <module name="deployment.example">
      <resources>
      <resource-root path="../../../../../../../../work/workspace/release/build/classes/main" />
      </resources>
      </module>
      </jboss-deployment-structure>

      Here is the exception:

      11:56:53,819 WARN [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015959: Additional resource root /work/workspace/release/build/classes/main added via jboss-deployment-structure.xml does not exist
      11:56:53,821 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."test.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment "test.war"
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:126) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_21]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_21]
      at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_21]
      Caused by: java.lang.UnsupportedOperationException
      at java.util.Collections$UnmodifiableList$1.remove(Collections.java:1183) [rt.jar:1.6.0_21]
      at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:201) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
      ... 5 more

      The issue looks like:
      org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser itr.remove() is called, but the additionalModule.getResourceRoots is returning the list as Collections.unmodifiableList.

      It looks like if a <deployment> lists resource roots that do not exist, it just logs a warning. So I think the fix is to remove the Collections.unmodifiableList from ModuleStructureSpec, but I'm not sure if there was a reason unmodifiableList was added.

      final ListIterator<ResourceRoot> itr = additionalModule.getResourceRoots().listIterator();
      while (itr.hasNext()) {
      final ResourceRoot resourceRoot = itr.next();
      if(!resourceRoot.getRoot().exists())

      { ServerLogger.DEPLOYMENT_LOGGER.additionalResourceRootDoesNotExist(resourceRoot.getRoot().getPathName()); itr.remove(); }

      }

      org.jboss.as.server.deployment.module.descriptor.ModuleStructureSpec

      class ModuleStructureSpec {

      private final List<ResourceRoot> resourceRoots = new ArrayList<ResourceRoot>();

      public List<ResourceRoot> getResourceRoots()

      { return Collections.unmodifiableList(resourceRoots); }

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            rhn-support-bmaxwell Brad Maxwell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: