[ 
https://issues.apache.org/jira/browse/BROOKLYN-117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15987855#comment-15987855
 ] 

Aled Sage commented on BROOKLYN-117:
------------------------------------

The NPE happens if {{entity.getAttribute(JMX_PORT)}} returns {{null}}. The 
{{getBrooklynAccessibleAddress}} takes an {{int}}, hence getting the NPE.

Wild guess is that the requested jmx_port was not available (in use by another 
process).

This code is now guarded to more gracefully handle if the JMX_PORT attribute is 
null.

We haven't seen this in a very long time, so I'm going to assume that it's 
fixed.

> NullPointerException in JmxSupport
> ----------------------------------
>
>                 Key: BROOKLYN-117
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-117
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Sam Corbett
>
> I deployed this blueprint to a Clocker location running in Softlayer:
> {code}
> name: ActiveMQ
> location: my-docker-cloud
> services:
> - type: brooklyn.entity.messaging.activemq.ActiveMQBroker
>   brooklyn.config:
>     docker.dockerfile.url: 
> https://s3-eu-west-1.amazonaws.com/brooklyn-docker/UsesJavaDockerfile
> - type: brooklyn.entity.messaging.activemq.ActiveMQBroker
>   brooklyn.config:
>     docker.dockerfile.url: 
> https://s3-eu-west-1.amazonaws.com/brooklyn-docker/UsesJavaDockerfile
> {code}
> One of the ActiveMQ brokers failed to start because of a 
> {{NullPointerException}} thrown from {{JmxSupport}}:
> {code}
> 2015-01-12 16:50:43,682 DEBUG b.u.task.BasicExecutionManager 
> [brooklyn-execmanager-ZYItXzrw-262]: Exception running task 
> Task[pre-install-command:GRPp1Omr] (rethrowing): null
> java.lang.NullPointerException: null
>       at 
> brooklyn.entity.java.JmxSupport.applyJmxJavaSystemProperties(JmxSupport.java:275)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.java.JavaSoftwareProcessSshDriver.getJmxJavaSystemProperties(JavaSoftwareProcessSshDriver.java:257)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.java.JavaSoftwareProcessSshDriver.getJavaSystemProperties(JavaSoftwareProcessSshDriver.java:206)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.java.JavaSoftwareProcessSshDriver.getJavaOpts(JavaSoftwareProcessSshDriver.java:124)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.java.JavaSoftwareProcessSshDriver.getShellEnvironment(JavaSoftwareProcessSshDriver.java:104)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.messaging.activemq.ActiveMQSshDriver.getShellEnvironment(ActiveMQSshDriver.java:139)
>  ~[brooklyn-software-messaging-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.basic.AbstractSoftwareProcessSshDriver.execute(AbstractSoftwareProcessSshDriver.java:301)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.basic.AbstractSoftwareProcessSshDriver.execute(AbstractSoftwareProcessSshDriver.java:284)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.basic.AbstractSoftwareProcessSshDriver.runPreInstallCommand(AbstractSoftwareProcessSshDriver.java:418)
>  ~[brooklyn-software-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.entity.basic.AbstractSoftwareProcessDriver$2.run(AbstractSoftwareProcessDriver.java:106)
>  ~[brooklyn-clocker-patches-0.8.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
> ~[na:1.7.0_51]
>       at 
> brooklyn.util.task.DynamicSequentialTask$DstJob.call(DynamicSequentialTask.java:337)
>  ~[brooklyn-core-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at 
> brooklyn.util.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:469)
>  ~[brooklyn-core-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
> [na:1.7.0_51]
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_51]
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_51]
>       at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]
> {code}
> Line 275 of {{JmxSupport}} is:
> {code}
>         HostAndPort jmx = 
> BrooklynAccessUtils.getBrooklynAccessibleAddress(entity, 
> entity.getAttribute(JMX_PORT));
> {code}
> The {{entity}} field should not be null in a sane world because it's 
> protected by a {{checkNotNull}} in the class' constructor.
> Two subsequent deployments of the same blueprint were successful.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to