使用flapdoodle mongo

时间:2016-12-13 13:17:31

标签: java mongodb maven

我有一些使用maven运行的测试,我使用的是嵌入式tomcat和Mongo,但是当我运行它时,我得到了这个NoClassDefFoundError。 我需要帮助解决这个错误,任何想法?

Exception in thread "Thread-4" 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:259)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    ... 5 more

依赖性:

        <dependency>
        <groupId> de.flapdoodle.embed</groupId>
        <artifactId>de.flapdoodle.embed.mongo</artifactId>
        <version>1.50.2</version>
        <scope>test</scope>
    </dependency>

插件(POM的其余部分只是依赖项):

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
    </plugins>
</build>
<profiles>
    <profile>
        <id>acceptance-tests</id>
        <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>com.github.joelittlejohn.embedmongo</groupId>
                        <artifactId>embedmongo-maven-plugin</artifactId>
                        <version>0.3.4</version>
                        <executions>
                            <execution>
                                <id>start</id>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                                <configuration>
                                    <port>27017</port>
                                    <version>2.6.0</version>
                                    <databaseDirectory>${project.build.directory}/mongo</databaseDirectory>
                                    <logging>file</logging>
                                    <logFile>${project.build.directory}/mongo/myfile.log</logFile>
                                    <logFileEncoding>utf-8</logFileEncoding>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop</id>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.2</version>
                        <configuration>
                            <url>http://localhost:8080/</url>
                            <server>localhost</server>
                            <path>/</path>
                            <username>tomcat</username>
                            <password>tomcat</password>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-tomcat</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>run-war-only</goal>
                                </goals>
                                <configuration>
                                    <scanIntervalSeconds>0</scanIntervalSeconds>
                                    <fork> true </fork>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop-tomcat</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>shutdown</goal>
                                </goals>
                                <configuration>
                                    <scanIntervalSeconds>0</scanIntervalSeconds>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.18</version>
                        <configuration>
                            <!-- <argLine>-Xmx512m -XX:MaxPermSize=512m -Dtarget.server=${test.target.server} 
                                ${failsafeArgLine}</argLine> -->
                            <includes>
                                <include>*Test.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.17</version>
                        <configuration>
                            <!-- <argLine>-XX:PermSize=512m -Xmx512m -XX:MaxPermSize=1024m</argLine> -->
                            <!-- skips surefire tests without skipping failsafe tests. Property 
                                value seems to magically default to false -->
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>

                </plugins>
            </pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>com.github.joelittlejohn.embedmongo</groupId>
                    <artifactId>embedmongo-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>

mvn依赖:tree:

+- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] |  +- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.6.6:compile
[INFO] +- org.quartz-scheduler:quartz-jobs:jar:2.2.1:compile
[INFO] +- org.mongodb:mongodb-driver:jar:3.3.0:compile
[INFO] |  +- org.mongodb:bson:jar:3.3.0:compile
[INFO] |  \- org.mongodb:mongodb-driver-core:jar:3.3.0:compile
[INFO] +- com.atlassian.jira:jira-api:jar:7.1.9:compile
[INFO] |  +- com.atlassian.annotations:atlassian-annotations:jar:0.16:compile
[INFO] |  +- com.atlassian.ofbiz:entityengine-share:jar:1.2.3:compile
[INFO] |  +- com.atlassian.ofbiz:entityengine:jar:1.2.3:compile
[INFO] |  +- com.atlassian.collectors:atlassian-collectors-util:jar:0.10:compile
[INFO] |  +- opensymphony:webwork:jar:1.4-atlassian-30:compile
[INFO] |  |  \- com.atlassian.html:atlassian-html-encoder:jar:1.4:compile
[INFO] |  +- webwork:pell-multipart-request:jar:1.31.0:compile
[INFO] |  +- com.atlassian.core:atlassian-core:jar:5.0.6:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.1:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.4:compile
[INFO] |  |  |  +- jaxen:jaxen:jar:1.0-FCS:compile
[INFO] |  |  |  +- saxpath:saxpath:jar:1.0-FCS:compile
[INFO] |  |  |  +- msv:msv:jar:20020414:compile
[INFO] |  |  |  +- relaxngDatatype:relaxngDatatype:jar:20020414:compile
[INFO] |  |  |  \- isorelax:isorelax:jar:20020414:compile
[INFO] |  |  \- com.atlassian.image:atlassian-image-consumer:jar:1.0.1:compile
[INFO] |  +- com.atlassian.core:atlassian-core-user:jar:5.0.6:compile
[INFO] |  +- com.atlassian.core:atlassian-core-thumbnail:jar:5.0.6:compile
[INFO] |  |  +- com.twelvemonkeys.imageio:imageio-jpeg:jar:3.2:compile
[INFO] |  |  |  +- com.twelvemonkeys.imageio:imageio-core:jar:3.2:compile
[INFO] |  |  |  +- com.twelvemonkeys.imageio:imageio-metadata:jar:3.2:compile
[INFO] |  |  |  +- com.twelvemonkeys.common:common-lang:jar:3.2:compile
[INFO] |  |  |  +- com.twelvemonkeys.common:common-io:jar:3.2:compile
[INFO] |  |  |  \- com.twelvemonkeys.common:common-image:jar:3.2:compile
[INFO] |  |  \- com.twelvemonkeys.imageio:imageio-tiff:jar:3.2:compile
[INFO] |  +- com.atlassian.extras:atlassian-extras:jar:3.1.2:compile
[INFO] |  |  \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  +- com.atlassian.velocity:atlassian-velocity:jar:1.3:compile
[INFO] |  |  +- opensymphony:oscore:jar:2.2.7:compile
[INFO] |  |  \- org.apache.velocity:velocity:jar:1.6.4:compile
[INFO] |  +- osworkflow:osworkflow:jar:2.8.1:compile
[INFO] |  +- opensymphony:propertyset:jar:1.5:compile
[INFO] |  +- com.atlassian.cache:atlassian-cache-api:jar:2.11.1:compile
[INFO] |  |  \- com.atlassian.instrumentation:atlassian-instrumentation-core:jar:2.2.1:compile
[INFO] |  +- com.atlassian.beehive:beehive-api:jar:0.2:compile
[INFO] |  +- com.atlassian.tenancy:atlassian-tenancy-api:jar:1.4.0:compile
[INFO] |  +- com.atlassian.crowd:embedded-crowd-api:jar:2.8.3:compile
[INFO] |  +- com.google.guava:guava:jar:18.0:compile
[INFO] |  +- com.atlassian.fugue:fugue:jar:2.6.0:compile
[INFO] |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.1:compile
[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.1:compile
[INFO] |  +- javax.mail:javax.mail-api:jar:1.5.4:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  +- com.sun.mail:javax.mail:jar:1.5.4:compile
[INFO] |  +- com.atlassian.mail:atlassian-mail:jar:2.5.16:compile
[INFO] |  |  +- commons-beanutils:commons-beanutils:jar:1.6.1:compile
[INFO] |  |  +- commons-digester:commons-digester:jar:1.4.1:compile
[INFO] |  |  +- org.jsoup:jsoup:jar:1.8.3:compile
[INFO] |  |  \- com.atlassian:atlassian-localhost:jar:1.1.0:compile
[INFO] |  +- oro:oro:jar:2.0.7:compile
[INFO] |  +- com.atlassian.threadlocal:atlassian-threadlocal:jar:1.3:compile
[INFO] |  +- com.atlassian.applinks:applinks-api:jar:5.0.7:compile
[INFO] |  +- com.atlassian.velocity.htmlsafe:velocity-htmlsafe:jar:1.4:compile
[INFO] |  |  \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] |  +- com.atlassian.plugins:atlassian-plugins-api:jar:4.1.0-m002:compile
[INFO] |  +- com.atlassian.plugins:atlassian-plugins-webfragment:jar:4.1.0:compile
[INFO] |  +- com.atlassian.plugins:atlassian-plugins-webfragment-api:jar:4.1.0:compile
[INFO] |  +- com.atlassian.ozymandias:atlassian-plugin-point-safety:jar:0.10:compile
[INFO] |  +- jfree:jfreechart:jar:1.0.13:compile
[INFO] |  +- com.atlassian.plugins:atlassian-plugins-webresource:jar:3.5.9:compile
[INFO] |  |  +- com.atlassian.plugins:atlassian-plugins-webresource-api:jar:3.5.9:compile
[INFO] |  |  +- org.tuckey:urlrewritefilter:jar:4.0.4:compile
[INFO] |  |  \- com.atlassian.sourcemap:sourcemap:jar:1.7.5:compile
[INFO] |  |     \- com.google.code.gson:gson:jar:2.2.3:compile
[INFO] |  +- jfree:jcommon:jar:1.0.8:compile
[INFO] |  +- com.atlassian.sal:sal-api:jar:3.0.3:compile
[INFO] |  +- com.atlassian.gadgets:atlassian-gadgets-api:jar:4.2.0:compile
[INFO] |  +- com.atlassian.johnson:atlassian-johnson-core:jar:3.0.0:compile
[INFO] |  |  \- com.atlassian.plugins:atlassian-plugins-servlet:jar:3.2.8:compile
[INFO] |  +- joda-time:joda-time:jar:2.8.2:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] |  +- commons-io:commons-io:jar:2.1:compile
[INFO] |  +- commons-httpclient:commons-httpclient:jar:3.1-atlassian-2:compile
[INFO] |  +- log4j:log4j:jar:1.2.16:compile
[INFO] |  +- com.atlassian.profiling:atlassian-profiling:jar:1.9:compile
[INFO] |  +- com.atlassian.scheduler:atlassian-scheduler-api:jar:1.7.0:compile
[INFO] |  +- com.atlassian.analytics:analytics-api:jar:5.0.10:compile
[INFO] |  +- javax.servlet:javax.servlet-api:jar:3.0.1:compile
[INFO] |  +- com.atlassian.application:atlassian-application-api:jar:1.2:compile
[INFO] |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- com.atlassian.jira:jira-rest-java-client-api:jar:4.0.0:compile
[INFO] |  +- com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.2:compile
[INFO] |  \- com.atlassian.httpclient:atlassian-httpclient-api:jar:0.23.0:compile
[INFO] +- com.atlassian.jira:jira-rest-java-client-core:jar:4.0.0:compile
[INFO] |  +- com.sun.jersey:jersey-client:jar:1.5:compile
[INFO] |  |  \- com.sun.jersey:jersey-core:jar:1.5:compile
[INFO] |  +- com.sun.jersey:jersey-json:jar:1.5:compile
[INFO] |  |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3:compile
[INFO] |  |  |  \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] |  |  |     \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.5.5:compile
[INFO] |  |  \- org.codehaus.jackson:jackson-xc:jar:1.5.5:compile
[INFO] |  +- com.atlassian.event:atlassian-event:jar:2.3.5:compile
[INFO] |  +- org.springframework:spring-beans:jar:2.5.6:compile
[INFO] |  |  \- org.springframework:spring-core:jar:2.5.6:compile
[INFO] |  +- com.atlassian.httpclient:atlassian-httpclient-plugin:jar:0.23.0:compile
[INFO] |  |  +- org.apache.httpcomponents:httpasyncclient-cache:jar:4.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpclient-cache:jar:4.4.1:compile
[INFO] |  |  \- org.apache.httpcomponents:httpasyncclient:jar:4.1:compile
[INFO] |  |     \- org.apache.httpcomponents:httpcore-nio:jar:4.4.1:compile
[INFO] |  \- org.apache.httpcomponents:httpmime:jar:4.1.2:compile
[INFO] +- org.json:json:jar:20151123:compile
[INFO] +- javax.json:javax.json-api:jar:1.0:compile
[INFO] +- org.glassfish:javax.json:jar:1.0.4:runtime
[INFO] +- javax:javaee-web-api:jar:6.0:provided
[INFO] +- xerces:xercesImpl:jar:2.11.0:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- jta:jta:jar:1.0.1:compile
[INFO] +- info.cukes:cucumber-java:jar:1.2.4:test
[INFO] |  \- info.cukes:cucumber-core:jar:1.2.4:test
[INFO] |     +- info.cukes:cucumber-html:jar:0.2.3:test
[INFO] |     +- info.cukes:cucumber-jvm-deps:jar:1.0.5:test
[INFO] |     \- info.cukes:gherkin:jar:2.12.2:test
[INFO] +- info.cukes:cucumber-junit:jar:1.2.4:test
[INFO] +- junit:junit:jar:4.11:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- com.jayway.restassured:rest-assured:jar:2.9.0:compile
[INFO] |  +- org.codehaus.groovy:groovy:jar:2.4.4:compile
[INFO] |  +- org.codehaus.groovy:groovy-xml:jar:2.4.4:compile
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] |  +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:compile
[INFO] |  +- com.jayway.restassured:json-path:jar:2.9.0:compile
[INFO] |  |  +- org.codehaus.groovy:groovy-json:jar:2.4.4:compile
[INFO] |  |  \- com.jayway.restassured:rest-assured-common:jar:2.9.0:compile
[INFO] |  \- com.jayway.restassured:xml-path:jar:2.9.0:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0-m01:compile
[INFO] +- org.skyscreamer:jsonassert:jar:1.3.0:test
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.9:compile
[INFO] \- de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.50.2:test
[INFO]    \- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.50.1:test
[INFO]       +- net.java.dev.jna:jna:jar:4.0.0:test
[INFO]       +- net.java.dev.jna:jna-platform:jar:4.0.0:test
[INFO]       \- org.apache.commons:commons-compress:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

0 个答案:

没有答案