12/03/2007: Super Simple Embedded Groovy
Here is the simplest possible Java program that runs a Groovy Script (as far as I know).
package affy.groovy.driver;
import groovy.lang.GroovyShell;
public class GroovyDriver {
public static void main(String[] args) {
new GroovyShell().evaluate("println('Hello World');");
}
}
You'll need three jar files to make this program compile and execute:
groovy-1.0.jar asm-2.2.jar antlr-2.7.5.jar
11/13/2007: WARNING: Cound not start ClientFactory - FIXED!
This warning also says that the javax.naming.NoInitialContextException was caused by a missing java.naming.factory.initial parameter.
I am seeing this error while running an embedded ServiceMix engine. It is easy to fix however. You need to add two files to the classpath.
jndi.properties
java.naming.factory.initial = org.apache.xbean.spring.jndi.SpringInitialContextFactoryjndi.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="jndi" class="org.apache.xbean.spring.jndi.DefaultContext">
<property name="entries">
<map/>
</property>
</bean>
</beans>