Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Interface in JRuby for JDK11 #5797

Syed-SnapLogic opened this issue Jul 23, 2019 · 1 comment


Copy link

commented Jul 23, 2019

I am using JRuby on Ubuntu 18.04 64 bit with JDK11.

Can you show me an example of ruby script where we are implementing a java interface and invoking initialize method?

I have following script but in initialize method, the values are of type NilClass.

class MyScript
    # Import the interface required by the Script snap.
    include com.snaplogic.scripting.language.ScriptHook
    attr_reader :log, :input, :output, :error
    def initialize(log, input, output, error)
        # above line outputs NilClass; how to fix it?
        @log = log
        @input = input
        @output = output
        @error = error

    # The "execute()" method is called once when the pipeline is started
    # and allowed to process its inputs or just send data to its outputs.
    def execute()
        while input.hasNext() do
                # Read the next document, wrap it in a map and write out the wrapper
                doc =
                wrapper = {
                 "original" => doc
      "Executed Ruby script")
                output.write(doc, wrapper)
            rescue => e
                log.error("Bad Rublet " + e.message)
                errWrapper = {
                    "errMsg" => e.message

# The Script Snap will look for a ScriptHook object in the "hook"
# variable.  The snap will then call the hook's "execute" method.
$hook =$log, $input, $output, $error)

This comment has been minimized.

Copy link

commented Jul 23, 2019

@Syed-SnapLogic Are you sure $input being passed into .new is not nil? Can you print out its value before to make sure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.