Terence and Alvin -
Thanks for the help. Changing from guava 16 to 13 did ultimately fix the
problem (along with changing the pom, see below). The reason I tried 16 is
that guava 16 is what is included in the other example project (echo):
$ jar -tf twill-examples-echo-0.4.0-incubating-SNAPSHOT.jar
[...]
echo/
echo/EchoMain$1.class
echo/EchoMain$TestConverter.class
echo/EchoMain.class
lib/
lib/guava-16.0.1.jar
lib/slf4j-api-1.7.5.jar
Also, as I mentioned in the first email, even though the shaded plugin is
included in the yarn example app pom, no dependent libraries are added to the
shaded jar. This is because the dependencies in its pom are scoped as
"provided". If you comment out that scope, now it includes everything needed:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>twill-yarn</artifactId>
<version>${project.version}</version>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>twill-ext</artifactId>
<version>${project.version}</version>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
And now it ran with this:
$ export CP=twill-examples-yarn-shaded-0.4.0-incubating-SNAPSHOT.jar:`hadoop
classpath`
$ java -cp $CP org.apache.twill.example.yarn.HelloWorld localhost:2181
Should the "provided" scope be removed from the yarn example pom? Why is it
there?
-Michael
-----Original Message-----
From: Terence Yim [mailto:[email protected]]
Sent: Thursday, August 14, 2014 12:42 AM
To: [email protected]
Subject: Re: Newbie: how to deploy/launch
Try to have guava 13 jar at the beginning if your classpath, that should solve
the problem you mentioned.
Terence
Sent from my iPhone
> On Aug 11, 2014, at 1:17 PM, "Peterson, Michael"
> <[email protected]> wrote:
>
> I did a little more research on the run time error.
>
> When I run it with -verbose:
> $ java -verbose -cp $CP org.apache.twill.example.yarn.HelloWorld
> localhost:2181
>
> I see that the problem is with the guava libraries - the Service$Listener
> class in particular.
>
> [... lots of lines removed ...]
> [Loaded com.google.common.util.concurrent.Service$Listener from
> file:/home/yarn/twill2/guava-16.0.1.jar]
> [Loaded java.lang.ClassFormatError from
> /usr/jdk64/jdk1.7.0_45/jre/lib/rt.jar]
> Exception in thread "main" [Loaded
> java.lang.Throwable$PrintStreamOrWriter from
> /usr/jdk64/jdk1.7.0_45/jre/lib/rt.jar]
> [Loaded java.lang.Throwable$WrappedPrintStream from
> /usr/jdk64/jdk1.7.0_45/jre/lib/rt.jar]
> [Loaded java.util.IdentityHashMap from
> /usr/jdk64/jdk1.7.0_45/jre/lib/rt.jar]
> [Loaded java.util.IdentityHashMap$KeySet from
> /usr/jdk64/jdk1.7.0_45/jre/lib/rt.jar]
> java.lang.IncompatibleClassChangeError: Implementing class
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> at
> org.apache.twill.example.yarn.HelloWorld.main(HelloWorld.java:61)
> [Loaded java.lang.Shutdown from /usr/jdk64/jdk1.7.0_45/jre/lib/rt.jar]
> [Loaded java.lang.Shutdown$Lock from
> /usr/jdk64/jdk1.7.0_45/jre/lib/rt.jar]
>
>
> The version in my version of Hadoop is Guava 11.0.2:
>
> $ ls /usr/lib/hadoop/lib/guava*
> /usr/lib/hadoop/lib/guava-11.0.2.jar
>
>
> Has anyone hit this issue with Twill? And how should we resolve it?
>
> -Michael