Closed franciscocpg closed 6 years ago
I think this is caused by a problem in the flapdoodle embedded mongo library that this plugin uses. I think if we update to the latest version of that library, it's likely to fix this.
Hi, I do experience the same issue. As the last comment on the flapdoodle.embed's related issue discussion points out, there is the chance it works with the newer version: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/issues/116
Is there any chance for a new release, comprising the updated version? Thanks in advance /Tom
Yes sure, it's about time we updated this dependency. I suspect there are probably some breaking changes so I'll update and see what needs to be done. On 29 Oct 2015 12:18 am, "wThomas84" notifications@github.com wrote:
Hi, I do experience the same issue. As the last comment on the flapdoodle.embed's related issue discussion points out, there is the chance it works with the newer version: flapdoodle-oss/de.flapdoodle.embed.mongo#116 https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/issues/116
Is there any chance for a new release, comprising the updated version? Thanks in advance /Tom
— Reply to this email directly or view it on GitHub https://github.com/joelittlejohn/embedmongo-maven-plugin/issues/44#issuecomment-152038189 .
Strange, I just learned that updating to your version 0.2.0 seems to fix the issue at least for me, although I couldn't find any changes in the history of your pom regarding the flapdoodle dependency.
Upgrading to 1.50.0 won't solve this FileUtils issue, but will help others trying to use MongoDb-3.0.x Check https://github.com/joelittlejohn/embedmongo-maven-plugin/issues/50
Something is happening here that's removing commons-io from the dependency tree.
mvn dependency:tree
in this repo:
...
[INFO] +- de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.46.0:compile
[INFO] | \- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.39.0:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | +- net.java.dev.jna:jna:jar:4.0.0:compile
[INFO] | +- net.java.dev.jna:jna-platform:jar:4.0.0:compile
[INFO] | \- org.apache.commons:commons-compress:jar:1.3:compile
...
mvn dependency:tree
in de.flapdoodle.embed.mongo 1.46.0:
...
[INFO] +- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.39.0:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | +- net.java.dev.jna:jna:jar:4.0.0:compile
[INFO] | +- net.java.dev.jna:jna-platform:jar:4.0.0:compile
[INFO] | \- org.apache.commons:commons-compress:jar:1.3:compile
...```
If you run
mvn -Dverbose dependency:tree
the commons-io dependency will show up.
[INFO] +- de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.46.0:compile
[INFO] | \- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.39.0:compile
[INFO] | +- commons-io:commons-io:jar:2.2:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | +- net.java.dev.jna:jna:jar:4.0.0:compile
[INFO] | +- net.java.dev.jna:jna-platform:jar:4.0.0:compile
[INFO] | | \- (net.java.dev.jna:jna:jar:4.0.0:compile - omitted for duplicate)
[INFO] | \- org.apache.commons:commons-compress:jar:1.3:compile
Although the listed version is 2.2 (instead of 2.4). Might have something to do with the commons-io dependency (version 2.2) from the maven-plugin-testing-harness.
[INFO] +- org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:3.3.0:test
[INFO] | +- (commons-io:commons-io:jar:2.2:compile - scope updated from test; omitted for duplicate)
[INFO] | \- org.codehaus.plexus:plexus-archiver:jar:2.2:test
[INFO] | +- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:test - omitted for duplicate)
[INFO] | +- (org.codehaus.plexus:plexus-utils:jar:3.0.7:test - omitted for conflict with 3.0.20)
[INFO] | \- org.codehaus.plexus:plexus-io:jar:2.0.4:test
[INFO] | \- (org.codehaus.plexus:plexus-utils:jar:3.0:test - omitted for conflict with 3.0.20)
Maven docs say that
More specifically, in verbose mode the dependency tree shows dependencies that were omitted for: being a duplicate of another; conflicting with another's version and/or scope; and introducing a cycle into the dependency tree.
I have the same issue with Maven 3.3.3, but using Maven 3.0.5 works flawlessly.
It fails for me with Maven 3.2.5, even if I stick commons-io 2.4 explicitly into the plugin declaration as a dependency.
This is a problem with the thread context class loader. de.flapdoodle.embed.process.store.CachingArtifactStore$CacheCleaner.run is running in a thread and the tccl isn't set right. Let me see if this can be fixed in here.
it's more complex. The flapdoodle code creates a thread. That thread tries to run 'late' in the process, by which time, something is horribly wrong with the classloading environment.
I have the same problem with versions 3.2.1 and 3.3.9. With 3.0.5 works correctly.
Note, there are more reports of this at flapdoodle-oss/de.flapdoodle.embed.mongo#116. Cause is still unclear but it looks like some kind of unsafe cleanup approach is taken in the flapdoodle API.
FYI - This is still happening with version 0.3.4 of this plugin as of 12 January 2017.
Same here, I used <artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>1.50.5</version>
and I still getting the message:
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/extract/ExtractedFileSets
at de.flapdoodle.embed.process.store.ArtifactStore.removeFileSet(ArtifactStore.java:90)
at de.flapdoodle.embed.process.store.CachingArtifactStore$FilesWithCounter.forceDelete(CachingArtifactStore.java:176)
at de.flapdoodle.embed.process.store.CachingArtifactStore.removeAll(CachingArtifactStore.java:100)
at de.flapdoodle.embed.process.store.CachingArtifactStore$CacheCleaner.run(CachingArtifactStore.java:196)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: de.flapdoodle.embed.process.extract.ExtractedFileSets
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 5 more
Sat Feb 11 11:19:44 [initandlisten] connection accepted from 127.0.0.1:52080 #1 (1 connection now open)
[mongod output] Sat Feb 11 11:19:44 [conn1] terminating, shutdown command received
[mongod output] Sat Feb 11 11:19:44 dbexit: shutdown called
[mongod output] Sat Feb 11 11:19:44 [conn1] shutdown: going to close listening sockets...
[mongod output] Sat Feb 11 11:19:44 [conn1] closing listening socket: 384
[mongod output] Sat Feb 11 11:19:44 [conn1] shutdown: going to flush diaglog...
[mongod output] Sat Feb 11 11:19:44 [conn1] shutdown: going to close sockets...
[mongod output] Sat Feb 11 11:19:44 [conn1] shutdown: waiting for fs preallocator...
[mongod output] Sat Feb 11 11:19:44 [conn1] shutdown: closing all files...
[mongod output] Sat Feb 11 11:19:44 [conn1] closeAllFiles() finished
[mongod output] Sat Feb 11 11:19:44 [conn1] shutdown: removing fs lock...
[mongod output] Sat Feb 11 11:19:44 dbexit: really exiting now
[mongod output]
Exception in thread "Thread-3" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
at de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:119)
at de.flapdoodle.embed.mongo.MongodProcess.deleteTempFiles(MongodProcess.java:92)
at de.flapdoodle.embed.mongo.AbstractMongoProcess.cleanupInternal(AbstractMongoProcess.java:124)
at de.flapdoodle.embed.process.runtime.AbstractProcess.stop(AbstractProcess.java:172)
at de.flapdoodle.embed.process.runtime.AbstractProcess$JobKiller.run(AbstractProcess.java:243)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 6 more
Same here. is this resolved ?
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/extract/ExtractedFileSets
at de.flapdoodle.embed.process.store.ArtifactStore.removeFileSet(ArtifactStore.java:90)
at de.flapdoodle.embed.process.store.CachingArtifactStore$FilesWithCounter.forceDelete(CachingArtifactStore.java:176)
at de.flapdoodle.embed.process.store.CachingArtifactStore.removeAll(CachingArtifactStore.java:100)
at de.flapdoodle.embed.process.store.CachingArtifactStore$CacheCleaner.run(CachingArtifactStore.java:196)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: de.flapdoodle.embed.process.extract.ExtractedFileSets
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 5 more
Exception in thread "Thread-3" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
at de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:119)
at de.flapdoodle.embed.mongo.MongodProcess.deleteTempFiles(MongodProcess.java:92)
at de.flapdoodle.embed.mongo.AbstractMongoProcess.cleanupInternal(AbstractMongoProcess.java:124)
at de.flapdoodle.embed.process.runtime.AbstractProcess.stop(AbstractProcess.java:172)
at de.flapdoodle.embed.process.runtime.AbstractProcess$JobKiller.run(AbstractProcess.java:243)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 6 more
It seems that this is something to do with what parts of Maven are still available when this flapdoodle shutdown hook runs, and whether the plexus classloader has been partially destroyed.
Can everyone that comments here please include your exact Maven version?
Hello,
Apache Maven 3.3.9
Cheers.
Another plugin that appears to be having something like the same problem: https://github.com/eclipse/jetty.project/issues/537
Another example here: https://issues.jboss.org/browse/JBASMP-61?_sscc=t
And some further advice linked from that JBoss issue: http://maven.apache.org/plugin-developers/common-bugs.html#Using_Shutdown_Hooks
As of today (March 7 2018) a stacktrace similar to this issue is still happening even with version 0.3.4 of the plugin. I am building with Maven 3.3.9.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.571 s
[INFO] Finished at: 2018-03-07T13:36:27-06:00
[INFO] Final Memory: 77M/706M
[INFO] ------------------------------------------------------------------------
Exception in thread "Thread-7" Exception in thread "Thread-13" java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/extract/ExtractedFileSets
at de.flapdoodle.embed.process.store.ArtifactStore.removeFileSet(ArtifactStore.java:90)
at de.flapdoodle.embed.process.store.CachingArtifactStore$FilesWithCounter.forceDelete(CachingArtifactStore.java:176)
at de.flapdoodle.embed.process.store.CachingArtifactStore.removeAll(CachingArtifactStore.java:100)
at de.flapdoodle.embed.process.store.CachingArtifactStore$CacheCleaner.run(CachingArtifactStore.java:196)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: de.flapdoodle.embed.process.extract.ExtractedFileSets
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 5 more
java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/extract/ExtractedFileSets
at de.flapdoodle.embed.process.store.ArtifactStore.removeFileSet(ArtifactStore.java:90)
at de.flapdoodle.embed.process.store.CachingArtifactStore$FilesWithCounter.forceDelete(CachingArtifactStore.java:176)
at de.flapdoodle.embed.process.store.CachingArtifactStore.removeAll(CachingArtifactStore.java:100)
at de.flapdoodle.embed.process.store.CachingArtifactStore$CacheCleaner.run(CachingArtifactStore.java:196)
at java.lang.Thread.run(Thread.java:745)
I'm getting this now after compiling and installing de.flapdoodle.embed.mongo-2.0.4-SNAPSHOT from master
I'm using: Maven 3.3.9 Oracle JDK 1.8.0_74
It looks like the test executes correctly and then the error is thrown, which makes sense given this thread. Has there been any progress on this issue?
@jeremyrdavis Do you mean you also modified this plugin to use de.flapdoodle.embed.mongo-2.0.4-SNAPSHOT and used a locally installed snapshot of this plugin too?
@joelittlejohn I'm not sure where I got the 2.0.4-SNAPSHOT, sorry. I cloned and installed versions 0.3.0 through 0.3.6-SNAPSHOT and ran my integration test with each version. The test appears to run correctly, but it throws "java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils" from "de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:104)" in the shutdown hook.
I am also getting this issue
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:10 min (Wall Clock)
[INFO] Finished at: 2018-04-10T18:30:28-04:00
[INFO] Final Memory: 89M/1354M
[INFO] ------------------------------------------------------------------------
Exception in thread "Thread-7" java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/extract/ExtractedFileSets
at de.flapdoodle.embed.process.store.ArtifactStore.removeFileSet(ArtifactStore.java:90)
at de.flapdoodle.embed.process.store.CachingArtifactStore$FilesWithCounter.forceDelete(CachingArtifactStore.java:176)
at de.flapdoodle.embed.process.store.CachingArtifactStore.removeAll(CachingArtifactStore.java:100)
at de.flapdoodle.embed.process.store.CachingArtifactStore$CacheCleaner.run(CachingArtifactStore.java:196)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: de.flapdoodle.embed.process.extract.ExtractedFileSets
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 5 more
mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
<plugin>
<groupId>com.github.joelittlejohn.embedmongo</groupId>
<artifactId>embedmongo-maven-plugin</artifactId>
<version>0.3.5</version>
<executions>
<execution>
<id>start</id>
<goals>
<goal>start</goal>
</goals>
<phase>process-test-classes</phase>
<configuration>
<version>3.2.6</version>
</configuration>
</execution>
<execution>
<id>stop</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
I just upgraded my plugin version from 0.3.5 -> 0.4.0, and the 'ExtractedFileSets' exceptions stopped occurring at the end of my successful build... Hopefully this is for the long term!
This is still an issue with 0.4.0, de.flapdoodle.embed.mongo 2.1.1, Maven 3.5.3, OracleJDK 10.0.2
@marvec Strange, others are saying the problem is fixed with 0.4.0. I wonder if there is something else going on with your build. Maybe the versions are not as you expect and are being overridden somehow?
I see the same issue too. Maybe a maven caching thingy?
Sorry, I realise now that the change that was expected to fix this was not included in 0.4.0. This issue should (hopefully) be fixed if you use 0.4.1.
Sorry, I realise now that the change that was expected to fix this was not included in 0.4.0. This issue should (hopefully) be fixed if you use 0.4.1.
Works for me in version 0.4.1.
When running the command
With maven
It's all fine and i get the output bellow at the end of the script
But when running the same command with this maven version
Got this stranges java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
Any clue?