your example works normally.

result are printed in the shell.

- Romain


2012/2/9 Mansour Al Akeel <mansour.alak...@gmail.com>

> Romain,
> This is not running interactively.
> https://issues.apache.org/jira/browse/OPENEJB-1734
>
> By interactive, I mean to have a shell similar to groovy shell running
> locally on my desktop, with all the bindings in the openejb context
> available.
> So for example, I can say
>
> CalculatorRemote.sum(1,1)
> and it will show the results
> ===> 2
>
>
> If I have time next week, I will for openejb on github and will add this.
>
>
>
>
> On Thu, Feb 9, 2012 at 2:59 AM, Romain Manni-Bucau <rmannibu...@gmail.com
> >wrote:
>
> > of course it is!
> >
> > you ask to execute a command on the server so a println is executed on
> the
> > server...
> >
> > only the return of the script is printed in the shell.
> >
> > if your script simply wants to print sthg simply print in another output
> > stream (a byte buffer for instance) than the system one and return its
> > value at the end of the script.
> >
> >
> > - Romain
> >
> >
> > 2012/2/9 Mansour Al Akeel <mansour.alak...@gmail.com>
> >
> > > Nope.
> > > It's still not working. That's really "dangerous" if you commit a code
> to
> > > the trunk without even testing it.
> > > The results of the script are being wrote to the System.out and not
> back
> > to
> > > the client.
> > >
> > > Anyhow I developed my own remote shell to invoke ejbs from groovy
> shell.
> > >
> > > https://github.com/mansour77/remote-ejb-shell
> > >
> > >
> > >
> > > On Tue, Feb 7, 2012 at 10:15 AM, Romain Manni-Bucau
> > > <rmannibu...@gmail.com>wrote:
> > >
> > > > the snapshot had an issue for "script file" command.
> > > >
> > > > i just fixed it. if you take the snapshot if should work
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/2/7 Mansour Al Akeel <mansour.alak...@gmail.com>
> > > >
> > > > > Romain,
> > > > > Still no answer about the interactive shell commands. However
> here's
> > my
> > > > > attempts to run the file.
> > > > >
> > > > > mansour @ localhost:4222> script file groovy hello.groovy
> > > > > script file file groovy hello doesn't exist
> > > > > mansour @ localhost:4222> script file groovy "hello.groovy"
> > > > > script file file groovy "hello doesn't exist
> > > > > mansour @ localhost:4222> script groovy file"hello.groovy"
> > > > > javax.script.ScriptException: groovy.lang.MissingMethodException:
> No
> > > > > signature of method:
> > > > > org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.file() is
> > applicable
> > > > for
> > > > > argument types: (java.lang.String) values: [hello.groovy]
> > > > >
> > > > > Possible solutions: find(), find(groovy.lang.Closure),
> > > > > eval(java.lang.String), get(java.lang.String),
> > > compile(java.lang.String),
> > > > > use([Ljava.lang.Object;)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
> > > > >
> > >  javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.OpenEJBScripter.evaluate(OpenEJBScripter.java:56)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.command.ScriptCommand.execute(ScriptCommand.java:31)
> > > > >
> >  org.apache.openejb.server.cli.CliRunnable.run(CliRunnable.java:206)
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.ssh.OpenEJBCommands.run(OpenEJBCommands.java:68)
> > > > >    java.lang.Thread.run(Thread.java:662)
> > > > > mansour @ localhost:4222> script groovy file "hello.groovy"
> > > > > javax.script.ScriptException: groovy.lang.MissingMethodException:
> No
> > > > > signature of method:
> > > > > org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.file() is
> > applicable
> > > > for
> > > > > argument types: (java.lang.String) values: [hello.groovy]
> > > > >
> > > > > Possible solutions: find(), find(groovy.lang.Closure),
> > > > > eval(java.lang.String), get(java.lang.String),
> > > compile(java.lang.String),
> > > > > use([Ljava.lang.Object;)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
> > > > >
> > >  javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.OpenEJBScripter.evaluate(OpenEJBScripter.java:56)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.command.ScriptCommand.execute(ScriptCommand.java:31)
> > > > >
> >  org.apache.openejb.server.cli.CliRunnable.run(CliRunnable.java:206)
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.ssh.OpenEJBCommands.run(OpenEJBCommands.java:68)
> > > > >    java.lang.Thread.run(Thread.java:662)
> > > > > mansour @ localhost:4222> script groovy file:"hello.groovy"
> > > > > hello.groovy
> > > > >
> > > > >
> > > > >
> > > > > On Tue, Feb 7, 2012 at 8:17 AM, Romain Manni-Bucau <
> > > > rmannibu...@gmail.com
> > > > > >wrote:
> > > > >
> > > > > > to run a script file i think there is the command "script file
> > groovy
> > > > > > hello.groovy".
> > > > > >
> > > > > >
> > > > > > "script groovy XXX" will execute XXX as groovy code.
> > > > > >
> > > > > > Note: slashes in ejb names are replaced by underscore.
> > > > > >
> > > > > > for instance: "script groovy openejb_Deployer.deployedApps"
> should
> > > > works
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/2/7 Mansour Al Akeel <mansour.alak...@gmail.com>
> > > > > >
> > > > > > > Romain,
> > > > > > > I didn't understand your answer. Can you please kindly explain.
> > > > > > > The installation is completed and I am able to connect to the
> > port
> > > of
> > > > > the
> > > > > > > ssh server of openEJB. I can list the available EJBs.
> > > > > > > I didn't try to deploy any beans I am working on. Not even the
> > > > > examples.
> > > > > > >
> > > > > > > My last question is related to running interactive groovy shell
> > to
> > > > > query
> > > > > > > and use evaluate existing beans.
> > > > > > > The available command "script <language> <filename>" doesn't
> > > produce
> > > > > the
> > > > > > > expected output (if I understand correctly).
> > > > > > > Here's the steps I did:
> > > > > > > 1- created a file called "hello.groovy". The script prints a
> > simple
> > > > > > > message:
> > > > > > > println "hello world from OpenEJB"
> > > > > > > 2- now I connected through ssh, and typed:
> > > > > > > script groovy hello.groovy
> > > > > > > I got:
> > > > > > > mansour @ localhost:4222> script groovy hello.groovy
> > > > > > > javax.script.ScriptException:
> > groovy.lang.MissingPropertyException:
> > > > No
> > > > > > such
> > > > > > > property: hello for class: Script36
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
> > > > > > >
> > > > >
> >  javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.OpenEJBScripter.evaluate(OpenEJBScripter.java:56)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.command.ScriptCommand.execute(ScriptCommand.java:31)
> > > > > > >
> > > >  org.apache.openejb.server.cli.CliRunnable.run(CliRunnable.java:206)
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.ssh.OpenEJBCommands.run(OpenEJBCommands.java:68)
> > > > > > >    java.lang.Thread.run(Thread.java:662)
> > > > > > >
> > > > > > > 3- I tried to add quotations around the filename. but then I am
> > > > getting
> > > > > > the
> > > > > > > exact string I put:
> > > > > > >
> > > > > > > mansour @ localhost:4222> script groovy "hello.groovy"
> > > > > > > hello.groovy
> > > > > > >
> > > > > > > 4- I tried to do simple calculation:
> > > > > > > mansour @ localhost:4222> script groovy 1+1
> > > > > > > 2
> > > > > > >
> > > > > > > It looks like I have to give the text of the script to get some
> > > > > results.
> > > > > > > Even assigning a value to a variable is not possible:
> > > > > > >
> > > > > > > mansour @ localhost:4222> script groovy def c=MEJB
> > > > > > > javax.script.ScriptException:
> > groovy.lang.MissingPropertyException:
> > > > No
> > > > > > such
> > > > > > > property: MEJB for class: Script42
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
> > > > > > >
> > > > >
> >  javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.OpenEJBScripter.evaluate(OpenEJBScripter.java:56)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.cli.command.ScriptCommand.execute(ScriptCommand.java:31)
> > > > > > >
> > > >  org.apache.openejb.server.cli.CliRunnable.run(CliRunnable.java:206)
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.ssh.OpenEJBCommands.run(OpenEJBCommands.java:68)
> > > > > > >    java.lang.Thread.run(Thread.java:662)
> > > > > > >
> > > > > > >
> > > > > > > I am not sure about how to use this shell interactively. The
> code
> > > for
> > > > > the
> > > > > > > telnet shell, that allows running groovy commands, coppied all
> > the
> > > > > > variable
> > > > > > > in the context to the groovy shell, thus made the beans
> available
> > > to
> > > > > the
> > > > > > > scripts. How can I achieve the same with this telnet interface
> ?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Tue, Feb 7, 2012 at 7:41 AM, Romain Manni-Bucau <
> > > > > > rmannibu...@gmail.com
> > > > > > > >wrote:
> > > > > > >
> > > > > > > > the installation can't be done while the server is running
> but
> > > > after
> > > > > > the
> > > > > > > > interpretation is done at runtime.
> > > > > > > >
> > > > > > > > - Romain
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/2/7 Mansour Al Akeel <mansour.alak...@gmail.com>
> > > > > > > >
> > > > > > > > > Ok finally. I am able to connect. I guess I can not run an
> > > > > interpret
> > > > > > > > > interactively.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Tue, Feb 7, 2012 at 6:23 AM, Mansour Al Akeel
> > > > > > > > > <mansour.alak...@gmail.com>wrote:
> > > > > > > > >
> > > > > > > > > > OK, please ignore my email. I got working properly. still
> > > > trying
> > > > > to
> > > > > > > > > figure
> > > > > > > > > > out how to login. I added to users.properties:
> > > > > > > > > > admin=admin
> > > > > > > > > > mansour=mansour
> > > > > > > > > >
> > > > > > > > > > just for a quick test. trying to connect with: ssh -l
> > mansour
> > > > > > > localhost
> > > > > > > > > -P
> > > > > > > > > > 4222
> > > > > > > > > > not accepting the password.
> > > > > > > > > >
> > > > > > > > > > Willl see what to do.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Tue, Feb 7, 2012 at 6:15 AM, Mansour Al Akeel <
> > > > > > > > > > mansour.alak...@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > >> Here's what I got.
> > > > > > > > > >>
> > > > > > > > > >> INFO - Creating ServerService(id=httpejbd)
> > > > > > > > > >> INFO - Creating ServerService(id=cxf)
> > > > > > > > > >> INFO - Creating ServerService(id=admin)
> > > > > > > > > >> INFO - Creating ServerService(id=ejbd)
> > > > > > > > > >> INFO - Creating ServerService(id=ejbds)
> > > > > > > > > >> INFO - Creating ServerService(id=hsql)
> > > > > > > > > >> INFO - [Server@12b4986]: [Thread[main,5,main]]:
> > > > > > checkRunning(false)
> > > > > > > > > >> entered
> > > > > > > > > >> INFO - [Server@12b4986]: [Thread[main,5,main]]:
> > > > > > checkRunning(false)
> > > > > > > > > >> exited
> > > > > > > > > >> INFO - Creating ServerService(id=ssh)
> > > > > > > > > >> SEVERE - Cannot instantiate the service class
> > > > > > > > > >> org.apache.openejb.server.ssh.SSHServer. Received error:
> > > > > > > > > >> java.lang.NoClassDefFoundError
> > > > > > > org/apache/sshd/common/KeyPairProvider
> > > > > > > > > >> java.lang.NoClassDefFoundError:
> > > > > > > org/apache/sshd/common/KeyPairProvider
> > > > > > > > > >>         at
> java.lang.Class.getDeclaredConstructors0(Native
> > > > > Method)
> > > > > > > > > >>         at
> > > > > > > > >
> > java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> > > > > > > > > >>         at
> > java.lang.Class.getConstructors(Class.java:1459)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.xbean.recipe.ReflectionUtil.findConstructor(ReflectionUtil.java:603)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > > >
> > > > >
> > org.apache.xbean.recipe.ObjectRecipe.findFactory(ObjectRecipe.java:563)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:274)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > >
> > > org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > >
> > > org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.ServiceManager.initServer(ServiceManager.java:139)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.ServiceManager.initServers(ServiceManager.java:76)
> > > > > > > > > >>         at
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.server.SimpleServiceManager.init(SimpleServiceManager.java:142)
> > > > > > > > > >>         at
> > > > org.apache.openejb.server.Server.init(Server.java:74)
> > > > > > > > > >>         at
> > > > > > org.apache.openejb.server.Main.initServer(Main.java:154)
> > > > > > > > > >>         at
> > > org.apache.openejb.server.Main.main(Main.java:128)
> > > > > > > > > >>         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.apache.openejb.cli.MainImpl.main(MainImpl.java:148)
> > > > > > > > > >>         at
> > > > > > org.apache.openejb.cli.Bootstrap.main(Bootstrap.java:103)
> > > > > > > > > >> Caused by: java.lang.ClassNotFoundException:
> > > > > > > > > >> org.apache.sshd.common.KeyPairProvider
> > > > > > > > > >>         at
> > > > > java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> > > > > > > > > >>         at
> > > java.security.AccessController.doPrivileged(Native
> > > > > > > Method)
> > > > > > > > > >>         at
> > > > > > > java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> > > > > > > > > >>         at
> > > > java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> > > > > > > > > >>         at
> > > > > > > > sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> > > > > > > > > >>         at
> > > > java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> > > > > > > > > >>         ... 20 more
> > > > > > > > > >>   ** Starting Services **
> > > > > > > > > >>   NAME                 IP              PORT
> > > > > > > > > >>   httpejbd             127.0.0.1       4204
> > > > > > > > > >>   admin thread         127.0.0.1       4200
> > > > > > > > > >>   ejbd                 127.0.0.1       4201
> > > > > > > > > >>   ejbd                 127.0.0.1       4203
> > > > > > > > > >> INFO - [Server@12b4986]: Initiating startup sequence...
> > > > > > > > > >> INFO - [Server@12b4986]: Server socket opened
> > successfully
> > > in
> > > > > 37
> > > > > > > ms.
> > > > > > > > > >>   hsql                 127.0.0.1       9001
> > > > > > > > > >> -------
> > > > > > > > > >> Ready!
> > > > > > > > > >>
> > > > > > > > > >> I didn't configure JAAS and left if for the default
> > > > > configuration
> > > > > > at
> > > > > > > > > >> conf/login.config. I am using standalone openejb and not
> > > TomEE
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >> This is built from SVN trunk
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >> On Tue, Feb 7, 2012 at 3:58 AM, Romain Manni-Bucau <
> > > > > > > > > rmannibu...@gmail.com
> > > > > > > > > >> > wrote:
> > > > > > > > > >>
> > > > > > > > > >>> Hi,
> > > > > > > > > >>>
> > > > > > > > > >>> simply get the openejb-ssh-${version}.zip then extract
> it
> > > in
> > > > > > > > > >>> $CATALINA_HOME/webapps/tomee/lib.
> > > > > > > > > >>>
> > > > > > > > > >>> configure jaas in tomcat to be able to use it to
> connect
> > > > > through
> > > > > > > ssh.
> > > > > > > > > >>>
> > > > > > > > > >>> add groovy-all.jar to the same folder (or any other
> > > > > > implementation
> > > > > > > of
> > > > > > > > > the
> > > > > > > > > >>> scripting JSR)
> > > > > > > > > >>>
> > > > > > > > > >>> then simply connect through ssh and call: script
> > <language>
> > > > > > > <script>
> > > > > > > > > >>>
> > > > > > > > > >>> - Romain
> > > > > > > > > >>>
> > > > > > > > > >>>
> > > > > > > > > >>> 2012/2/7 Mansour Al Akeel <mansour.alak...@gmail.com>
> > > > > > > > > >>>
> > > > > > > > > >>> > Hello all,
> > > > > > > > > >>> > I need to use a scripting language to interactively
> > call
> > > > > EJBs.
> > > > > > I
> > > > > > > > saw
> > > > > > > > > a
> > > > > > > > > >>> > thread on the dev list:
> > > > > > > > > >>> >
> > > > > > > >
> > > > http://openejb.979440.n4.nabble.com/some-new-modules-td4308643.html
> > > > > > > > > >>> >
> > > > > > > > > >>> > pointing to this functionality, but there's no
> > > > documentation
> > > > > or
> > > > > > > how
> > > > > > > > > to
> > > > > > > > > >>> > install and configure it.
> > > > > > > > > >>> >
> > > > > > > > > >>> > Any hint ?
> > > > > > > > > >>> >
> > > > > > > > > >>> > Thank you.
> > > > > > > > > >>> >
> > > > > > > > > >>> >
> > > > > > > > > >>> >
> > > > > > > > > >>>
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to