Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 64

Thread: Specifying a JobJar in the Tool Tasklet.

  1. #11

    Default

    I am actually specifying the classname.

  2. #12
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Hi David,

    I've updated the tool support so now a jar file (not available on the classpath) can be specified - the loading process is done on a separate classloader so multiple versions and libraries can be used:

    Code:
    <hdp:tool-runner id="tool-jar" tool-class="test.SomeTool" jar="some-tool.jar"/>
    Note that currently we don't do any copying or unpacking of the jar so things like nested /libs or /classes won't work - I'll add support for these (legacy) formats after (Ortodox) Easter. Feedback is welcome - also the structure of your jars is useful.

    Cheers,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #13

    Default

    Hi Costin,

    Thanks for looking into this.

    Can I get the latest artifact from somewhere?

    Regarding your question about our jar structure: it doesn't have any nested libs, so it only has META-INF directory and compiled classes in the corresponding package directories.

    Sincerely,
    David

  4. #14
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Of course, see [1]. Simply add the snapshot repo in your gradle/maven build and all of SHDP version and its dependencies (including non-SpringSource) will be downloaded from there.

    [1] http://www.springsource.org/spring-data/hadoop#maven
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  5. #15

    Default

    Thanks Costin,

    I downloaded the latest snapshot version and found one issue.

    Seems that you have removed Scope parameter from the latest version.
    This parameter is required for our cases, since we are constructing arguments based on the jobParameters and these values are returned only in case scope="step" for the tasklet.
    See an example of tasklet that uses "jobParameters".

    Code:
    <hdp:tool-tasklet id="taskletId" scope="step" configuration-ref="hadoop-configuration" tool-class="SomeClass">
            <hdp:arg value="${propertyVal1}#{jobParameters['RUN_ID']}${propertyVal2}"/>
    </hdp:tool-tasklet>
    Sincerely,
    David

  6. #16
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    That was probably an unintended modification (though I don't recall scope being exposed). You should however still be able to use it through the beans namespace (beans XML that is):

    <bean class="org.springframework.data.hadoop.mapreduce.T oolTasklet" scope="step" p:tool-class="SomeClass" p:configuration-ref=""/>

    I'll fix the scope tomorrow morning (my time) but I'm interested to see whether the classloader update fixes your core issue.

    Cheers,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  7. #17

    Default

    Thanks Costin,

    I tried to specify the jar's relative and full paths, but none of them worked.
    Here is the bean definition:

    Code:
        <beans:bean id="test_hadoopTasklet" class="org.springframework.data.hadoop.mapreduce.ToolTasklet" scope="step"
                p:tool-class="${test_tool_class}"
                p:jar="test-jobjar.jar"
                p:configuration-ref="hadoop-configuration">
                <beans:property name="arguments">
                    <beans:list>
                        <beans:value>${value1}</beans:value>
                        <beans:value>${value2}</beans:value>
                        <beans:value>${part1}#{jobParameters['RUN_ID']}${part2}</beans:value>
                        <beans:value>${part3}#{jobParameters['RUN_ID']}${part4}</beans:value>
                    </beans:list>
               </beans:property>
        </beans:bean>
    The following exception is being thrown:

    org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Class' for property 'toolClass'; nested exception is java.lang.IllegalArgumentException: Cannot find class [package.ClassName] at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean
    Please let me know if I am doing something wrong.


    Sincerely,
    David

  8. #18
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Are you sure you're using the latest 1.0.0.BUILD-SNAPSHOT? Can you post the name of the artifact? toolClass is not a class anymore but a String so there shouldn't be any conversion error.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  9. #19
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Pushed an update which adds support for nested libraries (legacy jars). The latest snapshot is [1] 1.0.0.BUILD-20120417.114024-66.jar

    [1] http://repo.springsource.org/webapp/...ng-data-hadoop
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  10. #20
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    And another update - the scope attribute is still there for tool-tasklet. That is, assuming you are using the correct SNAPSHOT (as mentioned above).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •