Janino Compile Exception : UDJC step

2019-09-19 11:13发布

问题:

Thanks in advance for your support.

In UDJC step, the following code gives me Janino exception,

In processRow method

Hashtable hastable=getConfigData() // This method return Hashtable 

Set set=hashtable.get("ERROR_2001").keySet(); ---> //hashtable.get("ERROR_2001"), This returns another hashtable

Exception: A method named "keySet" is not declared in any enclosing class nor any supertype, nor through a static import

In forums I could not find the turn around solution to fix this. I am using JDK 1.7 and PDI 5.1 (latest download)

回答1:

AFAIK, you can't use generics in Janino, so Janino can not determine exact class of the object returned by hashtable.get("ERROR_2001") method, so it assumes that Object is returned, which has no keySet() method defined. Try to cast the result of hashtable.get("ERROR_2001") to the value class, contained in your hashtable collection:

Hashtable errorEntry = (Hashtable) hashtable.get("ERROR_2001");
Set set = errorEntry.keySet(); 


标签: pentaho etl