Rick

Rick
Rick

Tuesday, February 9, 2010

Read the Roo manual now trying the tutorial (stay tuned)

I read the Roo manual (cover to cover). Now I want to try out the tutorial. I am still evaluating Roo. I am looking for a set of modern best practices for using the Spring Framework(for a client).

I watched a talk by Ben Alex on InfoQ wrt Roo. He stated that Roo uses the state-of-the-art best practice.

Not sure where to get started on this... I am thinking about installing on either my Debian instance (VMWare), Unbuntu instance (VMWare), or Windows XP (host OS).

I need to install Eclipse, Spring STS Eclipse plugins, Maven, etc. I'd like to do this on a relatively clean environment.

I think I will use Windows XP since it is the host OS and I will get the most RAM and CPU out of it (on this box).

Looks like on my windows box, I have JDK 1.6 and Netbeans but no Eclipse and no Maven.
I need something more than Maven 2.0.9 to run Roo. Time to download, download, download.

It seems you can download
with Eclipse from Spring source.

The Roo docs say to use Maven 2.0.9 or later. The latest released version of Maven is 2.2.1.
I wonder if this is ok. I am about to find out.

I downloaded maven 2.2.1

Next I downloaded Spring Roo...
Then I setup my .bashrc file as follows (cygwin):

export JAVA_HOME="/cygdrive/C/Program Files/Java/jdk1.6.0_18"
export MAVEN_HOME=/home/rhightower/tools/maven/apache-maven-2.2.1
export ROO_HOME=/home/rhightower/tools/roo/spring-roo-1.0.1.RELEASE
export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$ROO_HOME/bin

I am using cygwin since I have to switch back and forth between Linux, MacOS and Windows. It is easier on my brain.

Maven ran fine. The JDK javac command ran fine, but Roo did not run.

rhightower@cmsjdl23 ~
$ mkdir sample

rhightower@cmsjdl23 ~
$ cd sample/

rhightower@cmsjdl23 ~/sample
$ ls

rhightower@cmsjdl23 ~/sample
$ roo.sh
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/r
oo/bootstrap/Bootstrap
Caused by: java.lang.ClassNotFoundException: org.springframework.roo.bootstrap.B
ootstrap
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)

Seems like it is time to reread the Roo install docs.

Ok reread. It seems like I am doing everything right. (I did go ahead and add the symbolic link to /usr/bin/roo so I can just type roo).

Seems someone else has ran into my cygwin pain.


Ben Alex says the magic cygwin light is here...

He also suggests that if you come up with a cygwin fix for run.sh that it will be included in the distribution... (I know run.sh for Jboss and mvn.sh for maven both support cygwin... so perhaps... I will reverse that they do and include it....)

For now... I will take 10 minutes and try to hack the roo.sh to run on cygwin.

I followed Ben's link. I noticed that both JBoss and mvn support cygwin so I looked how they did it and then hacked roo.sh into submission.

Here is what I came up with.... (this roo.sh should work under Unix, Linux, MacOS and cygwin)...

roo.sh that is cygwin friendly...

#!/bin/sh

PRG="$0"

while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
ROO_HOME=`dirname "$PRG"`

# Absolute path
ROO_HOME=`cd "$ROO_HOME/.." ; pwd`

# echo Resolved ROO_HOME: $ROO_HOME
echo "ROO HOME $ROO_HOME"
echo "JAVA_HOME $JAVA_HOME"

cygwin=false;
case "`uname`" in
CYGWIN*)
cygwin=true
;;
esac

if [ "$cygwin" = "true" ]; then
export ROO_HOME="`cygpath -wp $ROO_HOME`"
export JAVA_HOME="`cygpath -wp "$JAVA_HOME"`"
export EXT_DIR=""$ROO_HOME\\dist";"$ROO_HOME\\lib";"$ROO_HOME\\work";"$JAVA_HOME\\jre\\lib\\ext""
echo "ROO HOME $ROO_HOME"
echo "JAVA_HOME $JAVA_HOME"
echo "EXT_DIR $EXT_DIR"
else
export EXT_DIR="$ROO_HOME/dist:$ROO_HOME/lib:$ROO_HOME/work:$JAVA_HOME/jre/lib/ext"
fi

while true; do
java -Djava.ext.dirs="$EXT_DIR" $ROO_OPTS -Droo.home="$ROO_HOME" org.springframework.roo.bootstrap.Bootstrap "classpath:roo-bootstrap.xml" $@
EXITED=$?
# echo Exited with $EXITED
if [ $EXITED -ne 100 -a $EXITED -ne 200 ]; then
break
fi
done

So to recap,,, I downloaded and installed SpringSource STS (with Eclipse), maven 2.2.1 and Roo 1.0.1. I had to hack roo.sh to get it to work with cygwin. I posted my hack on the Spring forum and on my twitter... Hopefully future version of roo will support cygwin.

Now I can actually go through the tutorial...

Ok.. I am up to the part where I running the selenium tests. It is taking a while. It seems maven is downloading dependencies.

Still downloading...

Still downloading...

Ahhh... I miss maven.. I think I drink a lot more coffee whenever I use maven.

[INFO] -----------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] -----------------------------------------
[INFO] Total time: 5 minutes 45 seconds
[INFO] Finished at: Tue Feb 09 16:11:54 PST 2010
[INFO] Final Memory: 16M/38M

Ok.. I am up to mvn selenium:selenese

Ok...

This runs for a while...

Ok.. Firefox has decided to update itself (I don't use firefox.. I usually use Chrome.. I am a big google fan.)

I had to restart firefox a few times. Then I gave up and updated firefox to the latest... Now things really don't work.

$ mvn selenium:selenese
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building tenminutes
[INFO] task-segment: [selenium:selenese]
[INFO] ------------------------------------------------------------------------
[INFO] [selenium:selenese {execution: default-cli}]
log4j:WARN No appenders could be found for logger (org.openqa.selenium.server.Se
leniumServer).
log4j:WARN Please initialize the log4j system properly.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unable to delete file C:\Documents and Settings\rhightower\customProfileD
ir502545\parent.lock
[INFO] ------------------------------------------------------------------------
[INFO] Trace
Unable to delete file C:\Documents and Settings\rhightower\customProfileDir50254
5\parent.lock
at org.apache.tools.ant.taskdefs.Delete.handle(Delete.java:624)
at org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:683)
at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:543)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.recursively
DeleteDir(LauncherUtils.java:72)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.deleteTryTr
yAgain(LauncherUtils.java:80)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.deleteTryTr
yAgain(LauncherUtils.java:84)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.deleteTryTr
yAgain(LauncherUtils.java:84)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.deleteTryTr
yAgain(LauncherUtils.java:84)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.deleteTryTr
yAgain(LauncherUtils.java:84)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.deleteTryTr
yAgain(LauncherUtils.java:84)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.deleteTryTr
yAgain(LauncherUtils.java:84)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.rem
oveCustomProfileDir(FirefoxChromeLauncher.java:238)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.clo


I tried manually deleting the lock file. (I had to kill Firefox first.). Then I reran the selinium tests. It still does not work. I think I will skip this step for now.

Going through #roo docs. ten-minutes example worked (took longer than 10 minutes).. clinic sample did not work (circular ref). Going on to tutorial.

stay tuned... more to come...



No comments:

Post a Comment

Kafka and Cassandra support, training for AWS EC2 Cassandra 3.0 Training