JRuby java.lang.ClassCastException - jruby

I used a little Jruby script from http://www.javaworld.com/javaworld/jw-07-2006/jw-0717-ruby.html to test invokedynamic:
class ADuck
def quack()
puts "quack A";
end
end
class BDuck
def quack()
puts "quack B";
end
end
def quack_it(duck)
duck.quack
end
a = ADuck.new
b = BDuck.new
quack_it(a)
quack_it(b)
But when I compile in with JRuby to Java classfiles and then try to execute it I get the following exception:
Java HotSpot(TM) 64-Bit Server VM warning: Use -XX:+UnlockDiagnosticVMOptions be
fore EnableInvokeDynamic flag
Exception in thread "main" java.lang.ClassCastException: java.lang.Object cannot
be cast to java.lang.invoke.SwitchPoint
at org.jruby.runtime.invokedynamic.InvokeDynamicSupport.constantFallback
(InvokeDynamicSupport.java:659)
at duck_typing.__file__(duck_typing.rb:22)
at duck_typing.load(duck_typing.rb)
at duck_typing.main(duck_typing.rb)
My system: JDK 1.7.0_09 64bit on Windows 7 64bit, JRuby 1.7.2
Used commandlines:
jruby -Xcompile.invokedynamic=true -S jrubyc duck_typing.rb
java -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp .;jruby-complete-1.7.2.jar duck_typing
A while ago I tested it on linux machine with same results and on Windows jdk8.
With JDK8 it worked, but gave me problems using the classfiles in another project.
Has anyone a idee how to fix it?
How can I use JRuby with indy on Java 7?

Except for the JRuby convenience parameter --server, all JVM runtime
parameters use the -J option, followed by the specific JVM setting.
For example:
Heap space settings: jruby -J-X
JRuby runtime settings: jruby -J-D
All the settings described in the following sections are JVM settings.
https://github.com/jruby/jruby/wiki/PerformanceTuning
try this instead
jruby -J-Xcompile.invokedynamic=true -S jrubyc duck_typing.rb

Related

Shadow cljs doesn’t see java on Macbook M1

I used npx create-cljs-project my-app and revived error when I tried to start with npm start
I have tried few java ask version, but I get same error anyway.
shadow-cljs - config: /Users/tomaszsikora/dev/my-app/shadow-cljs.edn
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2398).
Can't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna1171015707293329039.tmp
Full report at:
/var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/clojure-11795200488797552517.edn
and it starts like this, but it's too long to paste here.
{:clojure.main/message
"Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2398).\nCan't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna14133068692257536681.tmp\n",
:clojure.main/triage
{:clojure.error/class java.lang.UnsatisfiedLinkError,
:clojure.error/line 2398,
:clojure.error/cause
"Can't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna14133068692257536681.tmp",
:clojure.error/symbol java.lang.ClassLoader/loadLibrary,
:clojure.error/source "ClassLoader.java",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type java.lang.UnsatisfiedLinkError,
:message
"Can't load library: /var/folders/x7/k_6f989d60z2k0pz_cz_3y_40000gn/T/jna14133068692257536681.tmp",
:at [java.lang.ClassLoader loadLibrary "ClassLoader.java" 2398]}],
:trace
java version
tomaszsikora#DeadBook-Void my-app % java --version
openjdk 18.0.2.1 2022-08-18
OpenJDK Runtime Environment Homebrew (build 18.0.2.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 18.0.2.1+0, mixed mode, sharing)

Jruby version suitable for OpenJDK 8 (Zulu JDK)

I am looking for an advisable version of JRuby that supports OpenJDK-8 (Zulu-JDK) to run on a Rails project.
Rails version- 4.0.13.
All versions of JRuby since version 9.2.0.0 will run on JDK 8. Since Zulu 8 is a build of OpenJDK 8 that means any appropriate JRuby version will run on Zulu 8.
Follow up question (using answer section to get better code formatting then commenting on the answer above).
I'm trying to get JRuby > 9.2.0.0 running Zulu 8 for MacOS ARM 64-bit (M1 chip).
I did a reinstall of the JRuby versions after installing that JDK.
$ rvm list
jruby-1.7.27 [ x86_64 ]
=> jruby-9.2.13.0 [ aarch64 ]
Check ruby version and try irb:
$ ruby -v
jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc OpenJDK 64-Bit Server VM 25.302-b08 on 1.8.0_302-b08 +jit [darwin-aarch64]
$ irb
NotImplementedError: fstat unimplemented unsupported or native support failed to load; see https://github.com/jruby/jruby/wiki/Native-Libraries
initialize at org/jruby/RubyIO.java:1015
open at org/jruby/RubyIO.java:1156
initialize at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb/input-method.rb:141
initialize at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb/context.rb:70
initialize at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb.rb:410
start at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/irb.rb:381
<main> at /Users/rrickerts/.rvm/rubies/jruby-9.2.13.0/bin/irb:13

How to fix Kotlin REPL exception NoClassDefFoundError

I'm attempting to run the Kotlin REPL on my windows 10 machine, from the command line. I am receiving a java.lang.NoClassDefFoundError: org/jline/reader/LineReaderBuilder exception when running the command kotlinc
I have IntelliJ Ultimate 2019.1.3 installed, with the Kotlin plugin. I have the Kotlin standalone compiler also installed and I've added that location to my system path. I've tried to run the command from the standalone directory: "C:/Tools/kotlinc/bin" but no difference.
OS Name: Microsoft Windows 10 Enterprise
Version 10.0.16299 Build 16299
Kotlin version 1.3.40-release-123 (JRE 1.8.0_131-b11)
java version "1.8.0_131"
I expect the REPL to start without an exception. What could be causing the exception?
Thank you all!
It looks like that was a bug and it has been fixed with Kotlin plugin & kotlinc version 1.3.41 (released today).

Why isn't this SalesforceCanvasFrameworkSDK “Hello World” application for SFDC Canvas working?

Currently I'm looking in the Force.com Canvas Developer's Guide at "Chapter 3: Quick Start--Advanced".
I've successfully cloned SalesforceCanvasFrameworkSDK from GitHub, and am now trying to Run the Web App Locally.
The build is successful and keystore has been created. However, when I execute target\bin\webapp.bat, I get the following error:
Error: Could not find or load main class Main
Find that the main class seems to be in C:\SalesforceCanvasFrameworkSDK\target\classes, I modified the .bat file, to include this in the CLASSPATH:
set CLASSPATH="C:\SalesforceCanvasFrameworkSDK\target\classes;%BASEDIR%"\etc;"%REPO%"\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;"%REPO%"\org\mortbay\jetty\jsp-2.1-glassfish\2.1.v20100127\jsp-2.1-glassfish-2.1.v20100127.jar;"%REPO%"\org\eclipse\jdt\core\compiler\ecj\3.5.1\ecj-3.5.1.jar;"%REPO%"\org\mortbay\jetty\jsp-api-2.1-glassfish\2.1.v20100127\jsp-api-2.1-glassfish-2.1.v20100127.jar;"%REPO%"\ant\ant\1.6.5\ant-1.6.5.jar;"%REPO%"\org\codehaus\jackson\jackson-mapper-asl\1.9.0\jackson-mapper-asl-1.9.0.jar;"%REPO%"\org\codehaus\jackson\jackson-core-asl\1.9.0\jackson-core-asl-1.9.0.jar;"%REPO%"\org\eclipse\jetty\jetty-webapp\7.6.0.v20120127\jetty-webapp-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-xml\7.6.0.v20120127\jetty-xml-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-util\7.6.0.v20120127\jetty-util-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-servlet\7.6.0.v20120127\jetty-servlet-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-security\7.6.0.v20120127\jetty-security-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-server\7.6.0.v20120127\jetty-server-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-continuation\7.6.0.v20120127\jetty-continuation-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-http\7.6.0.v20120127\jetty-http-7.6.0.v20120127.jar;"%REPO%"\org\eclipse\jetty\jetty-io\7.6.0.v20120127\jetty-io-7.6.0.v20120127.jar;"%REPO%"\asm\asm\3.2\asm-3.2.jar;"%REPO%"\org\json\json\20080701\json-20080701.jar;"%REPO%"\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;"%REPO%"\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar;"%REPO%"\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;"%REPO%"\sfdc\sfdc-canvas-sdk\1.0-SNAPSHOT\sfdc-canvas-sdk-1.0-SNAPSHOT.jar
This enables the batch file to execute and initiate Jetty.
However, when I attempt to visit https://localhost:8443/examples/hello-world/index.jsp, after getting past the browser warning message, I get an HTTP ERROR 500 page:
HTTP ERROR 500
Problem accessing /examples/hello-world/index.jsp. Reason:
PWC6033: Unable to compile class for JSP
PWC6199: Generated servlet error: The type java.util.Map$Entry cannot
be resolved. It is indirectly referenced from required .class files
Caused by:
org.apache.jasper.JasperException: PWC6033: Unable to compile class
for JSP
PWC6199: Generated servlet error: The type java.util.Map$Entry cannot
be resolved. It is indirectly referenced from required .class files
at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:123)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:296)
at
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:376)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:437) at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:360)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349) at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
at
org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:910)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at
org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at
org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at
org.eclipse.jetty.server.ssl.SslSocketConnector$SslConnectorEndPoint.run(SslSocketConnector.java:665)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:745) Powered by Jetty://
Concurrently, my Jetty server dies with:
ERROR: Compilation error
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.(ClassFileReader.java:372)
at org.apache.jasper.compiler.JDTJavaCompiler$1.findType(JDTJavaCompiler.java:367)
at org.apache.jasper.compiler.JDTJavaCompiler$1.findType(JDTJavaCompiler.java:324)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102)
at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromVariantTypeSignature(LookupEnvironment.java
:1244)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArgumentsFromSignature(LookupEnvironment.java:1
031)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1193)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethod(BinaryTypeBinding.java:495)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethods(BinaryTypeBinding.java:577)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:327)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619)
at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:133)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:183)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:465)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:519)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(CompilationUnitScope.java:368)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:444)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:752)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
at org.apache.jasper.compiler.JDTJavaCompiler.compile(JDTJavaCompiler.java:503)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:368)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:360)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:910)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.eclipse.jetty.server.ssl.SslSocketConnector$SslConnectorEndPoint.run(SslSocketConnector.java:665)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:745) ERROR: Error compiling file:
C:\Users\Brian_Kessler#epam.com\AppData\Local\Temp\jetty-0.0.0.0-8443-webapp-_-any-\jsp\org\apa
che\jsp\examples\hello_002dworld\index_jsp.java 2014-12-11
15:35:48.106:WARN:oejs.ServletHandler:/examples/hello-world/index.jsp
org.apache.jasper.JasperException: PWC6033: Unable to compile class
for JSP||PWC6199: Generated servlet error:|The type java
.util.Map$Entry cannot be resolved. It is indirectly referenced from
required .class files||
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:123)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:296)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:376)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:360)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:910)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.eclipse.jetty.server.ssl.SslSocketConnector$SslConnectorEndPoint.run(SslSocketConnector.java:665)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:745)
If it is relevant:
OS: Windows 7
Java: 1.8.0_25
Maven: 3.2.2
Any help to resolve this will be appreciated!
I was able to fix this as follows on MacOS Sierra 10.13.6
The problem does seem to be with Java 8, so if you can start the whole installation with Java 7, you'll save a lot of time. In my case, I had already installed Java 8, so I had to do the following:
1- Install java 7 from: https://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html . You have to create an Oracle account, it's free.
2- Confirm both versions of java are runningv
Pablos-MacBook-Pro:SalesforceCanvasFrameworkSDK pabloalvarez$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
1.8.0_191, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
1.7.0_80, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
3- Then
export JAVA_HOME=`/usr/libexec/java_home -v 1.7.0_80`
export JAVACMD=`/usr/libexec/java_home -v 1.7.0_80`
Confirm that Java 7 is the default version now
Pablos-MacBook-Pro:SalesforceCanvasFrameworkSDK pabloalvarez$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
5- Then
export JAVACMD=/usr/bin/java
6- Finally
Pablos-MacBook-Pro:SalesforceCanvasFrameworkSDK pabloalvarez$ sh target/bin/webapp
Looks like we are NOT running on heroku.
2019-01-14 10:54:48.557:INFO:oejs.Server:jetty-7.6.0.v20120127
2019-01-14 10:54:48.863:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/Users/pabloalvarez/SalesforceCanvasFrameworkSDK/src/main/webapp/}
2019-01-14 10:54:49.252:INFO:oejus.SslContextFactory:Enabled Protocols [SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2] of [SSLv2Hello, SSLv3, TLSv1, TLSv1.1, TLSv1.2]
Good luck!

