Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-1122

ServletRuntime lookup only returns servlets of first web application found

    Details

      Description

      After enriching our regular maven built .ear i noticed the following exception:

      ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.

      It appears the lookup for servletRuntimes only returns the servlets of the first web application in the deployment. In our .ear we have several web modules and the first one found wasn't the module i enriched using Arquillian.

      WebLogicJMXClient.java
      private ObjectName[] findServletRuntimes(ObjectName wlServerRuntime, String deploymentName) throws Exception
            {
               ObjectName[] applicationRuntimes = (ObjectName[]) connection.getAttribute(wlServerRuntime, "ApplicationRuntimes");
               for(ObjectName applicationRuntime: applicationRuntimes)
               {
                  String applicationName = (String) connection.getAttribute(applicationRuntime, "Name");
                  if(applicationName.equals(deploymentName))
                  {
                     ObjectName[] componentRuntimes = (ObjectName[]) connection.getAttribute(applicationRuntime, "ComponentRuntimes");
                     for(ObjectName componentRuntime : componentRuntimes)
                     {
                        String componentType = (String) connection.getAttribute(componentRuntime, "Type");
                        if (componentType.toString().equals("WebAppComponentRuntime"))
                        {
                           ObjectName[] servletRuntimes = (ObjectName[]) connection.getAttribute(componentRuntime, "Servlets");
                           return servletRuntimes;
                        }
                     }
                  }
               }
               throw new DeploymentException(
                     "The deployment details were not found in the MBean Server. Possible causes include:\n"
                           + "1. The deployment failed. Review the admin server and the target's log files.\n"
                           + "2. The deployment succeeded partially. The deployment must be the Active state. Instead, it might be in the 'New' state.\n"
                           + "   Verify that the the admin server can connect to the target(s), and that no firewall rules are blocking the traffic on the admin channel.");
            }
      
      "Returning all servlets found" WebLogicJMXClient.java
      private List<ObjectName> findServletRuntimes(ObjectName wlServerRuntime, String deploymentName) throws Exception
            {
               ObjectName[] applicationRuntimes = (ObjectName[]) connection.getAttribute(wlServerRuntime, "ApplicationRuntimes");
               for(ObjectName applicationRuntime: applicationRuntimes)
               {
                  String applicationName = (String) connection.getAttribute(applicationRuntime, "Name");
                  if(applicationName.equals(deploymentName))
                  {
                     List<ObjectName> servletRuntimes = new ArrayList<ObjectName>();
                     ObjectName[] componentRuntimes = (ObjectName[]) connection.getAttribute(applicationRuntime, "ComponentRuntimes");
                     for(ObjectName componentRuntime : componentRuntimes)
                     {
                        String componentType = (String) connection.getAttribute(componentRuntime, "Type");
                        if (componentType.toString().equals("WebAppComponentRuntime"))
                        {
                           servletRuntimes.addAll(Arrays.asList((ObjectName[]) connection.getAttribute(componentRuntime, "Servlets")));
                        }
                     }
                     return servletRuntimes;
                  }
               }
               throw new DeploymentException(
                     "The deployment details were not found in the MBean Server. Possible causes include:\n"
                           + "1. The deployment failed. Review the admin server and the target's log files.\n"
                           + "2. The deployment succeeded partially. The deployment must be the Active state. Instead, it might be in the 'New' state.\n"
                           + " Verify that the the admin server can connect to the target(s), and that no firewall rules are blocking the traffic on the admin channel.");
            }
         }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                vineet.reynolds Vineet Reynolds
                Reporter:
                rabbink Ralph Abbink
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: