Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Possible to upgrade Janino to support newer java versions?

  1. #1
    Join Date
    Aug 2016
    Posts
    289

    Default Possible to upgrade Janino to support newer java versions?

    For my Kettle version, it seems the included janino version only supports java 1.4 syntax.

    Is it possible to upgrade the janino version to support wider/newer java language?

    According to this link I get the impression janino has been developed to support more than I have available in User Defined Java Step at the moment:
    https://janino-compiler.github.io/janino/

    I was able to just replace the "janino-2.5.16.jar" with "janino-3.0.8.jar". I also added an additional dependency for the new janino version "commons-compiler-3.0.8.jar".

    However, the text validation now gives an exception:

    Unable to open dialog for this step
    java.lang.NoClassDefFoundError: org/codehaus/janino/CompileException
    at org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassMeta.cookClasses(UserDefinedJavaClassMeta.java:152)
    at org.pentaho.di.ui.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDialog.test(UserDefinedJavaClassDialog.java:1298)
    at org.pentaho.di.ui.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDialog.access$200(UserDefinedJavaClassDialog.java:121)
    at org.pentaho.di.ui.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDialog$3.handleEvent(UserDefinedJavaClassDialog.java:408)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDialog.open(UserDefinedJavaClassDialog.java:575)
    at org.pentaho.di.ui.spoon.delegates.SpoonStepsDelegate.editStep(SpoonStepsDelegate.java:124)
    at org.pentaho.di.ui.spoon.Spoon.editStep(Spoon.java:8712)
    at org.pentaho.di.ui.spoon.trans.TransGraph.editStep(TransGraph.java:3061)
    at org.pentaho.di.ui.spoon.trans.TransGraph.mouseDoubleClick(TransGraph.java:747)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1319)
    at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7939)
    at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9190)
    at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:654)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)
    Caused by: java.lang.ClassNotFoundException: org.codehaus.janino.CompileException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 27 more
    So I would like to get the usefull error messages about what exactly is wrong and on which line it is wrong.

    Any ideas?
    Last edited by Sparkles; 04-18-2018 at 09:07 AM.

  2. #2
    Join Date
    Aug 2016
    Posts
    289

    Default

    According to this post: http://drools-moved.46999.n3.nabble....td4022772.html
    It seems like "org/codehaus/janino/CompileException" is moved to "org.codehaus.commons.compiler.CompileException". How can I set this change in affect for Spoon/Kettle?

    Even the latest pdi does have the same old janino version. Why hasn't this been updated?

    Looking at the source code, it seems like the imports need to be changed from "
    import org.codehaus.janino.CompileException;" to "import org.codehaus.commons.compiler.CompileException;", then the source code needs to be compiled again...

    Is this even realistic to do by ones self? Would it be easier to make a new plugin, extend the User Defined Java Class step and import new janino and CompileException from there, then override some methods?

    Example of source code for UDJC:
    https://www.programcreek.com/java-api-examples/?code=pentaho/pentaho-kettle/pentaho-kettle-master/engine/src/main/java/org/pentaho/di/trans/steps/userdefinedjavaclass/UserDefinedJavaClassMeta.java
    Janino versions:
    https://janino-compiler.github.io/janino/changelog.html
    Download janino:
    https://jar-download.com/?search_box=janino
    Last edited by Sparkles; 04-18-2018 at 11:16 AM.

  3. #3

    Default

    There's an improvement request to have this step updated to the latest Janino version: https://jira.pentaho.com/browse/PDI-16772

    I'd love very much just to have an enhanced for loop in the UDJC step.

  4. #4
    Join Date
    Aug 2016
    Posts
    289

    Default

    Oh yes using iterators is just a pain compared to a simple colon!

    I don't imagine it would be too much work, maybe even just a single new import. As mentioned, I tried just replacing the janino jar with the newer ones, and it seemed to work, except you get an exception instead of detailed message when the code is incorrect. If janino didn't split error message into a separate jar, perhaps it would just work replacing the jar...
    Last edited by Sparkles; 04-24-2018 at 11:36 AM.

  5. #5

    Default

    Looks like it was just updated today in the master branch, so it should hopefully be in the next minor/major release.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.