Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To pass complex data from a Java class, the best practice is to pass it as an xml or otherwise encoded/delimited string, and then break the xml/delimited fields into separate fields for processing. Check the simple Java Integration sample below for an example of how to turn an xml string returned from a java class into a dataset. An additional example can be found at https://github.com/hpcc-systems/TextAnalytics/blob/master/hpcc/ecl/medex/BWR_MedexDrugSignatures.ecl

Troubleshooting

  1. You can run the sample java, but get a class not found error when you try to run yours.

This is because HPCC can't find your jar or class in its classpath. First things to check:

...

              "javaembed: Setting JVM Option: -Djava.class.path=/opt/HPCCSystems/classes:/opt/HPCCSystems/classes/myjava.jar:."

If you do not see any entries like this in any of the HPCC logs, the JVM is not starting up for some reason.

If you do see this entry in the HPCC logs and your jar is included in the classpath, the error is either a) in the import statement syntax in ECL or b) an internal error in your java code causing the problem.

2. You get unexpected errors when running your java in ECL: java.lang.ExceptionInInitializerError, java.lang.NoClassDefFoundError, etc.

 

2. You try running your java, and get an out of memory or heapspace error.

...

Alternately, if your java plugin requires a large amount of data loaded in memory (such as lexicons, etc. needed by Natural Language Processing java jars), you can add a method to your java jar class to clear out cached data after a process is run so that it does not continue to take up space in the Java heap. For example:

...