Forum: JRuby MQ jars not loading under Win 64

2d1b64aaf61046ad166db3009fa8c7dc?d=identicon&s=25 Charles Monteiro (Guest)
on 2013-11-15 17:36
(Received via mailing list)
Hi

My exact code , and with the exact IBM jars placed under jruby/lib fail
to do an import of the MQ IBM Jar on Windows 7 64 bit. So i thought
perhaps I was being naive i.e. I did not have to install any .so for mq
client on Mac OS X and thus thought the jars sufficient on Windows.
Therefore I installed the IBM MQ client package for Windows but
unfortunately that had no effect. Jruby still complains about not
finding the java package , see stack below.

It fails on this line i.e. from my jruby code:

import com.ibm.mq.MQQueueManager

which works on Mac OS X.

well full disclosure I have not tested launching if from TorqueBox
within OS X, but on OS X instead Im running on Trinidad. I dont think
that the container should matter unless TB is messing with loadpaths
i.e. Im relying on putting the jars I needed within the jruby/lib
folder.

thanks for the help

-charles


stack:




JBWEB000309: type JBWEB000066: Exception report

JBWEB000068: message org.jruby.exceptions.RaiseException: (NameError)
missing class or uppercase package name (`com.ibm.mq.MQQueueManager')

JBWEB000069: description JBWEB000145: The server encountered an internal
error that prevented it from fulfilling this request.

JBWEB000070: exception

javax.servlet.ServletException: org.jruby.exceptions.RaiseException:
(NameError) missing class or uppercase package name
(`com.ibm.mq.MQQueueManager')
  org.torquebox.web.servlet.RackFilter.doRack(RackFilter.java:129)
  org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:108)
  org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:74)
  org.torquebox.web.servlet.SendfileFilter.doFilter(SendfileFilter.java:49)
  org.torquebox.web.servlet.SendfileFilter.doFilter(SendfileFilter.java:33)
JBWEB000071: root cause

org.jruby.exceptions.RaiseException: (NameError) missing class or
uppercase package name (`com.ibm.mq.MQQueueManager')
  org.jruby.javasupport.JavaUtilities.get_proxy_or_package_under_package(org/jruby/javasupport/JavaUtilities.java:54)
  RUBY.method_missing(file:/C:/torquebox-3.0.0/jruby/lib/jruby.jar!/jruby/java/java_package_module_template.rb:14)
  RUBY.(root)(C:/torquebox-3.0.0/jboss/standalone/tmp/vfs/deploymentf5c6fd4ab93531c5/tbxdataproc.knob-d0c62f863d8435ec/mq_manager.rb:7)
  org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
  RUBY.(root)(C:/torquebox-3.0.0/jboss/standalone/tmp/vfs/deploymentf5c6fd4ab93531c5/tbxdataproc.knob-d0c62f863d8435ec/tb_x_data_processor.rb:1)
  org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
  RUBY.(root)(C:/torquebox-3.0.0/jboss/standalone/tmp/vfs/deploymentf5c6fd4ab93531c5/tbxdataproc.knob-d0c62f863d8435ec/tb_x_data_processor.rb:4)
  org.jruby.RubyBasicObject.instance_eval(org/jruby/RubyBasicObject.java:1735)
  RUBY.(root)(C:\torquebox-3.0.0\jboss\standalone\tmp\vfs\deploymentf5c6fd4ab93531c5\tbxdataproc.knob-d0c62f863d8435ec\config.ru:1)
  RUBY.(C:\torquebox-3.0.0\jboss\standalone\tmp\vfs\deploymentf5c6fd4ab93531c5\tbxdataproc.knob-d0c62f863d8435ec\config.ru:7)
  org.jruby.RubyKernel.eval(org/jruby/RubyKernel.java:1093)
  RUBY.initialize(C:/torquebox-3.0.0/jruby/lib/ruby/gems/shared/gems/rack-1.5.2/lib/rack/builder.rb:55)
JBWEB000072: note JBWEB000073: The full stack trace of the root cause is
available in the JBoss Web/7.2.0.Final logs.

JBoss Web/7.2.0.Final


Charles
6a22563bd5790a15adc54c8ca772eb22?d=identicon&s=25 Ben Browning (Guest)
on 2013-11-15 17:50
(Received via mailing list)
What happens if you put the jars you need under your application's lib/
directory instead of jruby/lib? TorqueBox, being based on JBoss AS7,
does have some different classloading semantics for Java jars.

Ben
2d1b64aaf61046ad166db3009fa8c7dc?d=identicon&s=25 Charles Monteiro (Guest)
on 2013-11-15 17:55
(Received via mailing list)
Ill try but what if I had multiple apps that used MQ , would not want
that replication? Does TB itself have a centralized place it looks for
JARS ?

thanks

Charles
2d1b64aaf61046ad166db3009fa8c7dc?d=identicon&s=25 Charles Monteiro (Guest)
on 2013-11-15 18:35
(Received via mailing list)
sorry for doing this piecemeal

I ran some isolated tests and Im able to do mq puts outside of TorqueBox
via straight jruby i.e.

C:\torquebox-3.0.0\jruby\bin\jruby.exe --1.9 -e
$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) --2.0
"C:/Users/Charles Monteiro/RubymineProjects/TestMQ/test_mq.rb

TB is using 1.7.4

also tried 1.7.6

and this all works.

So I guess this is pointing to that there is something about the
deployed context with TB that is not making those jars accessible.

Again, would hate to have to co-locate to my apps/lib dir

perhaps force jruby/lib into the loadpath i.e. from within my app ? or
some TB config setting ?


Charles
6a22563bd5790a15adc54c8ca772eb22?d=identicon&s=25 Ben Browning (Guest)
on 2013-11-15 19:16
(Received via mailing list)
You should be able to put your jars anywhere you want as long as you
require them from Ruby before trying to import or use them.

require '/path/to/mq.jar'

Ben
2d1b64aaf61046ad166db3009fa8c7dc?d=identicon&s=25 Charles Monteiro (Guest)
on 2013-11-16 03:53
(Received via mailing list)
It seems that Torquebox due to its concept of Runtime pools effectively
bypasses/prevents  jruby/lib from being in the load path, they provide a
torquebox_init.rb which is ran upon runtime init
so I assume that adding jruby/lib to the load_path there might work.

any reason why that might not be a good idea ?

thanks

Charles
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.