State machine generates null pointer exception when it does not find component 
plugin for one of the active services mentioned in cluster definition
----------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: AMBARI-139
                 URL: https://issues.apache.org/jira/browse/AMBARI-139
             Project: Ambari
          Issue Type: Bug
          Components: controller
            Reporter: vitthal (Suhas) Gogate


Scenario:
1. User defines a cluster w/ a stack that has only common and hdfs components 
defined in it.
2. User specifies active services as "mapred" and "hdfs", where "mapred" 
component is not in the stack.
3. State machine gets null pointer when loading the component plugin for 
"mapred" as one of the active services.

** this may not be the case as we may have all the components defined as part 
of our default stack, but at least we have to make sure
   that if user specifies some absurd name as part of active services in the 
cluster definition, we should not be looking for the its component definition 
and if plugin pointer is null we should not operate further on this. 

 public ServiceImpl(Cluster cluster, ClusterFSM clusterFsm, String serviceName)
      throws IOException {
    this.clusterFsm = clusterFsm;
    this.serviceName = serviceName;
    //load plugin and get the roles and create them
    this.plugin = cluster.getComponentDefinition(serviceName);   *** CHECK if 
plugin is not null?? **
    String[] roles = this.plugin.getActiveRoles();  ** NULL pointer exception 
here for "mapred" component *** 
    for (String role : roles) {
      RoleImpl roleImpl = new RoleImpl(this, role);
      serviceRoles.add(roleImpl);
    }
    
    stateMachine = stateMachineFactory.make(this);
  }
  

java.lang.NullPointerException
        at 
org.apache.ambari.resource.statemachine.ServiceImpl.<init>(ServiceImpl.java:128)
        at 
org.apache.ambari.resource.statemachine.ClusterImpl.<init>(ClusterImpl.java:121)
        at 
org.apache.ambari.resource.statemachine.StateMachineInvoker.createCluster(StateMachineInvoker.java:81)
        at org.apache.ambari.controller.Clusters.addCluster(Clusters.java:498)
        at org.apache.ambari.controller.Clusters.<init>(Clusters.java:139)
        at org.apache.ambari.controller.Clusters.getInstance(Clusters.java:151)
        at org.apache.ambari.controller.Controller.run(Controller.java:110)
        at org.apache.ambari.controller.Controller.main(Controller.java:143)
2011-11-26 17:14:09.392:INFO::jetty-6.1.26
Nov 26, 2011 5:14:09 PM com.sun.jersey.api.core.PackagesResourceConfig in

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to