jboss7.x - Exception in JBoss AS 7.2 CLI API when terminating connection -


we upgraded jboss 7.1.3-final 7.2.0-final. since upgraded 1 of our applications, uses java cli public api, throws nullpointerexceptions every time connection terminated through cli api.

the following our code set , close connection jboss cli:

private commandcontext ctx; private modelcontrollerclient client;   public jbossclitool() {    try {         ctx = commandcontextfactory.getinstance().newcommandcontext();     } catch(cliinitializationexception e) {         throw new illegalstateexception("failed 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() following exception thrown:

13:46:58,691 error [org.jboss.remoting.handler-errors] (remoting "cli-client" read-1) close handler threw exception: java.lang.nullpointerexception @ 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] @ 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] @ 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] @ org.jboss.remoting3.spi.spiutils.safehandleclose(spiutils.java:54) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.spi.abstracthandleablecloseable$closehandlertask.run(abstracthandleablecloseable.java:501) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.spi.abstracthandleablecloseable.runclosetask(abstracthandleablecloseable.java:406) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.spi.abstracthandleablecloseable.closecomplete(abstracthandleablecloseable.java:277) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.connectionimpl.access$000(connectionimpl.java:38) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.connectionimpl$1.handleclose(connectionimpl.java:55) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.connectionimpl$1.handleclose(connectionimpl.java:53) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.spi.spiutils.safehandleclose(spiutils.java:54) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.spi.abstracthandleablecloseable$closehandlertask.run(abstracthandleablecloseable.java:501) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.spi.abstracthandleablecloseable.runclosetask(abstracthandleablecloseable.java:406) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.spi.abstracthandleablecloseable.closecomplete(abstracthandleablecloseable.java:277) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.remote.remoteconnectionhandler.handleconnectionclose(remoteconnectionhandler.java:117) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.remote.remotereadlistener.handleevent(remotereadlistener.java:78) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.jboss.remoting3.remote.remotereadlistener.handleevent(remotereadlistener.java:45) [org-jboss-remoting3-jboss-remoting-3.2.14.ga.jar:3.2.14.ga] @ org.xnio.channellisteners.invokechannellistener(channellisteners.java:72) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.channels.translatingsuspendablechannel.handlereadable(translatingsuspendablechannel.java:189) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.channels.translatingsuspendablechannel$1.handleevent(translatingsuspendablechannel.java:103) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.channellisteners.invokechannellistener(channellisteners.java:72) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.channels.translatingsuspendablechannel.handlereadable(translatingsuspendablechannel.java:189) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.ssl.jsseconnectedsslstreamchannel.handlereadable(jsseconnectedsslstreamchannel.java:180) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.channels.translatingsuspendablechannel$1.handleevent(translatingsuspendablechannel.java:103) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.channellisteners.invokechannellistener(channellisteners.java:72) [org-jboss-xnio-xnio-api-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.nio.niohandle.run(niohandle.java:90) [org-jboss-xnio-xnio-nio-3.0.7.ga.jar:3.0.7.ga] @ org.xnio.nio.workerthread.run(workerthread.java:187) [org-jboss-xnio-xnio-nio-3.0.7.ga.jar:3.0.7.ga] 

using 7.1.3 api , jboss same code works fine. 7.2 connection seems closed correctly (after calling terminatesession() no further calls cli can made until establish new connection).

i asked same question in jboss community, repeating hear in hope of else seeing it. here's link: https://community.jboss.org/message/828608

well, had same problem.

to serious, haven't analyzed in detail. seems has execution of composite dmrs - maybe in combination reload-required.

the parsedcommandline in commandcontext class null. not checked close handler method.

as first workaround added non invasive command before closing context. added following line in close method:

// workaround strange npe jboss-cli not understand... if (cmdctx.getparsedcommandline() == null   || cmdctx.getparsedcommandline().getformat() == null) {   cmdctx.handle("/:read-attribute(name=launch-type)"); } if (!cmdctx.isterminated()) {   cmdctx.terminatesession(); } 

maybe not best solution, works on first try...


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -