prompt/welcome errors

197 views
Skip to first unread message

Eric Pederson

unread,
Jun 16, 2014, 1:00:43 PM6/16/14
to crash...@googlegroups.com
Hi all:

I am completely new to Crash.  I have a service application with no web and no Spring with crash.cli, crash.shell and crash.connectors.telnet included via Maven.  

In my application I am starting up Crash with standalone.Bootstrap.bootstrap().

When I connect using telnet I get errors in the log (see below).

How do I configure the welcome and prompt?

Also how do I set properties in general?  I tried using either /crash.properties or conf/crash.properties in my classpath but it didn't recognize a change to crash.telnet.port.

My intention is to run my service as usual but connect to it via Crash when it is running using telnet or ssh.

Thanks,

2014-06-16 12:45:51,773 | ERROR | rsh.lang.impl.groovy.GroovyCompiler | Connection1      | Could not get a welcome message, will use empty
groovy.lang.MissingPropertyException: No such property: welcome for class: org.crsh.lang.impl.groovy.ShellBinding
at groovy.lang.Binding.getVariable(Binding.java:62) ~[groovy-2.3.2.jar:2.3.2]
at org.crsh.lang.impl.groovy.ShellBinding.getVariable(ShellBinding.java:218) ~[crash.shell-1.3.0.jar:na]
at org.crsh.lang.impl.groovy.GroovyCompiler.eval(GroovyCompiler.java:94) [crash.shell-1.3.0.jar:na]
at org.crsh.lang.impl.groovy.GroovyCompiler.doCallBack(GroovyCompiler.java:71) [crash.shell-1.3.0.jar:na]
at org.crsh.shell.impl.command.CRaSHSession.getWelcome(CRaSHSession.java:130) [crash.shell-1.3.0.jar:na]
at org.crsh.shell.impl.async.AsyncShell.getWelcome(AsyncShell.java:82) [crash.shell-1.3.0.jar:na]
at org.crsh.telnet.term.processor.Processor.run(Processor.java:131) [crash.connectors.telnet-1.3.0.jar:na]
at org.crsh.telnet.term.processor.ProcessorIOHandler.handle(ProcessorIOHandler.java:56) [crash.connectors.telnet-1.3.0.jar:na]
at org.crsh.telnet.term.TelnetHandler.run(TelnetHandler.java:38) [crash.connectors.telnet-1.3.0.jar:na]
at net.wimpi.telnetd.net.Connection.run(Connection.java:119) [telnetd-x-2.1.1.jar:na]
2014-06-16 12:45:51,774 | ERROR | rsh.lang.impl.groovy.GroovyCompiler | Connection1      | Could not get a prompt message, will use empty
groovy.lang.MissingPropertyException: No such property: prompt for class: org.crsh.lang.impl.groovy.ShellBinding
at groovy.lang.Binding.getVariable(Binding.java:62) ~[groovy-2.3.2.jar:2.3.2]
at org.crsh.lang.impl.groovy.ShellBinding.getVariable(ShellBinding.java:218) ~[crash.shell-1.3.0.jar:na]
at org.crsh.lang.impl.groovy.GroovyCompiler.eval(GroovyCompiler.java:94) [crash.shell-1.3.0.jar:na]
at org.crsh.lang.impl.groovy.GroovyCompiler.doCallBack(GroovyCompiler.java:71) [crash.shell-1.3.0.jar:na]
at org.crsh.shell.impl.command.CRaSHSession.getPrompt(CRaSHSession.java:145) [crash.shell-1.3.0.jar:na]
at org.crsh.shell.impl.async.AsyncShell.getPrompt(AsyncShell.java:86) [crash.shell-1.3.0.jar:na]
at org.crsh.telnet.term.processor.Processor.writePromptFlush(Processor.java:369) [crash.connectors.telnet-1.3.0.jar:na]
at org.crsh.telnet.term.processor.Processor.run(Processor.java:135) [crash.connectors.telnet-1.3.0.jar:na]
at org.crsh.telnet.term.processor.ProcessorIOHandler.handle(ProcessorIOHandler.java:56) [crash.connectors.telnet-1.3.0.jar:na]
at org.crsh.telnet.term.TelnetHandler.run(TelnetHandler.java:38) [crash.connectors.telnet-1.3.0.jar:na]
at net.wimpi.telnetd.net.Connection.run(Connection.java:119) [telnetd-x-2.1.1.jar:na]

Julien Viet

unread,
Jun 16, 2014, 5:35:07 PM6/16/14
to crash...@googlegroups.com
Hi,

this error say that crash is basically running the /crash/commands/ folder. This folder contains the login.groovy file that creates two closures in the user session “welcome” and “prompt” https://github.com/crashub/crash/blob/master/shell/src/main/resources/crash/commands/base/login.groovy

When a user login (via telnet in this case) the “welcome” closure is evaluated to produce a welcome message sent to the user (note that this logged error should not prevent the user to use CRaSH).

This happens because you are using the Bootstrap class without telling CRaSH where to find configuration. To solve this you should use the constructor with the (ClassLoader baseLoader, FS confFS, FS cmdFS) arguments and provide it a confFS and a cmdFS so CRaSH can find them.

You can create the appropriate FS with the following code:

FS.Builder builder = new FS.Builder().register(“classpath”, new ClassPathMountFactory(Thread.currentThread().getContextClassLoader()););
FS cmdFS = builder.mount(“classpath:/crash/commands/“).build();
FS confFS = builder.mount(“classpath:/crash/“).build();

This setup will find the files in the classpath as you described.

You can override this behaviour by changing the FS, you can check this code https://github.com/crashub/crash/blob/master/shell/src/main/java/org/crsh/standalone/CRaSH.java and also read more about mount point configuration here : http://www.crashub.org/1.3/reference.html#_mount_point_configuration

If you want to customize welcome/prompt you should provide your version of login.properties.

-- 
Julien Viet
www.julienviet.com

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "CRaSH User Group".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse crash-users...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Eric Pederson

unread,
Jun 17, 2014, 11:43:01 AM6/17/14
to crash...@googlegroups.com
Thanks!  That fixed it.

To customize the welcome would I need to remove the login.groovy from the jar and provide my own?  Just providing my own at classpath:/crash/commands/base/login.groovy didn't work.

Julien Viet

unread,
Jun 17, 2014, 1:44:31 PM6/17/14
to crash...@googlegroups.com
the best would be to make a copy of all commands in another path and use this new path in the mount point configuration.

Prompt and welcome message needs a more flexible customisation in the future to address your use case. (like the name of the closure to evaluate declared in a property like crash.shell.welcome=welcome and crash.shell.prompt=prompt by default)

-- 
Julien Viet
www.julienviet.com

Reply all
Reply to author
Forward
0 new messages