LogManager Exception in JBOSS AS 7.1 with java.util.Logger
Solution 1
I had the same problem with JBOSS EAP 6, it took me 2 days for find a solution !.
The cause is that your agent need to create a Logger at statup, he need to be able to access the logmanager classes before JBOSS Modules has been initialized. You need to add JBoss LogManager to the boot classloader. Then, there will be a conflict between LogManager available via ModuleClassLoader and classes loaded via system classloader.
The solution is to make Java Agent and JBoss Modules use the same classloader to load the LogManager classes.
For EAP 6, In your standalone.conf (or domain) (It must be close for your version)
add
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/org/jboss/logmanager/main/jboss-logmanager-1.3.1.jar"
and for make Java Agent and JBoss Modules use the same classloader
modify this piece of code in adding org.jboss.logmanager like this :
if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then
JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,org.jboss.logmanager"
fi
Hope this will help.
Solution 2
I found the solution after searching for couple of days in the below link. https://github.com/jbossas/jboss-as-maven-plugin/issues/40#issuecomment-14943429
I have to tweak a little bit to get is work in Windows 7.
- Open Eclipse.
- Add Jboss 7.1 Runtime 1 server.
- Select the Server and press F3.
- Click on Open Launch Config.
- Goto VM arguments.
- Add the below two entries.
"-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager" "-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
Now select the Classpath TAB
- Select User Entries
- Click Add External Jars
- Select the three jar files
a) jboss-logmanager-1.2.0.GA.jar b) jboss-logmanager-log4j-1.0.0.GA.jar c) log4j-1.2.16.jar
Paths
- C:/jboss-as-7.1.1.Final/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.0.GA.jar"
- C:/jboss-as-7.1.1.Final/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar"
- C:/jboss-as-7.1.1.Final/modules/org/apache/log4j/main/log4j-1.2.16.jar"
This will start the standalone jboss without any issues.
Anish Antony
Updated on September 10, 2020Comments
-
Anish Antony almost 4 years
I created a java application and initialize a java.util.Logger with that application and run that application as
-javaagent
with jboss AS 7 server and i gotIllegalStateException
(i am using eclipse IDE).Here follows my logger initialization codestatic public void setup() throws IOException { // Get the global logger to configure it Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); logger.setLevel(Level.INFO); fileTxt = new FileHandler("C:/Users/abc/Desktop/ATAGENT/Logging.txt"); fileHTML = new FileHandler("C:/Users/abc/Desktop/ATAGENT/Logging.html"); // create txt Formatter formatterTxt = new SimpleFormatter(); fileTxt.setFormatter(formatterTxt); logger.addHandler(fileTxt); // create HTML Formatter formatterHTML = new BMITHtmlFormatter(); fileHTML.setFormatter(formatterHTML); logger.addHandler(fileHTML); }
When i create
-javaagent
jar appended with above lines of code and run with jboss as7 server i got following exceptionWARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager Exception in thread "main" java.lang.ExceptionInInitializerError at org.jboss.as.server.Main.main(Main.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.modules.Module.run(Module.java:260) at org.jboss.modules.Main.main(Main.java:291) Caused by: java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager") at org.jboss.logmanager.Logger.getLogger(Logger.java:60) at org.jboss.logmanager.log4j.BridgeRepositorySelector.(BridgeRepositorySelector.java:42) ... 7 more
And i serched in fourms and i got a solution which is Open the launch configuration for the server definition. and add
-logmodule org.jboss.logmanager
to the program arguments beforeorg.jboss.as.standalone
. But it results the same exception with some additional warning. Here follows the exceptionWARNING: -logmodule is deprecated. Please use the system property 'java.util.logging.manager' or the 'java.util.logging.LogManager' service loader. WARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager Exception in thread "main" java.lang.ExceptionInInitializerError at org.jboss.as.server.Main.main(Main.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.modules.Module.run(Module.java:260) at org.jboss.modules.Main.main(Main.java:291) Caused by: java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager") at org.jboss.logmanager.Logger.getLogger(Logger.java:60) at org.jboss.logmanager.log4j.BridgeRepositorySelector.(BridgeRepositorySelector.java:42) ... 7 more