0xcodezero / activemessaging

Automatically exported from code.google.com/p/activemessaging
0 stars 0 forks source link

import keyword clash when running on JRuby. #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Configure your ActiveMessaging enabled project to use JMS
2. jruby -S rake --trace -T

Actually any rake task will cause this the problem, for instance, I was trying 
to run jruby -S rake db:sessions:create

What is the expected output? What do you see instead?
Step 2. above should print the available Rake tasks to the console
Instead an error is reported:

C:\Dev\Workspaces\workspace_stuffplanner\stuffplannerrails>jruby -S rake 
--trace -T
(in C:/Dev/Workspaces/workspace_stuffplanner/stuffplannerrails)
** Invoke environment (first_time)
** Execute environment
Java::JavaxNaming::InitialContext
rake aborted!
can't convert Class into String
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2422:in 
`load_imports'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2366:in 
`raw_load_rakefile'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1993:in 
`load_rakefile'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in 
`standard_exception_handling'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1992:in 
`load_rakefile'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1976:in `run'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in 
`standard_exception_handling'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run'
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
C:/Dev/JRuby/1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:19:in `load'
C:\Dev\JRuby\1.2.0\bin\..\bin\rake:19

What version of the product are you using? On what operating system?
Windows XP SP3
Java 6
JRuby 1.2.0 (ruby 1.8.6 patchlevel 287)
Rake 0.8.1
Rails 2.1.0

Please provide any additional information below.
I have read the problem is a conflict between Rake and JRuby: they both define 
an 'import' method, I think JRuby monkey 
pathces Object#import, so when jms.rb calls

import javax.naming.InitialContext
import javax.jms.MessageListener

Rake tries to load these thinking they are Rakefile includes. It's all a bit 
silly really but the working solution is to 
use 'java_import' instead of 'import'.

I have made this change and all is fine.... well I get another, possibly 
related problem, whereby JRuby 'cannot load Java 
class javax.jms.MessageListener (NameError)'... any help with that would be 
appreciated.

Best, Darren

Original issue reported on code.google.com by dbisho...@gmail.com on 1 May 2009 at 11:19