I recently committed something that can serve as a workaround for this,
when I was trying to get Presto running with Twill. Presto was using Guava
16 which was incompatible with Twill's Guava 13.

You can take a look at BundledJarRunnable available in the 0.2.0-incubating
release (sample
usage<https://git-wip-us.apache.org/repos/asf?p=incubator-twill.git;a=blob;f=twill-examples/yarn/src/main/java/org/apache/twill/example/yarn/BundledJarExample.java;h=3cc88a1b7624270c2d870c8a249185d608b09613;hb=d4a352de4a62abdf4607af77d610597630e0ee1a>).
It's currently very limited in terms of functionality, but you can use it
to run an application without having to worry about Twill's classpath. You
can specify a bundle jar file, folder containing the dependencies within
the jar file, main class name, and arguments to send to the main method.

The BundledJarRunnable will load the jars in the folder containing the
dependencies and also the bundle jar into a clean classloader, so it won't
conflict with Twill's dependencies. To use this, do the following:

1. Package your program into a bundle jar. I used the following in my
pom.xml:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Embed-Dependency>*;inline=false</Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>
                        <Embed-Directory>lib</Embed-Directory>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

2. Configure your TwillApplication to include a BundledJarRunnable() and
the jar file:
...withRunnable().add("Test123", new
BundledJarRunnable()).withLocalFiles().add("sdf.jar", localJarURI, false)

3. Configure your TwillPreparer to pass runtime arguments (main class name,
main method args, etc.) to your runnable:

    BundledJarRunner.Arguments arguments = new
BundledJarRunner.Arguments.Builder()
      .set ...
      ...
      .build();

    final TwillController controller = twillRunner.prepare(
      new ExampleBundledJarApp()
      .withArguments("Test123", arguments.toArray())
      .addLogHandler(new PrinterLogHandler(new PrintWriter(System.out,
true)))
      .start();

--

Let me know if you have any questions.

Alvin


On Tue, Apr 1, 2014 at 3:01 AM, aakash aakash <[email protected]>wrote:

> Hi,
>
> I am trying to start a rest web service on hadoop using Twill, but
> unfortunately jersey use asm 3.1  but in Twill we use asm 4 and source is
> also different.  Which is now a big problem for me.
>
> Is there any workaround for this. Any help will be highly appreciated.
>
> Thanks,
> Aakash
>

Reply via email to