On Apr 23, 2016, at 5:44 PM, Steve Storck <stev...@gmail.com> wrote:I have been looking for examples of the simplest (and thinnest) way of embedding CRaSH in a regular jar application.
I also want to be able to invoke the shell when starting up the application so that the user does not have to invoke any commands to access the jar. Can anyone please point me in the right direction?
Thanks,
Steve--
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.
Thanks again,
Steve
<filters>
<filter>
<artifact>org.crashub:crash.shell</artifact>
<excludes>
<exclude>crash/commands/base/login.groovy</exclude>
</excludes>
</filter>
</filters>
<resources>
<resource>
<directory>src/main/groovy/commands</directory>
<targetPath>crash/commands</targetPath>
<filtering>false</filtering>
</resource>
</resources>
--
Vous recevez ce message, car vous êtes abonné à un sujet dans le groupe Google Groupes "CRaSH User Group".
Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/crash-users/96CXU3HBpwk/unsubscribe.
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse crash-users...@googlegroups.com.
On May 5, 2016, at 7:55 PM, Steve973 <stev...@gmail.com> wrote:Julien,Thanks for checking it out. Yes, the commands are completely broken at the moment. I haven't quite gotten the same error that you are getting. Are you using java 1.8?
For me, I get null pointer exceptions because I have not retrieved the proper bean that most of the information is retrieved from. When I am really read to get some feedback, the whole code base will be thoroughly tested and the readme will be quite detailed. But, along the way, I will send you some updates to check out the progress. It might serve as a helpful example to some other people. And if it is indeed eventually included with the camel distribution, it will be very readily available.
Yes. I have talked with him about this module. He seemed to be interested.
@Configuration
public class StandaloneConfig {
@Bean(name = "springBootstrap")
@Scope(value = "singleton")
public SpringBootstrap springBootstrap() {
return new SpringBootstrap();
}
@Bean(name = "StandaloneRunner")
public StandaloneRunner standaloneRunner() {
return StandaloneRunner.getInstance();
}
}
public static void main(String... args) throws Exception {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(StandaloneConfig.class);
configureSpringBootstrap(ctx);
ctx.start();
}
private static void configureSpringBootstrap(ApplicationContext ctx) {
SpringBootstrap bootstrap = ctx.getBean(SpringBootstrap.class);
bootstrap.setBeanFactory(ctx.getAutowireCapableBeanFactory());
bootstrap.setBeanClassLoader(ctx.getClassLoader());
bootstrap.setCmdMountPointConfig("classpath:/commands");
bootstrap.setConfMountPointConfig("classpath:/camel-standalone-crash.properties");
Properties properties = new Properties();
properties.put("crash.vfs.refresh_period", "1");
properties.put("crash.auth", "simple");
properties.put("crash.auth.simple.username", "admin");
properties.put("crash.auth.simple.password", "admin");
bootstrap.setConfig(properties);
}
class contextInfo {It is not compiled, but copied to the jar at /commands.
private def String INDENT = ' '
StandaloneRunner standalone
@Command
public void main(InvocationContext context, @Argument String name) {
BeanFactory factory = context.attributes['spring.beanfactory']
standalone = factory.getBean StandaloneRunner
if (!name) {
printAllContextInfo()
} else {
out.println 'Context info:'
printContextInfo 2, standalone.contexts[name]
}
}
May 06, 2016 6:07:32 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@64bf3bbf: startup date [Fri May 06 18:07:32 EDT 2016]; root of context hierarchy
May 06, 2016 6:07:32 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6d3af739: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,standaloneConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,StandaloneRunner,springBootstrap]; root of factory hierarchy
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginLifeCycle configureProperty
INFO: Configuring property vfs.refresh_period=1 from properties
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=CRaSHShellFactory,interface=ShellFactory]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=GroovyLanguageProxy,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=JavaLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=ScriptLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=JaasAuthenticationPlugin,interface=AuthenticationPlugin]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=SimpleAuthenticationPlugin,interface=AuthenticationPlugin]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginLifeCycle configureProperty
INFO: Configuring property auth.simple.username=admin from properties
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginLifeCycle configureProperty
INFO: Configuring property auth.simple.password=admin from properties
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=GroovyLanguageProxy,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=JavaLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=ScriptLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=CRaSHShellFactory,interface=ShellFactory]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=JaasAuthenticationPlugin,interface=AuthenticationPlugin]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=SimpleAuthenticationPlugin,interface=AuthenticationPlugin]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
May 06, 2016 6:07:33 PM org.crsh.standalone.CRaSH main
INFO: conf mounts: classpath:/crash/
May 06, 2016 6:07:33 PM org.crsh.standalone.CRaSH main
INFO: cmd mounts: classpath:/crash/commands/
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginLifeCycle configureProperty
INFO: Configuring property auth.simple.username=admin from properties
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginLifeCycle configureProperty
INFO: Configuring property auth.simple.password=admin from properties
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginLifeCycle configureProperty
INFO: Configuring property vfs.refresh_period=1 from properties
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=CRaSHShellFactory,interface=ShellFactory]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=GroovyLanguageProxy,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=JavaLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=ScriptLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=JaasAuthenticationPlugin,interface=AuthenticationPlugin]
May 06, 2016 6:07:33 PM org.crsh.plugin.ServiceLoaderDiscovery getPlugins
INFO: Loaded plugin Plugin[type=SimpleAuthenticationPlugin,interface=AuthenticationPlugin]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=GroovyLanguageProxy,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=JavaLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=ScriptLanguage,interface=Language]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=CRaSHShellFactory,interface=ShellFactory]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=JaasAuthenticationPlugin,interface=AuthenticationPlugin]
May 06, 2016 6:07:33 PM org.crsh.plugin.PluginManager getPlugins
INFO: Initialized plugin Plugin[type=SimpleAuthenticationPlugin,interface=AuthenticationPlugin]
context-info: exception: Cannot invoke method getBean() on null object
standalone-shell (main)>May 06, 2016 6:07:39 PM org.crsh.shell.impl.command.CRaSHProcess execute
SEVERE: Error while evaluating request 'context-info' context-info: exception: Cannot invoke method getBean() on null object
java.lang.NullPointerException: Cannot invoke method getBean() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at contextInfo.main(context-info:23)
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:497)
at org.crsh.cli.impl.lang.MethodDescriptor$1.invoke(MethodDescriptor.java:164)
at org.crsh.cli.impl.lang.MethodDescriptor$1.invoke(MethodDescriptor.java:106)
at org.crsh.lang.impl.java.ProducerCommandMatch$1.close(ProducerCommandMatch.java:117)
at org.crsh.shell.impl.command.pipeline.CommandInvokerAdapter.close(CommandInvokerAdapter.java:296)
at org.crsh.shell.impl.command.pipeline.PipeLine.close(PipeLine.java:106)
at org.crsh.shell.impl.command.spi.CommandInvoker.invoke(CommandInvoker.java:52)
at org.crsh.shell.impl.command.CRaSHCommandProcess.doInvoke(CRaSHCommandProcess.java:39)
at org.crsh.shell.impl.command.CRaSHProcess.execute(CRaSHProcess.java:60)
at org.crsh.shell.impl.async.AsyncProcess$2.call(AsyncProcess.java:207)
at org.crsh.shell.impl.async.AsyncProcess$2.call(AsyncProcess.java:177)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)