java.lang.IllegalAccessException: no such method: rubyjit.<name>Serializer$$_fast_attributes

Seeing this error quite frequently.
Jruby 1.7.13
Ubuntu 14.
Sun Java 8 _05
ps -ef command for the process:
java -Xmx786m -Xss2048k -Djffi.boot.library.path=/home/ubuntu/server/tools/jruby/lib/jni -Xmn128m -server -Xbootclasspath/a:/home/ubuntu/server/tools/jruby/lib/jruby.jar -classpath : -Djruby.home=/home/ubuntu/server/tools/jruby -Djruby.lib=/home/ubuntu/server/tools/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main bin/rails s -p4005 -e production
Any idea what is causing that error infrequently.
Java::JavaLang::RuntimeException (com.headius.invokebinder.InvalidTransformException: java.lang.IllegalAccessException: no such method: rubyjit.ContactSerializer$$fast_attributes_a0671ee9e02931c7660594220ffed4d4fc58cad5681842940.__file_(ContactSerializer$$fast_attributes_a0671ee9e02931c7660594220ffed4d4fc58cad5681842940,ThreadContext,IRubyObject,Block)IRubyObject/invokeStatic):
org.jruby.runtime.invokedynamic.InvocationLinker.createRubyHandle(InvocationLinker.java:1689)
org.jruby.runtime.invokedynamic.InvocationLinker.access$900(InvocationLinker.java:75)
org.jruby.runtime.invokedynamic.InvocationLinker$RubyCallGenerator.generate(InvocationLinker.java:715)
org.jruby.runtime.invokedynamic.InvocationLinker.tryDispatchDirect(InvocationLinker.java:765)
org.jruby.runtime.invokedynamic.InvocationLinker.getTarget(InvocationLinker.java:775)
org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(InvocationLinker.java:137)
rubyjit.ActiveModel::Serializer$$attributes_dbeb427ba2b0518d676c0a687aeb474a438bbc8b681842940.chained_0_rescue_1$RUBY$SYNTHETIC__file_(active_model_serializers (0.8.1) lib/active_model/serializer.rb:454)
rubyjit.ActiveModel::Serializer$$attributes_dbeb427ba2b0518d676c0a687aeb474a438bbc8b681842940.file(active_model_serializers (0.8.1) lib/active_model/serializer.rb)
rubyjit.ActiveModel::Serializer$$serializable_hash_77c90db1574839863dc0d7ab15cb761d318d3fad681842940.__file_(active_model_serializers (0.8.1) lib/active_model/serializer.rb:478)
rubyjit.ActiveModel::Serializer$$serializable_hash_15164681ef3759650116133c60c86faa4d0da16f681842940.file(active_model_serializers (0.8.1) lib/active_model/serializer.rb:360)
rubyjit.ActiveModel::ArraySerializer$$serializable_array_3e75f1b3d701c37c0dd6c09012f195834f37a85e681842940.block_0$RUBY$__file_(active_model_serializers (0.8.1) lib/active_model/array_serializer.rb:89)
rubyjit$ActiveModel::ArraySerializer$$serializable_array_3e75f1b3d701c37c0dd6c09012f195834f37a85e681842940$block_0$RUBY$__file_.call(rubyjit$ActiveModel::ArraySerializer$$serializable_array_3e75f1b3d701c37c0dd6c09012f195834f37a85e681842940$block_0$RUBY$__file_)
org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:135)
org.jruby.runtime.Block.yield(Block.java:142)
org.jruby.RubyArray.collect(RubyArray.java:2399)
org.jruby.RubyArray.map19(RubyArray.java:2412)
org.jruby.RubyArray$INVOKER$i$0$0$map19.call(RubyArray$INVOKER$i$0$0$map19.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:458)
would be great if you can come up with a piece of script where this gets reproduced (and submit it to JRuby's issue tracker) as this is invoke-dynamic related, which gets turned on for you due Java 8.
work-around would be (unless you get other advice what the failure actually means - if it's fine to live with) to disable indy :
java -Djruby.compile.invokedynamic=false -Xmx786m -Xss2048k ...
or if you're about to use the jruby executable :
jruby -Xcompile.invokedynamic=false -S ...
both can be added to their corresponding XXX_OPTS environment variable