question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NPE when using <external>

See original GitHub issue

Description

When using <external>, DMP throws a NPE. Following the docs at https://dmp.fabric8.io/#combining-property-config .

Info

  • d-m-p version : 0.31.0
  • Maven version (mvn -v) : Maven home: /sw/prog/maven-3.6.0 Java version: 12.0.1, vendor: Oracle Corporation, runtime: /sw/prog/jdk/12.0.1 Default locale: en_US, platform encoding: UTF-8 OS name: “linux”, version: “4.15.0-55-generic”, arch: “amd64”, family: “unix”

  • Docker version :Docker version 18.04.0-ce, build 3d479c0
  • If it’s a bug, how to reproduce : It seems it’s caused by lack of some expected property.
                <configuration>
                    <logDate>default</logDate>
                    <useColor>true</useColor>
                    <verbose>build</verbose>
                    <logStdout>true</logStdout>
                    <autoPull>true</autoPull>
                    <images>
                        <!-- RocketDB with Dev Tools. -->
                        <image>
                            <alias>centos7-devtools</alias>
                            <name>gitlab.k.arpage.ch:4999/ad-swiss/ad-epd/rocketdb:centos7-with-dev</name>
                            <external>
                                <type>properties</type>
                                <prefix>docker</prefix>
                                <mode>override</mode>
                            </external>
                            <build>
                                <tags></tags>
                                <from>centos:7</from>
                                <runCmds>
                                    <!-- set -e; set -o pipefail; shopt -s inherit_errexit; -->
                                    <run>yum update -y</run>
                                    <run>yum install -y curl wget unzip tree git openssl openssh-client</run>

                                    <run>mkdir -p /sw/ &amp;&amp; chmod a+rwx /sw/</run>
                                    <!--<run>yum -y install maven</run> Gives 3.0.5 -->
                                    <run>( \
                                        wget --no-verbose -O jdk12.tgz https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_linux-x64_bin.tar.gz; \
                                        tar xvzf jdk12.tgz -C /sw/; \
                                        rm jdk12.tgz; \
                                        rm -rf /sw/jdk12; \
                                        mv /sw/*jdk* /sw/jdk12; \
                                        java -version; \
                                    )</run>
                                    <!--
                                    echo 'export PATH="$PATH:/sw/jdk12/bin"' >> ~/.bashrc; \
                                    echo 'export JAVA_HOME=/sw/jdk12' >> ~/.bashrc; \
                                    export PATH="$PATH:/sw/jdk12/bin"; \
                                    -->

                                    <run>wget --no-verbose -O maven.zip http://www.pirbot.com/mirrors/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.zip</run>
                                    <run>unzip maven.zip -d /sw/</run>
                                    <run>rm maven.zip</run>
                                    <run>rm -rf /sw/maven</run>
                                    <run>mv /sw/apache-maven-* /sw/maven</run>
                                    <!--
                                    <run>echo 'export PATH="$PATH:/sw/maven/bin"' >> ~/.bashrc</run>
                                    <run>echo 'export M2_HOME=/sw/maven' >> ~/.bashrc</run>
                                    <run>export PATH="$PATH:/sw/maven/bin"</run>
                                    -->
                                    <run>mvn -v</run>
                                </runCmds>
                                <optimise>false</optimise>
                                <cmd>/bin/bash</cmd>
                            </build>
                            <run>
                                <env><JAVA_HOME>/sw/jdk12</JAVA_HOME></env>
                                <env><M2_HOME>/sw/maven</M2_HOME></env>
                                <env><PATH>$M2_HOME/bin:$JAVA_HOME/bin:$PATH</PATH></env>
                            </run>
                        </image>
                    </images>
                </configuration>
...
    <properties>
        <docker.env.PATH>/sw/jdk12:/sw/maven:$PATH</docker.env.PATH>
    </properties>

This throws:

Caused by: java.lang.NullPointerException
    at io.fabric8.maven.docker.config.handler.property.PropertyConfigHandler.extractBuildConfiguration (PropertyConfigHandler.java:136)
    at io.fabric8.maven.docker.config.handler.property.PropertyConfigHandler.resolve (PropertyConfigHandler.java:73)
    at io.fabric8.maven.docker.config.handler.ImageConfigResolver.resolve (ImageConfigResolver.java:98)
    at io.fabric8.maven.docker.AbstractDockerMojo$1.resolve (AbstractDockerMojo.java:331)
    at io.fabric8.maven.docker.config.ConfigHelper.resolveConfiguration (ConfigHelper.java:159)
    at io.fabric8.maven.docker.config.ConfigHelper.resolveImages (ConfigHelper.java:57)
    at io.fabric8.maven.docker.AbstractDockerMojo.initImageConfiguration (AbstractDockerMojo.java:325)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:224)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
rohanKanojiacommented, Nov 13, 2019

@svenhaag : cool, it would be released soon

1reaction
rhusscommented, Oct 11, 2019

There’s a fix merged in recently which should solve this issue. Could you please try whether a d-m-p built from master does fix it for you ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException when reading from external properties file
Looks like your Environment object is not loaded and binded and is null. Try to inject the Environment variable using @Resource. Replace
Read more >
I'm getting a NullPointerException when trying to ... - IBM
I'm trying to connect to an external ECM server but when I test the connection, I am getting the NullPointerException: CNTR0020E: EJB threw...
Read more >
getDescribe() of an External Object throws NPE
I have a external object called "TD_Account__x" whose label is "TD Account". I am trying to do a describe call on "TD_Account__x" and...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
The null pointer exceptions can be prevented using null checks and preventive coding techniques. Look at below code examples showing how to ...
Read more >
1 Npe A With External Circ Pump En | Downloads - Navien
Navien tankless water heaters & boilers for residential and commercial applications use innovative high efficiency technology to provide a comfortable ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found