brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aled Sage (JIRA)" <j...@apache.org>
Subject [jira] [Created] (BROOKLYN-100) NPE deploying yaml app with empty `brooklyn.config:`
Date Mon, 08 Dec 2014 20:59:12 GMT
Aled Sage created BROOKLYN-100:
----------------------------------

             Summary: NPE deploying yaml app with empty `brooklyn.config:`
                 Key: BROOKLYN-100
                 URL: https://issues.apache.org/jira/browse/BROOKLYN-100
             Project: Brooklyn
          Issue Type: Bug
            Reporter: Aled Sage
            Priority: Trivial


Looking at a customer's info log file, I saw the following NPE. We should fail more gracefully
than that. 

```
2014-12-03 04:34:36,634 WARN  b.r.u.DefaultExceptionMapper [brooklyn-jetty-server-8081-qtp423360603-26]:
REST call generated exception type class java.lang.NullPointerException unrecognized in class
brooklyn.rest.util.DefaultExceptionMapper (subsequent occu
rrences will be logged debug only): java.lang.NullPointerException: null value in entry: brooklyn.config=null
java.lang.NullPointerException: null value in entry: brooklyn.config=null
        at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)
~[guava-17.0.jar:na]
        at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:88)
~[guava-17.0.jar:na]
        at com.google.common.collect.ImmutableMap.copyOf(ImmutableMap.java:294) ~[guava-17.0.jar:na]
        at io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationContext.<init>(PlanInterpretationContext.java:37)
~[camp-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at io.brooklyn.camp.spi.resolve.PdpProcessor.applyInterpreters(PdpProcessor.java:174)
~[camp-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at io.brooklyn.camp.spi.resolve.PdpProcessor.parseDeploymentPlan(PdpProcessor.java:74)
~[camp-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at io.brooklyn.camp.spi.resolve.PdpProcessor.parseDeploymentPlan(PdpProcessor.java:60)
~[camp-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at io.brooklyn.camp.spi.resolve.PdpProcessor.registerDeploymentPlan(PdpProcessor.java:81)
~[camp-base-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at brooklyn.rest.resources.ApplicationResource.createFromYaml(ApplicationResource.java:269)
~[brooklyn-rest-server-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_71]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_71]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.7.0_71]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_71]
        at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
~[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
~[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
~[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
~[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
~[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
~[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
~[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
[jersey-server-1.18.1.jar:1.18.1]
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
[jersey-servlet-1.18.1.jar:1.18.1]
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
[jersey-servlet-1.18.1.jar:1.18.1]
        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:909)
[jersey-servlet-1.18.1.jar:1.18.1]
        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:857)
[jersey-servlet-1.18.1.jar:1.18.1]
        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:811)
[jersey-servlet-1.18.1.jar:1.18.1]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1338)
[jetty-servlet-8.1.4.v20120524.jar:8.1.4.v20120524]
        at brooklyn.rest.filter.HaMasterCheckFilter.doFilter(HaMasterCheckFilter.java:64)
[brooklyn-rest-server-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1338)
[jetty-servlet-8.1.4.v20120524.jar:8.1.4.v20120524]
        at brooklyn.rest.filter.LoggingFilter.doFilter(LoggingFilter.java:88) [brooklyn-rest-server-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1338)
[jetty-servlet-8.1.4.v20120524.jar:8.1.4.v20120524]
        at brooklyn.rest.filter.BrooklynPropertiesSecurityFilter.doFilter(BrooklynPropertiesSecurityFilter.java:122)
[brooklyn-rest-server-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1338)
[jetty-servlet-8.1.4.v20120524.jar:8.1.4.v20120524]
        at brooklyn.rest.filter.RequestTaggingFilter.doFilter(RequestTaggingFilter.java:48)
[brooklyn-rest-server-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1338)
[jetty-servlet-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:484) [jetty-servlet-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) [jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) [jetty-security-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) [jetty-servlet-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) [jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.Server.handle(Server.java:350) [jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851) [jetty-http-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
[jetty-server-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:620)
[jetty-io-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
[jetty-io-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
[jetty-util-8.1.4.v20120524.jar:8.1.4.v20120524]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
[jetty-util-8.1.4.v20120524.jar:8.1.4.v20120524]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
```

To reproduce, try deploying the yaml below.

```
location: localhost
services:
- type: brooklyn.entity.basic.BasicApplication
  brooklyn.config:
```

It actually reports quite nicely. It says "ERROR: null value in entry: brooklyn.config=null".

I think we should probably accept that as empty config, rather than failing on null.

An easy fix would be to use a `MutableMap.copyOf` instead of `ImmutableMap.copyOf` in `PlanInterpretationContext.<init>:37`.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message