Why JBoss CLI throws ERROR parsing ? keys to aesh. Check your inputrc ?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Issue
- When having
.inputrcfile in home directory with the following content:
# Control characters
"\C-?": backward-delete-char
- Getting the following ERROR Stacktrace in starting
jboss-cli.sh:
[user@user bin]$ ./jboss-cli.sh -c
java.lang.RuntimeException: ERROR parsing ? keys to aesh. Check your inputrc.
at org.jboss.aesh.edit.mapper.KeyMapper.convertRandomControlKeys(KeyMapper.java:161)
at org.jboss.aesh.edit.mapper.KeyMapper.mapRandomKeys(KeyMapper.java:138)
at org.jboss.aesh.edit.mapper.KeyMapper.mapKeys(KeyMapper.java:108)
at org.jboss.aesh.edit.mapper.KeyMapper.mapQuoteKeys(KeyMapper.java:49)
at org.jboss.aesh.console.Config.parseInputrc(Config.java:127)
at org.jboss.aesh.console.Console.reset(Console.java:150)
at org.jboss.aesh.console.Console.<init>(Console.java:105)
at org.jboss.aesh.console.Console.<init>(Console.java:101)
at org.jboss.as.cli.impl.Console$Factory.getConsole(Console.java:85)
at org.jboss.as.cli.impl.Console$Factory.getConsole(Console.java:78)
at org.jboss.as.cli.impl.CommandContextImpl.initBasicConsole(CommandContextImpl.java:354)
at org.jboss.as.cli.impl.CommandContextImpl.<init>(CommandContextImpl.java:294)
at org.jboss.as.cli.impl.CommandContextFactoryImpl.newCommandContext(CommandContextFactoryImpl.java:76)
at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:279)
at org.jboss.as.cli.impl.CliLauncher.main(CliLauncher.java:262)
at org.jboss.as.cli.CommandLineMain.main(CommandLineMain.java:34)
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:312)
at org.jboss.modules.Main.main(Main.java:460)
Resolution
-
If user tries to use the
"?"as a control character in the/home/users/.inputrcfile thenjboss-cli.shutility startup throws the above mentionedERROR parsing ? keys to aesh. Check your inputrc.ERROR message in the output. -
As per JBoss Aesh API Content from github.com is not included.KeyMapper.java class, only some of the characters are allowed intentionally as lookupControlKey does not include the
"?". Hence when the".inputrc"file is containing the"?"as control character then users face this issue. -
If it is must for the users to use the
"?"as a control character then user need to follow the below procedure: -
In the terminal where user is planning to run the
jboss-cli.shscript, Specify theuser.homesystem property to some other existing directory which does not include the.inputrcfile like following and then try starting thejboss-cli.shscript (Please make sure that the directory should exist which user has specified in theuser.homevariable):
export JAVA_OPTS="-Duser.home=/home/user/test $JAVA_OPTS"
cd jboss-eap-6.3.2/bin
./jboss-cli.sh -c
-
The history of the running commands will be stored inside the
${user.home}/.jboss-cli-historydirectory now. -
If user do not want to set the
JAVA_OPTSevery time before starting thejboss-cliscript then users can also try editing thejboss-eap-6.3.2/bin/jboss-cli.shfile and add theJAVA_OPTSexport statement in this file somewhere above the last line like this:
export JAVA_OPTS="-Duser.home=/home/jsensharma/test $JAVA_OPTS"
eval \"$JAVA\" $JAVA_OPTS \"-Dlogging.configuration=file:$JBOSS_HOME/bin/jboss-cli-logging.properties\" -jar \"$JBOSS_HOME/jboss-modules.jar\" -mp \"${JBOSS_MODULEPATH}\" org.jboss.as.cli '"$@"'
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.