JRuby 9k is not working with Puma and torquebox 4 - jruby

My application is running perfectly fine with jruby-1.7.12 with puma and torquebox 4.
And I am trying latest jruby-graal(9k) with puma and torquebox 4.
But my server is not getting started with jruby-graal. This is where it's getting stuck.
krunal#krunal-Lenovo-IdeaPad-U530-Touch:~/code/test$ rails s puma
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:27 warning: ambiguous Java methods found, using isJavaIdentifierStart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:28 warning: ambiguous Java methods found, using isJavaIdentifierPart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:27 warning: ambiguous Java methods found, using isJavaIdentifierStart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:28 warning: ambiguous Java methods found, using isJavaIdentifierPart(int)

Related

Grails db-reverse-engineer fails

I am trying to reverse engineer a database schema and I'm getting the following error:
Command execution error: org.hibernate.cfg.Configuration.buildSettings(Lorg/hibernate/service/ServiceRegistry;)Lorg/hibernate/cfg/Settings;
> Building 85% > :dbReverseEngineer :dbReverseEngineer FAILED
> Building 85%
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dbReverseEngineer'.
Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1
Grails version:
| Grails Version: 3.2.6
| Groovy Version: 2.4.7
| JVM Version: 1.8.0_141
Gradle version:
Gradle 3.4.1
I followed these the instructions.
That plugin was last released with Grails 3.0.x. That used gorm 4, I'm pretty sure. (The docs for Grails 3.1 advertise "What's New" to include gorm 5, and Grails 3.2 advertises gorm 6). Maybe Burt will chime in, but as far as I can tell, this plugin isn't going to work well in Grails 3.2.x without being re-released.
You could try running it in 3.0.11, just to reverse engineer your classes, and then move those into your real project, as a workaround.

Rails5 jruby not able to start

