jbossas / jboss-as-maven-plugin

Maven plugin to deploy applications to JBoss AS 7 (moved to https://github.com/wildfly/wildfly-maven-plugin)
74 stars 69 forks source link

Cannot use jboss-as:run with Jboss as 7.0.2.Final #40

Closed andirdju closed 11 years ago

andirdju commented 11 years ago

plugin version : 7.4.Final, works fine with Jboss 7.1.1.Final.

I can start jboss 7.0.2 manually and deploy manually without problem.

But when trying to start and deploy from mvn by running:

mvn jboss-as:run

I got these exceptions on jboss 7.0.2.Final:

  [INFO] <<< jboss-as-maven-plugin:7.4.Final:run (default-cli) @ service <<<
  [INFO]
  [INFO] --- jboss-as-maven-plugin:7.4.Final:run (default-cli) @ service ---
  [INFO] JAVA_HOME=c:\Program Files\Java\jdk1.6.0_35\jre
  [INFO] JBOSS_HOME=D:\Downloads\jboss-as-web-7.0.2.Final

  [INFO] Server is starting up. Press CTRL + C to stop the server.
  Mar 14, 2013 6:48:30 PM org.xnio.Xnio <clinit>
  INFO: XNIO Version 3.0.7.GA
  Mar 14, 2013 6:48:30 PM org.xnio.nio.NioXnio <clinit>
  INFO: XNIO NIO Implementation Version 3.0.7.GA
  Mar 14, 2013 6:48:30 PM org.jboss.remoting3.EndpointImpl <clinit>
  INFO: JBoss Remoting version 3.2.12.GA
  Exception in thread "main" java.lang.ExceptionInInitializerError
          at org.jboss.as.server.Main.main(Main.java:85)
          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:272)
          at org.jboss.modules.Main.main(Main.java:313)
  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.<clinit>(BridgeRepositorySelector.java:42)
          ... 7 more
jamezp commented 11 years ago

I'll have to think about whether we want to support older versions or not. JBoss Modules used to require the log manager be passed via the command line but switched to using a service loader approach.

andirdju commented 11 years ago

Is there a workaround to this? such as by specifying jvmArgs in the plugin configuration or when calling mvn?

andirdju commented 11 years ago

Hi @jamezp,

Thanks to your comment I manage to make it work by specifying it in the jvmArgs:

basic/default jvm-args on 7.0.2.Final:

-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true 
-Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 
-Dsun.rmi.dgc.server.gcInterval=3600000 
-Djboss.modules.system.pkgs=org.jboss.byteman

additional workaround jvm-args, I found these from bunch of forums and jboss issue tracker about log manager problem:

-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager 
-Djava.util.logging.manager=org.jboss.logmanager.LogManager 
-Xbootclasspath/p:${downloadedJbossDir}/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.0.GA.jar 
-Xbootclasspath/p:${downloadedJbossDir}/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar 
-Xbootclasspath/p:${downloadedJbossDir}/modules/org/apache/log4j/main/log4j-1.2.16.jar

Put the whole jvm-args to plugin jvmArg config:

<plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <version>7.0.2.Final</version>
    <configuration>
        <version>7.0.2.Final</version>
        <jvmArgs>${the-whole-jvm-args}</jvmArgs>
    </configuration>
</plugin>

Suggestions:

jamezp commented 11 years ago

Thanks for testing that! I've added a JIRA to fix the FAQ https://issues.jboss.org/browse/JBASMP-39

andirdju commented 11 years ago

I'd like to contribute to adding the faq. Should I just create a pull request?

Question: