Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow control of cleanup timing #36

Closed
benson-basis opened this issue Jan 18, 2016 · 2 comments
Closed

Allow control of cleanup timing #36

benson-basis opened this issue Jan 18, 2016 · 2 comments

Comments

@benson-basis
Copy link

This library sets shutdown hooks. This can lead to some very strange class loading problems in Maven 3.2.x and above, as shown below. As best I can work out, the only fix here is to expose an API to allow a maven plugin that is calling this library (or a library that calls this library, like the mongo embedded) to explicitly shut things down when it's done.

Exception in thread "Thread-6" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
    at de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:104)
    at de.flapdoodle.embed.process.runtime.AbstractProcess.stop(AbstractProcess.java:168)
    at de.flapdoodle.embed.process.runtime.Executable.stop(Executable.java:71)
    at de.flapdoodle.embed.process.runtime.Executable$JobKiller.run(Executable.java:88)
    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)
@grossws
Copy link
Contributor

grossws commented May 18, 2018

Version 2.0.3 has similar issue:

Exception in thread "Thread-2" java.lang.NoClassDefFoundError: de/flapdoodle/embed/process/io/file/Files$DeleteDirVisitor
        at de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:147)
        at de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:117)
        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:179)
        at de.flapdoodle.embed.process.runtime.Executable.stop(Executable.java:80)
        at de.flapdoodle.embed.process.runtime.Executable$JobKiller.run(Executable.java:97)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: de.flapdoodle.embed.process.io.file.Files$DeleteDirVisitor
        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)
        ... 8 more

grossws added a commit to grossws/de.flapdoodle.embed.process that referenced this issue May 18, 2018
Moved DeleteDirVisitor instance to Files, so it's loaded before
shutdown hook starts and avoids NoClassDefFoundError.

Fixes flapdoodle-oss#36
grossws added a commit to grossws/de.flapdoodle.embed.process that referenced this issue May 21, 2018
Moved DeleteDirVisitor instance to Files, so it's loaded before
shutdown hook starts and avoids NoClassDefFoundError.

Fixes flapdoodle-oss#36
Loki-Afro pushed a commit that referenced this issue May 21, 2018
Moved DeleteDirVisitor instance to Files, so it's loaded before
shutdown hook starts and avoids NoClassDefFoundError.

Fixes #36
@ispringer
Copy link

Any chance you can do a release that includes this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants