It seems that the second option should work based on some discussion
earlier:
https://groups.google.com/a/cloudera.org/forum/#!topic/cdh-user/rvjR3oESmdA

But if not too much trouble, I would modify java class to accept that
property value as an argument. It makes it clear how Java main is being
used regardless which client is invoking it.

And then you can utilize workflow's EL function to pass the property value
to java main.
The code snippet would look like this:
------------
            <configuration>
                      <property>
                    <name>hadoop.custom.configuration.file</name>
                    <value>hdfs://
10.1.6.186:8020/configuration/jsonmerger-dev.conf</value>
                </property>
                <property>
                    <name>yyyymmdd</name>
                    <value>20150921</value>
                </property>
            </configuration>
            <main-class>com.housing.common.JSONMerger</main-class>
            <arg>Hello</arg>
            <arg>Oozie!</arg>
            <arg>${wf:conf("hadoop.custom.configuration.file")}</arg>
        </java>
 -----------

notice the added line -
<arg>${wf:conf("hadoop.custom.configuration.file")}</arg>
for java action.

-paul


On Wed, Oct 7, 2015 at 11:05 AM, Jeetendra G <[email protected]>
wrote:

> anyone here?
>
> On Wed, Oct 7, 2015 at 7:50 PM, Jeetendra G <[email protected]>
> wrote:
>
> > how do i get these properties in my code?I am directly say
> > system.get("name") ?
> > or something like below
> >
> > val configurtion = new Configuration(true)
> > configurtion.addResource(new
> Path(System.getProperty("oozie.action.conf.xml")))
> >
> >
> >
> >
> > On Wed, Oct 7, 2015 at 7:18 PM, Jeetendra G <[email protected]>
> > wrote:
> >
> >> Hi All,
> >>
> >> I have create java job with oozie and below is my workflow.xml my job is
> >> not getting the system parameter.
> >> check configuration property below oozie is not passing these to my job.
> >> when I run my job without Oozie it seems to work fine when I pass them
> >> with -Dhadoop.custom.configuration.file
> >>
> >> any idea here?
> >>
> >> *<workflow-app xmlns="uri:oozie:workflow:0.2" name="java-main-wf">*
> >> *    <start to="java-node"/>*
> >> *    <action name="java-node">*
> >> *        <java>*
> >> *            <job-tracker>${jobTracker}</job-tracker>*
> >> *            <name-node>${nameNode}</name-node>*
> >>             <configuration>
> >>                       <property>
> >>                     <name>hadoop.custom.configuration.file</name>
> >>                     <value>hdfs://
> >> 10.1.6.186:8020/configuration/jsonmerger-dev.conf</value>
> >>                 </property>
> >>                 <property>
> >>                     <name>yyyymmdd</name>
> >>                     <value>20150921</value>
> >>                 </property>
> >>             </configuration>
> >> *            <main-class>com.housing.common.JSONMerger</main-class>*
> >> *            <arg>Hello</arg>*
> >> *            <arg>Oozie!</arg>*
> >> *        </java>*
> >> *        <ok to="end"/>*
> >> *        <error to="fail"/>*
> >> *    </action>*
> >> *    <kill name="fail">*
> >> *        <message>Java failed, error
> >> message[${wf:errorMessage(wf:lastErrorNode())}]</message>*
> >> *    </kill>*
> >> *    <end name="end"/>*
> >> *</workflow-app>*
> >>
> >
> >
>

Reply via email to