Arquillian wildfly8.2 embedded : JBAS014670: Failed initializing module org.jboss.as.logging

江枫思渺然 提交于 2020-01-02 13:40:23

问题


I'm trying to set up a project that uses arquillian to do some kind of integration testing. I already went through some tutorials but can't get my test running. The exception I get is:

Cannot not load JBoss LogManager. The LogManager has likely been accessed prior to this initialization.
Jul 14, 2015 10:30:37 AM org.jboss.msc.service.ServiceContainerImpl <clinit>
INFO: JBoss MSC version 1.2.2.Final
Jul 14, 2015 10:30:37 AM org.jboss.as.server.ApplicationServerService start
INFO: JBAS015899: WildFly 8.2.0.Final "Tweek" starting
Jul 14, 2015 10:30:38 AM org.jboss.as.controller.AbstractOperationContext executeStep
ERROR: JBAS014612: Operation ("parallel-extension-add") failed - address: ([])
java.lang.RuntimeException: JBAS014670: Failed initializing module org.jboss.as.logging
    at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:111)
    at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:660)
    at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:501)
    at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:298)
    at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:293)
    at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:324)
    at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:297)
    at org.jboss.as.server.ServerService.boot(ServerService.java:356)
    at org.jboss.as.server.ServerService.boot(ServerService.java:331)
    at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:259)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: JBAS011592: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:103)
    ... 10 more
Caused by: java.lang.IllegalStateException: JBAS011592: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
    at org.jboss.as.logging.LoggingExtension.initialize(LoggingExtension.java:122)
    at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:98)
    at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:139)
    at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:125)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

Jul 14, 2015 10:30:38 AM org.jboss.as.server.ServerService boot
FATAL: JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.

my pom.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<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>org.jboss.arquillian.examples</groupId>
    <artifactId>arquillian-tutorial</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>arquillian-tutorial</name>
    <url>http://arquillian.org/guides/getting_started/</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.1.8.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>arquillian-wildfy82-embedded</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <version>8.2.0.Final</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>target</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.18.1</version>
                        <configuration>
                            <!--forkMode>once</forkMode-->
                            <forkCount>1</forkCount>
                            <systemPropertyVariables>
                                <jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home>
                                <module.path>${project.basedir}/target/wildfly-8.2.0.Final/modules</module.path>
                                <arquillian.launch>arquillian-wildfly-embedded</arquillian.launch>
                            </systemPropertyVariables>
                            <redirectTestOutputToFile>false</redirectTestOutputToFile>
                            <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djboss.socket.binding.port-offset=100</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-arquillian-container-embedded</artifactId>
                    <version>8.2.0.Final</version>
                </dependency>
                <dependency>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-embedded</artifactId>
                    <version>8.2.0.Final</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>

and this is my arquillian.xml:

<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.org/schema/arquillian"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

    <container qualifier="wildfly-embedded" default="true">
        <configuration>
            <property name="jbossHome">target/wildfly-8.2.0.Final</property>
            <property name="modulePath">target/wildfly-8.2.0.Final/modules</property>
        </configuration>
    </container>

</arquillian>

回答1:


For some reason, the maven to eclipse settings are not completely working: in eclipse: go to JVM settings of the unit test(s) you want to run,

Right click on unit test file -->Run As -->Run Configuration -->JUnit -->Arguments

and add the below line in VM arguments section

-Djava.util.logging.manager=org.jboss.logmanager.LogManager




回答2:


Adding this snippet in pom.xml solved the issue.

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
    <systemProperties>
        <property>
            <name>java.util.logging.manager</name>
            <value>org.jboss.logmanager.LogManager</value>
        </property>
    </systemProperties>
</configuration>




回答3:


In my case it helped to disable a java agent as mentioned in https://issues.jboss.org/browse/WFLY-3152:

There is nothing we can really do about this. As Rob said this is generally caused by a javaagent that uses java.util.logging before the server has started. It can also be caused by running the server in embedded mode and having code that uses java.util.logging before the server starts.

Ie. removal of java property: JAVA_OPTS="$JAVA_OPTS -agentpath:...




回答4:


In addition to the answer of Abhishek: For integration tests you must add this snippet too:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <configuration>
    <systemProperties>
      <property>
        <name>java.util.logging.manager</name>
        <value>org.jboss.logmanager.LogManager</value>
      </property>
    </systemProperties>
  </configuration>
</plugin>


来源:https://stackoverflow.com/questions/31401924/arquillian-wildfly8-2-embedded-jbas014670-failed-initializing-module-org-jbos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!