fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.88k stars 643 forks source link

mvn clean docker:stop errors with io.fabric8.maven.docker.log.LogDispatcher cannot be cast to io.fabric8.maven.docker.log.LogDispatcher #793

Open abhsc opened 7 years ago

abhsc commented 7 years ago

Description

While testing/ running the plugin, I found this combination of goals causes the plugin to fail: clean + docker:stop

Whilst each work by themselves.

Info

> mvn clean
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Processor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ processor ---
[INFO]
[INFO] --- docker-maven-plugin:0.21.0:stop (docker-clean) @ processor ---
[INFO]
[INFO] --- docker-maven-plugin:0.21.0:remove (docker-clean) @ processor ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.923 s
[INFO] Finished at: 2017-05-30T11:29:58-04:00
[INFO] Final Memory: 23M/255M
[INFO] ------------------------------------------------------------------------
> mvn  docker:stop
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Processor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- docker-maven-plugin:0.21.0:stop (default-cli) @ processor ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.834 s
[INFO] Finished at: 2017-05-30T11:30:06-04:00
[INFO] Final Memory: 26M/331M
[INFO] ------------------------------------------------------------------------
> mvn clean  docker:stop
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Processor 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ processor ---
[INFO]
[INFO] --- docker-maven-plugin:0.21.0:stop (docker-clean) @ processor ---
[INFO]
[INFO] --- docker-maven-plugin:0.21.0:remove (docker-clean) @ processor ---
[INFO]
[INFO] --- docker-maven-plugin:0.21.0:stop (default-cli) @ processor ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.197 s
[INFO] Finished at: 2017-05-30T11:30:15-04:00
[INFO] Final Memory: 35M/320M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.21.0:stop (default-cli) on project processor: A type incompatibility occurred while executing io.fabric8:docker-maven-plugin:0.21.0:stop: io.fabric8.maven.docker.log.LogDispatcher cannot be cast to io.fabric8.maven.docker.log.LogDispatcher
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>io.fabric8:docker-maven-plugin:0.21.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/corp_user/.m2/repository/io/fabric8/docker-maven-plugin/0.21.0/docker-maven-plugin-0.21.0.jar
[ERROR] urls[1] = file:/Users/corp_user/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar
[ERROR] urls[2] = file:/Users/corp_user/.m2/repository/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar
[ERROR] urls[3] = file:/Users/corp_user/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
[ERROR] urls[4] = file:/Users/corp_user/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar
[ERROR] urls[5] = file:/Users/corp_user/.m2/repository/com/github/jnr/jnr-unixsocket/0.12/jnr-unixsocket-0.12.jar
[ERROR] urls[6] = file:/Users/corp_user/.m2/repository/com/github/jnr/jnr-ffi/2.0.9/jnr-ffi-2.0.9.jar
[ERROR] urls[7] = file:/Users/corp_user/.m2/repository/com/github/jnr/jffi/1.2.11/jffi-1.2.11.jar
[ERROR] urls[8] = file:/Users/corp_user/.m2/repository/com/github/jnr/jffi/1.2.11/jffi-1.2.11-native.jar
[ERROR] urls[9] = file:/Users/corp_user/.m2/repository/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar
[ERROR] urls[10] = file:/Users/corp_user/.m2/repository/org/ow2/asm/asm-commons/5.0.3/asm-commons-5.0.3.jar
[ERROR] urls[11] = file:/Users/corp_user/.m2/repository/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.jar
[ERROR] urls[12] = file:/Users/corp_user/.m2/repository/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar
[ERROR] urls[13] = file:/Users/corp_user/.m2/repository/org/ow2/asm/asm-util/5.0.3/asm-util-5.0.3.jar
[ERROR] urls[14] = file:/Users/corp_user/.m2/repository/com/github/jnr/jnr-x86asm/1.0.2/jnr-x86asm-1.0.2.jar
[ERROR] urls[15] = file:/Users/corp_user/.m2/repository/com/github/jnr/jnr-constants/0.9.1/jnr-constants-0.9.1.jar
[ERROR] urls[16] = file:/Users/corp_user/.m2/repository/com/github/jnr/jnr-enxio/0.12/jnr-enxio-0.12.jar
[ERROR] urls[17] = file:/Users/corp_user/.m2/repository/com/github/jnr/jnr-posix/3.0.29/jnr-posix-3.0.29.jar
[ERROR] urls[18] = file:/Users/corp_user/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] urls[19] = file:/Users/corp_user/.m2/repository/org/json/json/20140107/json-20140107.jar
[ERROR] urls[20] = file:/Users/corp_user/.m2/repository/org/bouncycastle/bcpkix-jdk15on/1.54/bcpkix-jdk15on-1.54.jar
[ERROR] urls[21] = file:/Users/corp_user/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.54/bcprov-jdk15on-1.54.jar
[ERROR] urls[22] = file:/Users/corp_user/.m2/repository/org/apache/maven/plugins/maven-assembly-plugin/2.6/maven-assembly-plugin-2.6.jar
[ERROR] urls[23] = file:/Users/corp_user/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[24] = file:/Users/corp_user/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[25] = file:/Users/corp_user/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[26] = file:/Users/corp_user/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[27] = file:/Users/corp_user/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[28] = file:/Users/corp_user/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[29] = file:/Users/corp_user/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[30] = file:/Users/corp_user/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[31] = file:/Users/corp_user/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[32] = file:/Users/corp_user/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[33] = file:/Users/corp_user/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[34] = file:/Users/corp_user/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar
[ERROR] urls[35] = file:/Users/corp_user/.m2/repository/org/codehaus/plexus/plexus-archiver/3.0.1/plexus-archiver-3.0.1.jar
[ERROR] urls[36] = file:/Users/corp_user/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
[ERROR] urls[37] = file:/Users/corp_user/.m2/repository/org/apache/maven/shared/file-management/1.1/file-management-1.1.jar
[ERROR] urls[38] = file:/Users/corp_user/.m2/repository/org/apache/maven/shared/maven-shared-io/1.1/maven-shared-io-1.1.jar
[ERROR] urls[39] = file:/Users/corp_user/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
[ERROR] urls[40] = file:/Users/corp_user/.m2/repository/org/apache/maven/shared/maven-filtering/1.3/maven-filtering-1.3.jar
[ERROR] urls[41] = file:/Users/corp_user/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar
[ERROR] urls[42] = file:/Users/corp_user/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[43] = file:/Users/corp_user/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.4/plexus-build-api-0.0.4.jar
[ERROR] urls[44] = file:/Users/corp_user/.m2/repository/org/codehaus/plexus/plexus-io/2.6/plexus-io-2.6.jar
[ERROR] urls[45] = file:/Users/corp_user/.m2/repository/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.jar
[ERROR] urls[46] = file:/Users/corp_user/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.21/plexus-utils-3.0.21.jar
[ERROR] urls[47] = file:/Users/corp_user/.m2/repository/org/apache/maven/shared/maven-repository-builder/1.0/maven-repository-builder-1.0.jar
[ERROR] urls[48] = file:/Users/corp_user/.m2/repository/joda-time/joda-time/2.9.4/joda-time-2.9.4.jar
[ERROR] urls[49] = file:/Users/corp_user/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar
[ERROR] urls[50] = file:/Users/corp_user/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar
[ERROR] urls[51] = file:/Users/corp_user/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.22/plexus-interpolation-1.22.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[project>com.company:processor:0.0.1-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
johan974 commented 7 years ago

I have the same issue on Windows 10 home. Any one has an answer?

rhuss commented 7 years ago

Sorry, I have currently no easy access to a Windows machine. Is it specific to windows or does it appear on other platforms for you, too ?

smasset commented 6 years ago

Same issue with docker-maven-plugin:0.23.0 when using wait on mapped TCP poirt

[INFO] DOCKER> [toto/couchbase-product-offering:master] "couchbase-product-offering": Start container 48014c6da1b9 [INFO] DOCKER> [toto/couchbase-product-offering:master] "couchbase-product-offering": Waiting for mapped ports [3093] on host 192.168.62.101 [INFO] DOCKER> [toto/couchbase-product-offering:master] "couchbase-product-offering": Waited on tcp port '[/192.168.62.101:3093]' 8514 ms [ERROR] DOCKER> Error occurred during container startup, shutting down... [INFO] DOCKER> [toto/couchbase-product-offering:master] "couchbase-product-offering": Stop and removed container 48014c6da1b9 after 0 ms [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 34.256 s [INFO] Finished at: 2017-11-21T18:52:20+01:00 [INFO] Final Memory: 69M/502M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.23.0:start (prepare-it-couchbase) on project product-offering-service: A type incompatibility occurred while executing io.fabric8:docker-maven-plugin:0.23.0:start: java.lang.Integer cannot be cast to java.lang.String [ERROR] ----------------------------------------------------- [ERROR] realm = plugin>io.fabric8:docker-maven-plugin:0.23.0 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy [ERROR] urls[0] = file:/C:/Cat1/Data/Maven/.m2/repository/io/fabric8/docker-maven-plugin/0.23.0/docker-maven-plugin-0.23.0.jar [ERROR] urls[1] = file:/C:/Cat1/Data/Maven/.m2/repository/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar [ERROR] urls[2] = file:/C:/Cat1/Data/Maven/.m2/repository/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar [ERROR] urls[3] = file:/C:/Cat1/Data/Maven/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar [ERROR] urls[4] = file:/C:/Cat1/Data/Maven/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar [ERROR] urls[5] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jnr-unixsocket/0.12/jnr-unixsocket-0.12.jar [ERROR] urls[6] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jnr-ffi/2.0.9/jnr-ffi-2.0.9.jar [ERROR] urls[7] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jffi/1.2.11/jffi-1.2.11.jar [ERROR] urls[8] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jffi/1.2.11/jffi-1.2.11-native.jar [ERROR] urls[9] = file:/C:/Cat1/Data/Maven/.m2/repository/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar [ERROR] urls[10] = file:/C:/Cat1/Data/Maven/.m2/repository/org/ow2/asm/asm-commons/5.0.3/asm-commons-5.0.3.jar [ERROR] urls[11] = file:/C:/Cat1/Data/Maven/.m2/repository/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.jar [ERROR] urls[12] = file:/C:/Cat1/Data/Maven/.m2/repository/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar [ERROR] urls[13] = file:/C:/Cat1/Data/Maven/.m2/repository/org/ow2/asm/asm-util/5.0.3/asm-util-5.0.3.jar [ERROR] urls[14] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jnr-x86asm/1.0.2/jnr-x86asm-1.0.2.jar [ERROR] urls[15] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jnr-constants/0.9.1/jnr-constants-0.9.1.jar [ERROR] urls[16] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jnr-enxio/0.12/jnr-enxio-0.12.jar [ERROR] urls[17] = file:/C:/Cat1/Data/Maven/.m2/repository/com/github/jnr/jnr-posix/3.0.29/jnr-posix-3.0.29.jar

gammelsmoelf commented 6 years ago

I got the same issue executing clean install docker:run on an ubuntu 16.04.3 with maven 3.3.9 and plugin version 0.23.0

kemburi commented 6 years ago

mee too

kgonia commented 6 years ago

I had same problem. Exposing docker port helps. The Docker client will default to connecting to unix:///var/run/docker.sock on Linux, and tcp://127.0.0.1:2376 on Windows.

In fabric config you must specify docker host:

http://127.0.0.1:2375 - windows unix:///var/run/docker.sock - unix If you are using docker on windows you must check 'Expose daemon on tcp://127.0.0.1:2376' in Docker settings.
kedarr commented 6 years ago

I am also facing this issue. Any working solution available ?

fmiguelez commented 3 months ago

I still see the issue in latest version 0.44.0. I am using Java 17.

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /usr/share/maven
Java version: 17.0.9, vendor: Eclipse Adoptium, runtime: /opt/java/openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.123.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

[main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal io.fabric8:docker-maven-plugin:0.44.0:stop (stop-databus-stack) on project dbus-api-client: A type incompatibility occurred while executing io.fabric8:docker-maven-plugin:0.44.0:stop: class io.fabric8.maven.docker.log.LogDispatcher cannot be cast to class io.fabric8.maven.docker.log.LogDispatcher (io.fabric8.maven.docker.log.LogDispatcher is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @3e4a79c9; io.fabric8.maven.docker.log.LogDispatcher is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @59b5a91f)

rohanKanojia commented 3 months ago

@fmiguelez : Could you please share reproducer project?