WildFly 10.0 - 部署在pom中定义的类的NoClassDefFoundError

时间:2016-06-21 22:53:33

标签: deployment wildfly

WildFly的新手 WildFly 10.0 JDK 1.8 赢8 Eclipse Luna

我将Glassfish 4.0应用转换为WildFly 10并遇到各种各样的问题。我终于放弃了尝试将其配置为使用log4j。现在,我遇到了部署问题,其中WildFly类加载器似乎忽略了我在我的pom中列出的jar。

堆栈跟踪

17:44:09,626 WARN  [org.jboss.modules] (Weld Thread Pool -- 3) Failed to define class com.meritagesystems.codecompliance.common.MultiLineToStringStyle in Module "deployment.CodeComplianceServices.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/meritagesystems/codecompliance/common/MultiLineToStringStyle (Module "deployment.CodeComplianceServices.war:main" from Service Module Loader): org/apache/commons/lang3/builder/ToStringStyle
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
  at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
  at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
  at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
  at org.jboss.modules.Module.loadModuleClass(Module.java:605)
  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
  at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68)
  at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadClass(AnnotatedTypeLoader.java:65)
  at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadAnnotatedType(AnnotatedTypeLoader.java:60)
  at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:96)
  at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97)
  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:65)
  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62)
  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  at org.jboss.threads.JBossThread.run(JBossThread.java:320)

的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.meritagesystems.codecompliance.rws</groupId>
    <artifactId>CodeComplianceServices</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>CodeComplianceServices</name>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- BEGIN Careful not to break this version dependency -->
        <powermock.version>1.6.4</powermock.version>
        <mockito.version>1.10.19</mockito.version>
        <!-- END Careful not to break this version dependency -->
        <jackson.version>2.7.4</jackson.version>
        <hibernate.version>4.3.11.Final</hibernate.version>
        <jboss.bom.version>1.0.0.Final</jboss.bom.version>
        <wildfly.version>10.0.0.Final</wildfly.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.bom</groupId>
                <artifactId>wildfly-javaee7</artifactId>
                <scope>import</scope>
                <type>pom</type>
                <version>${wildfly.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jboss.bom</groupId>
                <artifactId>jboss-javaee-6.0-with-tools</artifactId>
                <version> ${jboss.bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.bom</groupId>
                <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
                <version> ${jboss.bom.version} </version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
            <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.2.3.Final</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
                <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.38</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <!--
                    The Maven Surefire plugin tests your application.
                    Here we ensure we are using a version compatible with 
                    Arquillian
                -->
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
            </plugin>
            <!-- The WildFly Maven Plugin deploys your war to a local WildFly container -->
            <!-- To use, set the JBOSS_HOME environment variable and run:
                mvn package wildfly:deploy -->
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>1.0.2.Final</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <archive>
                        <manifestEntries>
                            <Dependencies>org.apache.commons.lang3</Dependencies>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>  
    <repositories>
        <repository>
            <id>my-repo1</id>
            <name>my custom repo</name>
            <url>http://mvnrepository.com/</url>
        </repository>
    </repositories>
</project>

有什么想法吗?

0 个答案:

没有答案