[jboss-jira] [JBoss JIRA] (WFCORE-1580) the "cli" Maven module: should the JBoss LogManager dependency be optional?

Jean-Francois Denise (JIRA) issues at jboss.org
Wed Jan 11 07:47:01 EST 2017


     [ https://issues.jboss.org/browse/WFCORE-1580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Francois Denise reassigned WFCORE-1580:
--------------------------------------------

    Assignee: Jean-Francois Denise  (was: Alexey Loubyansky)


> the "cli" Maven module: should the JBoss LogManager dependency be optional?
> ---------------------------------------------------------------------------
>
>                 Key: WFCORE-1580
>                 URL: https://issues.jboss.org/browse/WFCORE-1580
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: CLI
>    Affects Versions: 2.1.0.Final
>            Reporter: Ladislav Thon
>            Assignee: Jean-Francois Denise
>
> Say I have a very simple Java program using the WildFly CLI scripting facilities:
> {code:java}
>     public static void main(String[] args) throws Exception {
>         CLI cli = CLI.newInstance();
>         cli.connect();
>         System.out.println(cli.cmd(":whoami").getResponse());
>         cli.disconnect();
>     }
> {code}
> This is in a small Maven project that has a single dependency:
> {code:xml}
>         <dependency>
>             <groupId>org.wildfly.core</groupId>
>             <artifactId>wildfly-cli</artifactId>
>             <version>2.1.0.Final</version>
>         </dependency>
> {code}
> When trying to run the program (no matter if there's a running WildFly server or not), I get the following exception:
> {code}
> Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logmanager/LogContextSelector
> 	at org.jboss.as.cli.embedded.EmbeddedControllerHandlerRegistrar.registerEmbeddedCommands(EmbeddedControllerHandlerRegistrar.java:89)
> 	at org.jboss.as.cli.impl.CommandContextImpl.initCommands(CommandContextImpl.java:581)
> 	at org.jboss.as.cli.impl.CommandContextImpl.<init>(CommandContextImpl.java:302)
> 	at org.jboss.as.cli.impl.CommandContextFactoryImpl.newCommandContext(CommandContextFactoryImpl.java:44)
> 	at org.jboss.as.cli.scriptsupport.CLI.connect(CLI.java:80)
> 	at cz.ladicek.foobar.Main.main(Main.java:8)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> Caused by: java.lang.ClassNotFoundException: org.jboss.logmanager.LogContextSelector
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> 	... 11 more
> {code}
> This is because {{CommandContextImpl}}'s constructor calls {{EmbedServerHandler.create}} and for the {{EmbedServerHandler}} class to load, there has to be JBoss LogManager present on the classpath.
> The {{wildfly-cli}} Maven module already has a dependency on JBoss LogManager, except that...
> {code:xml}
>         <dependency>
>             <groupId>org.jboss.logmanager</groupId>
>             <artifactId>jboss-logmanager</artifactId>
>             <optional>true</optional>
>         </dependency>
> {code}
> It's optional. I guess this made sense in WildFly Core 1.x which didn't have server embedding, but in WildFly Core 2.x, I wonder if the dependency should be mandatory.
> Thoughts?



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list