Not able to start rails5 with jruby, getting the following error.
gavinyap#gavin-ubuntu  ~/Development/rails5app  rails s
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from require at bin/rails:4)
Bundler::GemRequireError: There was an error while trying to load the gem 'activerecord-jdbcmysql-adapter'.
Gem Load Error is: uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format
Backtrace for gem load error is:
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:13:in `<module:TypeCast>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:7:in `<module:Jdbc>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:4:in `< module:ConnectionAdapters>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:3:in `<top>'
/home/gavinyap/.rvm/gems/jruby-9.1.2.0/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:1:in `singleton cla
Versions of Jruby and Rails
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f
OpenJDK 64-Bit Server
VM 25.91-b14 on 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14 +jit [linux-x86_64]
Rails 5.0.0
The ActiveRecord JDBC gem has not been updated for Rails 5. Checking the project in GitHub shows some development activity early this year but there is no indication when a new gem will be released for Rails 5.
add gem 'activerecord-jdbcmysql-adapter', '~> 5.0.pre1' to your gemfile

Getting 'java.sql.SQLException: com.mysql.jdbc.Driver' with grails run-app (when BuildConfig.groovy doesn't need to be recompiled)

I've upgraded my grails application from 1.3.9 to 2.2.3 and then to 2.3.3. I read the release and upgrade notes for 1.3.9->2.2.3 and then from 2.2.3->2.3.3
I am using OpenJDK 6, Jetty 6 and the plugin jetty 1.1, MySQL 5.5 and I have the connector library under lib
Now my issue is if I run grails clean and then grails run-app the application runs without any problems but if I stop it and run grails run-app again I get a gigantic error (see here: http://pastebin.com/36MpXhir)
I also found that changing something like adding a space somewhere in BuildConfig.groovy (anything that makes it be recompiled) makes the application run normally.
Looking at the stacktrace the first thing that puzzles me is
[02.12.13 16:13:59.919] [main] pool.ConnectionPool Unable to create initial connections of pool.
java.sql.SQLException: com.mysql.jdbc.Driver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.afterPropertiesSet(LazyConnectionDataSourceProxy.java:162)
There are references to org.apache.tomcat even though I'm using jetty (and removed tomcat from BuildConfig.groovy).
Did anyone else encounter such a problem?
Don't put jar files in the lib directory if they're available in a public Maven repo. It's far better to download jars once and keep them in a local cache, and reuse them as needed.
The MySQL driver is used as the commented-out example in the generated BuildConfig.groovy - just un-comment it :) You might want to bump up the version to the latest, e.g.
dependencies {
runtime 'mysql:mysql-connector-java:5.1.27'
}
This is a good site for finding Maven artifacts: http://mvnrepository.com/artifact/mysql/mysql-connector-java
If you do have a jar that's not in a Maven repo (e.g. one with shared code at your company) then you can put it in the lib directory, but it's not auto-discovered. Run grails compile --refresh-dependencies to get it added to the classpath.
For me same error has occurred while running the Grails Application.Then I debug and view the code history of my code which was committed recently.
From that I found the issue that was:
Inside the controller file I send the instance with-out properly
Eg:
**def list=[personInstance.]---> error occurred.**
**render list as JSON**
Then I correct my mistake-->clean the app --> run the app
Now its working fine.

Rails 3 with mysql and omniauth => [BUG] Segmentation fault

I try to run the project together with omniauth (devise + omniauth) and mysql.
For example Twitter authorization gives an error:
/Users/n3mfis/.rvm/rubies/ruby-head/lib/ruby/1.9.1/net/http.rb:784:
[BUG] Segmentation fault ruby 1.9.3dev
(2011-05-18 trunk 31628)
[x86_64-darwin10.7.0]
-- Control frame information ----------------------------------------------- c:0054 p:---- s:0330 b:0330 l:000329
d:000329 CFUNC :connect c:0053 p:0011
s:0327 b:0327 l:000a80 d:000326 BLOCK
/Users/n3mfis/.rvm/rubies/ruby-head/lib/ruby/1.9.1/net/http.rb:784
c:0052 p:0111 s:0325 b:0325 l:0024a0
d:0024a0 METHOD
/Users/n3mfis/.rvm/rubies/ruby-head/lib/ruby/1.9.1/timeout.rb:60
c:0051 p:0026 s:0313 b:0313 l:000312
d:000312 METHOD
/Users/n3mfis/.rvm/rubies/ruby-head/lib/ruby/1.9.1/timeout.rb:91
....
1069
/Users/n3mfis/.rvm/gems/ruby-head/bundler/gems/rails-505defc27ead/activerecord/lib/active_record/relation/predicate_builder.rb
1070
/Users/n3mfis/.rvm/gems/ruby-head/bundler/gems/rails-505defc27ead/activerecord/lib/active_record/associations/collection_proxy.rb
1071
/Users/n3mfis/.rvm/gems/ruby-head/gems/multi_json-1.0.2/lib/multi_json/engines/json_gem.rb 1072
/Users/n3mfis/.rvm/rubies/ruby-head/lib/ruby/1.9.1/x86_64-darwin10.7.0/enc/trans/utf_16_32.bundle
[NOTE] You may have encountered a bug
in the Ruby interpreter or extension
libraries. Bug reports are welcome.
For details:
http://www.ruby-lang.org/bugreport.html
Abort trap
If I change mysql to sqlite, then everything works fine...
For mysql and sqlite other features of the site work fine without any errors (scaffold)
I tried
ruby ruby-1.9.2-p180 and last version ruby 1.9.3dev
rails 3.0.7 and rails 3.1.0beta1
Try to add this option:
export RUBYOPT='-r openssl'

JRuby on Rails app on and JBoss 4.2.0/Tomcat 5.5

My JRuby on rails app works fine on Tomcat 6.0, But when I deploy it on my company's webfarm which is JBoss 4.2.0/Tomcat 5.5 (Servlet API 2.4) It fails with the following stack trace:
java.lang.ArrayIndexOutOfBoundsException: 0
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateBufferInvocation(AsmLibraryLoader.java:548)
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateMethod(AsmLibraryLoader.java:511)
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:223)
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:125)
at com.kenai.jaffl.provider.jffi.Provider.loadLibrary(Provider.java:31)
at com.kenai.jaffl.provider.jffi.Provider.loadLibrary(Provider.java:25)
at com.kenai.jaffl.Library.loadLibrary(Library.java:76)
at com.kenai.jaffl.Library.loadLibrary(Library.java:48)
at org.jruby.ext.socket.RubyUNIXSocket.tryUnixDomainSocket(RubyUNIXSocket.java:167)
at org.jruby.ext.socket.RubySocket$Service.load(RubySocket.java:103)
at org.jruby.runtime.load.LoadService.reflectedLoad(LoadService.java:384)
at org.jruby.ext.LateLoadingLibrary.load(LateLoadingLibrary.java:49)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:671)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:314)
at org.jruby.runtime.load.LoadService.require(LoadService.java:357)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:289)
at org.jruby.RubyKernel.requireCommon(RubyKernel.java:984)
at org.jruby.RubyKernel.require(RubyKernel.java:967)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen:65535)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:319)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:146)
at ruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5.rescue_1$RUBY$__rescue___0(custom_require.rb:31)
at ruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5.__file__(Lruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5;Lorg.jruby.runtime.ThreadContext;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.Block;)Lorg.jruby.runtime.builtin.IRubyObject;(custom_require.rb:???)
at ruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5.__file__(Lorg.jruby.runtime.ThreadContext;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.Block;)Lorg.jruby.runtime.builtin.IRubyObject;(custom_require.rb:???)
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:153)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
and then:
org.jruby.rack.RackInitializationException: stack level too deep
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/version.rb:298:in `<=>'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:17
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `call'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `satisfied_by?'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `all?'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `satisfied_by?'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:202:in `=~'
from /home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/gems/gems/bundler-1.0.2/lib/bundler/index.rb:41:in `search_for_all_platforms'
... 321 levels...
Thanks,
Arkadiy
First note that JRuby-Rack changed to servlet 2.5 as of the 0.9.7 release. So in order to run on 5.5 you'll have to downgrade to 0.9.6 or earlier. This may be a bit tricky with Warbler dependencies but you can manually adjust the jars in a Warbler config file using config.java_libs.
As for the errors above, I haven't seen them before. The only thing that comes to mind is that native/ffi support doesn't work in some containers and you may need to disable it with -Djruby.native.enabled=false.
org.jruby.rack.RackInitializationException: stack level too deep
Is probably cause by a low thread stack size. Try increasing it by passing -Xss16k to the JVM. Increase it until you find a value that it's ok to your application.