Close handler throws exception when closing CLI connection on JBoss 7.2
fsy Jul 18, 2013 9:03 AMHi,
we recently upgraded from JBoss 7.1.3 to 7.2. Since we upgraded one of our applications, that uses the java CLI public API, throws NullPointerExceptions every time a connection is terminated through the CLI API.
The following is our code to set up and close the connection to the JBoss CLI:
private CommandContext ctx; private ModelControllerClient client; public JBossCLITool() { try { ctx = CommandContextFactory.getInstance().newCommandContext(); } catch(CliInitializationException e) { throw new IllegalStateException("Failed to initialize CLI context", e); } } public void establishConnection() { try { ctx.connectController("localhost", 9999); client = ctx.getModelControllerClient(); } catch (CommandLineException e) { LOG.debug(e.toString()); } } public void terminateConnection() { try { if (!ctx.isTerminated()){ ctx.terminateSession(); } } catch (Exception e) { LOG.debug(e.toString()); } }
when calling ctx.terminateSession() the following Exception is thrown:
13:46:58,691 ERROR [org.jboss.remoting.handler-errors] (Remoting "cli-client" read-1) Close handler threw an exception: java.lang.NullPointerException at org.jboss.as.cli.impl.CommandContextImpl.handleClose(CommandContextImpl.java:1206) [org-jboss-as-jboss-as-cli-7.2.0.Final.jar:7.2.0.Final] at org.jboss.as.cli.impl.CLIModelControllerClient$4.handleClose(CLIModelControllerClient.java:156) [org-jboss-as-jboss-as-cli-7.2.0.Final.jar:7.2.0.Final] at org.jboss.as.cli.impl.CLIModelControllerClient$4.handleClose(CLIModelControllerClient.java:153) [org-jboss-as-jboss-as-cli-7.2.0.Final.jar:7.2.0.Final] at org.jboss.remoting3.spi.SpiUtils.safeHandleClose(SpiUtils.java:54) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.spi.AbstractHandleableCloseable$CloseHandlerTask.run(AbstractHandleableCloseable.java:501) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.spi.AbstractHandleableCloseable.runCloseTask(AbstractHandleableCloseable.java:406) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeComplete(AbstractHandleableCloseable.java:277) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.ConnectionImpl.access$000(ConnectionImpl.java:38) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.ConnectionImpl$1.handleClose(ConnectionImpl.java:55) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.ConnectionImpl$1.handleClose(ConnectionImpl.java:53) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.spi.SpiUtils.safeHandleClose(SpiUtils.java:54) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.spi.AbstractHandleableCloseable$CloseHandlerTask.run(AbstractHandleableCloseable.java:501) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.spi.AbstractHandleableCloseable.runCloseTask(AbstractHandleableCloseable.java:406) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeComplete(AbstractHandleableCloseable.java:277) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.remote.RemoteConnectionHandler.handleConnectionClose(RemoteConnectionHandler.java:117) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:78) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:45) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA] at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.ssl.JsseConnectedSslStreamChannel.handleReadable(JsseConnectedSslStreamChannel.java:180) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA] at org.xnio.nio.NioHandle.run(NioHandle.java:90) [org-jboss-xnio-xnio-nio-3.0.7.GA.jar:3.0.7.GA] at org.xnio.nio.WorkerThread.run(WorkerThread.java:187) [org-jboss-xnio-xnio-nio-3.0.7.GA.jar:3.0.7.GA]
I couldn't find any mention of changes in the 7.2 CLI API but nothing else changed so I'm wondering if I have to change the way I use the API.
Thanks for your help.
Fabian