KNIME 2.12 & Scala plugin

eclipse_knime 2.12 does not work with scala plugin from http://download.scala-ide.org/sdk/e37/scala210/stable/site/

KNIME 2.11 works fine.

Symptoms:

1) there are no any generated class files in a build directory.

2) There is a following error message:

Description    Resource    Path    Location    Type
error while loading NodeLogger, class file 'eclipse_knime_2.12.0/plugins/org.knime.core_2.12.0.0048122/knime-core.jar(org/knime/core/node/NodeLogger.class)' is broken (class java.lang.NullPointerException/null)    RubyScript        Unknown    Scala Problem

 

The problem is stable both for Linux and Windows KNIME 2.12 (tested on OpenSUSE 13.2 x64 and Win7 x64).
Tested with project: https://github.com/rssdev10/ruby4knime/tree/scala/RubyScript

Could this help? It might be a symptom of a transitive dependency in the target platform. Scala does not like that case very much. Have you tried with Scala 2.11? Maybe they improved the error message and based on that the missing dependency can be added to the target platform. (As this is about logging, maybe slf4j needs an implementation to be on the classpath too?)

Hi and thanks. It does not help me. And there is no stable Scala 2.11 plugin for Eclipse 3.7.

I guess something changed or updated in eclipse_knime 2.12. Eclipse_knime 2.11 works without problems. The mentioned above Scala plugin built in 2013. There where no changes and there is no hope that it will updated.

Unfortunately I don't know how to see a compile process for scala in the IDE. Both log files workspace/.log and scala-ide.log does not contain any useful info.

Regarding logging, of course I can switch it from NodeLogger to other logger but I guess it is not a reason of the issue. And by means of NodeLogger I have organized an output to the integrated in KNIME IDE console.

BTW, aborg, I guess the project https://github.com/aborg0/knime_scala_node_wizard is yours? How to do interactive debugging of the KNIME plugin from Eclipse Luna?

Hmm, that is unfortunate. Most probably there is a problem how the 2.12 dependencies are declared. I assume the lack of them in the target does not affect the execution (maybe different code paths are used) and it is not a problem for Java, though it is for Scala (which is more sensitive for a consistent classpath). Unfortunately I cannot promise to find time in the near future to dig deeper. :( I agree, using NodeLogger is the best option currently. I think you do not need to change anything on your code, just add the missing bundle(s) to your target platform (maybe the plugins view can already help spotting possible problems).

You can use other update sites for Scala library (all recent versions are OSGi bundles), you need only the compiler to support the eclipse you are using. You can use eclipse 3.7, or even 4.5 to develop plugins for KNIME 2.12 (though it seems the next version of KNIME will be based on eclipse 4.x, Java8, so there will not be a problem using Scala 2.11 from the KNIME SDK either).

Yes, I wrote Scala node wizard. I am not sure I have done interactive debugging of Scala programs recently. Usually now I only test the plugin to generate working code, but not for node development. :( Customers usually prefer Java and it is a bit hard to set up a continuous (Buckminster-based) environment for Scala projects.

Thanks, gabor

Hello Gabor,

  My purpose of Scala usage in the mentioned above ruby4knime project is an estimation of Scala usage as a language as such and usage of it in deep Java oriented environment. To be honest a coding currently for me is mostly hobby and necessity to feel modern technologies (I’m an associate professor). It is popular now to speak about Scala and I decided to estimate it self because had some time. This project is the only I wrote in Scala. As a result I have following observations:

  • A volume of code in Scala is some less than in Java. But it is not always critical.
  • Functional style of Scala is dirty comparing with Ruby. Ruby is much clear.
  • Functional style of Java 8 in most cases is enough. And Scala is not much better than Java 8 in this case. But of course some clear.
  • Scala loses advantages of collection types and tuples over Java when you must integrate it in Java environment like KNIME. I guess that without interfaces and basic classes adapted for Scala the only place for Scala usage is a logic writing. And there is no place in KNIME’s plugins for the rich object model of Scala. BTW in case of ruby4knime I have decided a problem of Java oriented programming style in scripts by means of dynamic extention of the Java-classes directly in Ruby code.
  • And last disadvantage is an absence of interest of KNIME’s developers to the Scala that we can see in KNIME 2.12.

I not sure what is to do with Ruby4Knime now. Should I save a Java code as a master branch of switch it to Scala branch as I hoped when began this work?....

Best wishes.

Hello,

Here is what I did... Downloaded the 4.1.1 version of ScalaIDE (ok, 4.1.0 and updated to 4.1.1) and set the target platform for my KNIME 2.12 installation. I have downloaded the jruby 9.0.0.0 binary zip file and added it to the lib folder. I have removed the rsyntaxtextarea from the library dependencies, also the org.scalaide.scala-library from the (OSGi) dependencies. I have added the RSyntaxTextArea as a(n OSGi) dependency. Added the Scala Library container (2.11.7) to the RubyScript project. There were some false positive warnings about version incompatibilties with Java dependencies (it thought very old Scala compiled them), so turned off the classpath version validator (Properties for RubyScript, Scala Compiler, Buld Manager, uncheck withVersionClasspathValidator). Now everything compiles. I believe with the following change everything would be better: add the org.scala-lang.scala-library to the target platform (adding its folder is ok) and add the org.scala-lang.scala-library 2.11.7 bundle to the dependencies (in case reflection or actors also used, add them too) and remove the Scala Library Container.

So I cannot reproduce the problem with a newer version of Scala and eclipse. (Though I have not tried to run either.)

I doubt there are any problems in KNIME, probably something in your target platform is not perfectly set up. In case you create a gitter room or something like that for your project, I can try to help setting things up the environment I described. There should not be problems and I think it worth upgrading both eclipse and Scala. For the rest of the discussions about Scala and Java8 are probably off-topic here, feel free to ping me on gitter in case you are curious about my opinion on those topics, though I have to admit I do not know Ruby, so I cannot compare that to anything.

(I would not recommend the old eclipse for any development. Nor KNIME, nor Scala.)

Cheers, gabor

Hello, very thanks. Will try to build it using your recommendations.

Regarding conversations Scala vs other languages ok, it is offtopic, but the opinion about usage of Scala for KNIME plugins development is directly corresponding to the topic.

Best wishes.