Page tree

Versions Compared

Key

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

...

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, etc.

Put a Main in your java class that runs the same code as is being runned via ECL. Try calling the jar file from the command line on the HPCC Cluster. (java -cp /opt/HPCCSystems/classes/myjava.jar ). Chances are you'll see the same error. If you do, debug the java from here; if the error only occurs when running from ECL, raise an issue at http://track.hpccsystems.com

3. You get a java.lang.NoClassDefFoundError , etc.

 

2. error when running your Java from ECL; the error doesn't occur when running the same java from the command line.

In one case, where java code was creating an instance of Jboss Drool's specific classes, this error popped up because the contextClassLoader was null. Adding the following code to the Java class fixed the error.

                 if(Thread.currentThread().getContextClassLoader() == null)
                    { Thread.currentThread().setContextClassLoader(String.class.getClassLoader()); } 

More details are in this ticket:

Jira
serverHPCC
serverIddd31125a-2765-3c6f-bcf5-4c7e6f8192d5
keyHPCC-10204

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

...

Code Block
import java;
STRING segment() := IMPORT(java,'org/hpccsystems/Segmenter.SegmentText:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;');
STRING clearcache() := IMPORT(java,'org/hpccsystems/Segmenter.ClearCache:(Ljava/lang/Boolean)Ljava/lang/String;');

SEQUENTIAL(output(segment('text to segment')),
           output(clearcache(true))
)

 

 

 

 

 

6. THE END

...

You can also view additional java-related HPCC issues that have occurred in JIRA or raise an issue at http://track.hpccsystems.com

...

to get help resolving a java issue.

A simple Java Integration example

...