Topic
4 replies Latest Post - ‏2012-11-30T09:10:51Z by SystemAdmin
SystemAdmin
SystemAdmin
6184 Posts
ACCEPTED ANSWER

Pinned topic Executing Java program from WTX map rule

‏2012-11-28T04:29:53Z |
Hello All,

I am trying to execute a java program (jar file) from a WTX 8.3 map using function JEXIT in map rule. The Java program produces 4 outputs against an input. Map execution is sometime producting 4 outputs and sometimes 2 outputs for the same input set up. Java program is thowing some exception while it is not able to produce 2 outputs.

I have pasted the log below.

Please note that command prompt (in DOS) execution of the java program (a jar file) is always producing 4 outputs.

Could you please advise if this is something to do with any specific set up in map.
Thanks,
Debnarayan

Called callerMethod() | XML parsed | Output 1 created : output1.txt | Output 2 created : output2.txtjava.lang.NullPointerException
at testjar.TestJarData.processOutput3(TestJarData.java:650)
at testjar.TestJarData.callerMethod(TestJarData.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at com.ibm.websphere.dtx.dtxpi.MDispatchFunction.run(Unknown Source)
at com.ibm.websphere.dtx.dtxpi.MDispatchFunction.Dispatch(Unknown Source)
at com.ibm.websphere.dtx.runmerc.RunMerc.RunMap(Native Method)
at com.ibm.webshere.dtx.ui.eclipsebridge.RunMercAbstraction.RunMap(Unknown Source)
at com.ibm.websphere.dtx.ui.me.editors.MapEditDoc.RunMaps(Unknown Source)
at com.ibm.websphere.dtx.ui.me.editors.MapEditDoc.RunMaps(Unknown Source)
at com.ibm.websphere.dtx.ui.me.tree.MapNode.OnRunMap(Unknown Source)
at com.ibm.websphere.dtx.ui.me.menus.RunMapMenu.run(Unknown Source)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3840)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3439)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Updated on 2012-11-30T09:10:51Z at 2012-11-30T09:10:51Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    6184 Posts
    ACCEPTED ANSWER

    Re: Executing Java program from WTX map rule

    ‏2012-11-28T09:27:05Z  in response to SystemAdmin
    If, for the same exact conditions,the JAva works fine from the command line (same exact conditions = same input, settings, etc..., down to the deepest detail) then this may have to do with the map.

    However, the exception is a Null pointer exception, so my first guess if I was encountering the same issue would be that my Java code has a problem.
    • SystemAdmin
      SystemAdmin
      6184 Posts
      ACCEPTED ANSWER

      Re: Executing Java program from WTX map rule

      ‏2012-11-29T05:49:28Z  in response to SystemAdmin
      Yes Laurent(Satisco). Java program is same. I got a jar file.

      Once, I tried to run the jar file from map rule. It is inconsistent.
      Then, I tried to run the jar file directly (not a command line execution of the map executable file) from command prompt and it is running consistently.

      java -jar testjar.jar <input file name as parameter>
      • SystemAdmin
        SystemAdmin
        6184 Posts
        ACCEPTED ANSWER

        Re: Executing Java program from WTX map rule

        ‏2012-11-29T08:22:35Z  in response to SystemAdmin
        what does the mapping rule look like ?
        If the java program is reading a file, is it a file the map accesses previously ?

        Understanding the purpose of the Java program might help.
        • SystemAdmin
          SystemAdmin
          6184 Posts
          ACCEPTED ANSWER

          Re: Executing Java program from WTX map rule

          ‏2012-11-30T09:10:51Z  in response to SystemAdmin
          Hi Laurent(Satisco),

          I have written below map rule:

          =VALID(
          JEXIT("testjar.testData", "callerMethod", input_filename),
          FAIL(LASTERRORMSG( ) + " " + LASTERRORCODE( ))
          )

          Yes, map accesses an input file and passes the file name with physical path to the Java program. The Java program reads the given input file and produces 4 output files.

          PageSize is set to 64K and PageCount is set to 20 in the map.

          The problem of not generating all outputs is consistent (producsing only first 2 outputs) for bigger input files.

          Please let me know if any other information is needed.

          Thanks a bunch for all your adivses.
          Thanks,
          Debnaryan