2

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>
Vandeperre Maarten
  • 556
  • 1
  • 8
  • 21
  • Could you try removing the `once` and replace it with `1`? – James R. Perkins Jul 14 '15 at 17:39
  • That doesn't change it. In maven I can run it, in eclipse I still get that error. I updated my pom.xml, will do the same changes in the one over here (i.e. adjusting the forkmode and changing a dependency) – Vandeperre Maarten Jul 15 '15 at 06:28
  • This normally comes because java.util.logging.manager is not set to the expected manager, tho you are doing that in the argLine. Try setting it as a systemProeprtyVariables instead; https://github.com/wildfly/wildfly-arquillian/blob/master/container-embedded/pom.xml#L108 – Aslak Knutsen Jul 15 '15 at 21:44

4 Answers4

6

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

rajeev pani..
  • 5,387
  • 5
  • 27
  • 35
Vandeperre Maarten
  • 556
  • 1
  • 8
  • 21
6

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>
</plugin>
shawn1874
  • 1,288
  • 1
  • 10
  • 26
Abhishek Basak
  • 101
  • 1
  • 3
  • Thank you. This actually explains why Wildfly won't start with a `-javaagent ` configured, especifically [jmx_exporter](https://github.com/prometheus/jmx_exporter). – JulioHM Dec 09 '19 at 19:23
  • I'm not sure why but the final tag wasn't visible to me which caused an error when I copy and pasted. I edited the post a bit so that it shows up, but the community needs to approve before it shows for others. Just be aware if you are trying to copy and paste this answer. – shawn1874 Aug 09 '20 at 00:48
2

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>
Jaap Reitsma
  • 171
  • 2
  • 7
0

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:...

Felix
  • 3,999
  • 3
  • 42
  • 66