Groovy on z/OS

Discussions regarding Open Source Java projects under z/OS (other than Tomcat)
Post Reply
DaveThePom
Posts: 4
Joined: Wed Nov 15, 2006 5:29 am
Location: Perth, Australia
Contact:

Groovy on z/OS

Post by DaveThePom » Wed Nov 15, 2006 5:37 am

Has anybody managed to get Groovy installed on a z/OS system. I downloaded the source and the package is built using Maven. I then downloaded maven but when I ran pax it failed due to @LongLink references that pax couldn't handle.

I suppose I could manually go through the maven build process but that seems like a lot of work!

Groovy is shaping up to be a fantastic language. I think it would be a fantastic addition to z/OS.

SteveGoetze
Posts: 377
Joined: Fri Jul 30, 2004 5:29 pm

Post by SteveGoetze » Wed Nov 15, 2006 7:51 am

I'm not aware that this has been done, but I think it would be great if someone spent some time on it.

DaveThePom
Posts: 4
Joined: Wed Nov 15, 2006 5:29 am
Location: Perth, Australia
Contact:

Post by DaveThePom » Wed Nov 15, 2006 8:28 am

I'm more than willing to give it a crack. Any advice on how to get a quick start is more than welcome.

SteveGoetze
Posts: 377
Joined: Fri Jul 30, 2004 5:29 pm

Post by SteveGoetze » Wed Nov 15, 2006 4:22 pm

I've installed groovy-1.0-JSR-06 on z/OS and performed some rudimentary testing, running groovysh and compiling and running a groovy script. Please feel free to pick up from here and do some more testing.

If problems crop up, they will almost certainly be related to character encoding. If you see any, pass them on and we'll see if we can get them addressed.

Installation steps:

Get the .zip version of the latest build: groovy-1.0-jsr-06.zip
From a z/OS shell:

Code: Select all

jar -xvf groovy-1.0-jsr-06.zip
ln -s groovy-1.0-jsr-06.zip groovy
cd groovy
for i in bin/*; do; iconv -f iso8859-1 -t ibm-1047 $i > $i.e; mv $i.e $i; done
for i in conf/*; do; iconv -f iso8859-1 -t ibm-1047 $i > $i.e; mv $i.e $i; done
chmod +x bin/*
Export a GROOVY_HOME environment variable
Add GROOVY_HOME/bin to your PATH
Ensure that JAVA_HOME is set to point to an installed JDK

To run a groovy shell:

Code: Select all

groovysh
To compile and run a script, create the file "hello.groovy":

Code: Select all

println "hello, world"
for (arg in this.args ) {
  println "Argument:" + arg;
}
Then compile and run:

Code: Select all

groovy test.groovy foo bar baz

DaveThePom
Posts: 4
Joined: Wed Nov 15, 2006 5:29 am
Location: Perth, Australia
Contact:

Post by DaveThePom » Thu Nov 16, 2006 5:40 am

Thanks Steve, very much appreciated.

I've started to run some unit tests, no problems so far. The load time is slow, but I expected that. Curiously, when I run groovy from the OMVS shell, no output is written until I press enter. If I telnet in, everything is fine.

SteveGoetze
Posts: 377
Joined: Fri Jul 30, 2004 5:29 pm

Post by SteveGoetze » Thu Nov 16, 2006 8:30 am

groovy loads a lot of java to get started. If you have the 5.0 SDK on z/OS, you can use the shared classes feature to get better startup performance.

Code: Select all

export JAVA_OPTS="-Xshareclasses"
You should see an improvement in startup times after the first groovy run. Note that this feature is not available under the 1.4 SDK.

DaveThePom
Posts: 4
Joined: Wed Nov 15, 2006 5:29 am
Location: Perth, Australia
Contact:

Post by DaveThePom » Fri Nov 17, 2006 7:54 am

Thanks for the tip. I didn't notice a big difference with groovy, but it's certainly noticeable when running Java programs.

I'm trying to run the following soap samples which results in an error. I don't know if this is due to character encoding, but it runs ok on XP.

Code: Select all

import groovy.net.soap.SoapServer

def server = new SoapServer("localhost", 6980)

server.setNode("MathService")

server.start()

Caught: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: SoapServer(java.lang.String, java.lang.Integer)
        at SoapServer.run(SoapServer.groovy:3)
        at SoapServer.main(SoapServer.groovy)
BTW, your help is much appreciated. If you ever find yourself in Western Australia I'll shout you a few beers ;).
David Crayford
---------------------
Fundi Software

Post Reply