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

Creation of Script Engine Fails with Open JDK11 : java.lang.NoSuchFieldError: O_TMPFILE #5334

Open
nmondal opened this issue Sep 29, 2018 · 1 comment

Comments

@nmondal
Copy link

nmondal commented Sep 29, 2018

Environment

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
    jruby-9.2.0.0
  • Operating system and platform (e.g. uname -a)
    Mac OS X - 10.13.6 High Sierra - Open JDK 11
    Other relevant info you may wish to add:
  • Installed or activated gems
  • Application/framework version (e.g. Rails, Sinatra)
  • Environment variables

Expected Behavior

  • ScriptEngine should be created

Actual Behavior

  • The error log is shown below.
Exception in thread "main" java.lang.NoSuchFieldError: O_TMPFILE
	at org.jruby.RubyFile.createFileClass(RubyFile.java:204)
	at org.jruby.Ruby.initCore(Ruby.java:1547)
	at org.jruby.Ruby.bootstrap(Ruby.java:1318)
	at org.jruby.Ruby.init(Ruby.java:1217)
	at org.jruby.Ruby.newInstance(Ruby.java:362)
	at org.jruby.embed.internal.AbstractLocalContextProvider.getGlobalRuntime(AbstractLocalContextProvider.java:82)
	at org.jruby.embed.internal.SingletonLocalContextProvider.getRuntime(SingletonLocalContextProvider.java:99)
	at org.jruby.embed.internal.EmbedRubyRuntimeAdapterImpl.runParser(EmbedRubyRuntimeAdapterImpl.java:167)
	at org.jruby.embed.internal.EmbedRubyRuntimeAdapterImpl.parse(EmbedRubyRuntimeAdapterImpl.java:94)
	at org.jruby.embed.ScriptingContainer.parse(ScriptingContainer.java:1227)
	at org.jruby.embed.jsr223.JRubyCompiledScript.<init>(JRubyCompiledScript.java:59)
	at org.jruby.embed.jsr223.JRubyEngine.compile(JRubyEngine.java:69)

@nmondal nmondal changed the title Creation of Script Engine Fails with Open JDK11 Creation of Script Engine Fails with Open JDK11 : java.lang.NoSuchFieldError: O_TMPFILE Sep 29, 2018
@headius
Copy link
Member

headius commented Oct 9, 2018

@nmondal Can you provide a simple example? JRuby appears to start up find under Java 11 from the command line, so it may be something related to how you're using the JSR-223 engine.

kaladay added a commit to TAMULib/mod-camunda that referenced this issue Aug 13, 2019
A Java utility (ScriptEngineUtility) is provided to share functionality between the scripts.
This functionality is written in Java, which essentially allows the scripts to execute Java code without having to actually be Java.

The arguments passed to and return results passed from the scripts are expected to be in JSON string format.
The ScriptEngineUtility should be used to convert to/from the JSON string to a JSON object for the script to process.

Two new exceptions are provided:
- ScriptEngineUnsupported = Error when the language (by file extension) is not available in the ScriptEngineType enum.
- ScriptEngineLoadFailed = Error when the engine does not exist (module is not added to the pom.xml or something went wrong while loading).

A pre-processor is added for handling the passed scripts.
This is necessary namely for Python, which must have the correct number of spaces/tabs prepended to it.
Currently, this is set to two spaces (both the engine.py and the pre-process method must have the same design).
Other languages can potentially utilize this pre-processor, but only Python currently gets pre-processed.

The engine.* resource files (such as engine.js) provide the engine template.
The util.* resource files (such as util.js) provide additional utilities that are language dependent and therefore are not available in the ScriptEngineUtility.

The following languages are supported:
- Javascript (.js)
- Java (.java)
- Python (.py)
- Groovy (.groovy)

The following languages could be supported, if problems are resolved:
- Ruby (.rb) (via JRuby)
- Perl (.pl) (via Rakudo)

Ruby is currently not working due to `java.lang.NoSuchFieldError: O_TMPFILE`.
More research is needed and an upstream bugreport is referenced below.

Perl could potentially be made to work via Rakudo, but is there a maven repository to add to the pom.xml?

The engine.rb and engine.pl are stubbed out and have not been tested.
Once the languages are imported and working properly, those engine.* files may need to be updated.

see: jruby/jruby#5334
see: https://rakudo.org/
pmioulet added a commit to pmioulet/rivescript-java that referenced this issue Oct 21, 2019
Python support was added using jython.

JNR version was forced to the jruby version to avoid this issue:
jruby/jruby#5334
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants