Strange problem with waffle-jna

Hi!

I am trying to use the Waffle Java library
(GitHub - Waffle/waffle: Enable drop-in Windows Single Sign On for popular Java web servers.) with JRuby, but with very little
success.

The strange thing is this: I am trying to import a Java type from the
waffle-jna.jar file. The ‘require’ lines all work, but when it get to
the
java_import line, I get an error like this:

NameError: undefined local variable or method `waffle’ for main:Object

This indicates to the me that the types in the JAR file have not been
loaded correctly. Which is strange. When I make a simple “hello world”
Java
class, things work like they should which indicate to me that the jar
file
is OK. But I’ve spent hours now trying to get this simple thing working
with JRuby. What am I doing wrong? I tried enabling
jruby.debug.loadService=true but it didn’t give me any help…

Is there any way to see what types JRuby has found in a given jar file,
to
be able to better debug scenarios like this?

Thanks in advance for any suggestions. Below is my sample code. If you
want
to try it, you can run it with the waffle 1.5 release from the link
above.
I have tested with both JRuby 1.6.8 and 1.7.0 with similar results.

Best regards,

Per

require ‘java’

require ‘guava-13.0.1.jar’

require ‘jna-3.5.0.jar’

require ‘platform-3.5.0.jar’

require ‘slf4j-api-1.7.2.jar’

require ‘waffle-jna.jar’

java_import waffle.windows.auth.impl.WindowsAuthProviderImpl

Two ways to fix this:

  1. java_import ‘waffle.windows.auth.impl.WindowsAuthProviderImpl’
  2. java_import Java.waffle.windows.auth.impl.WindowsAuthProviderImpl

-Tom

On Wed, Nov 7, 2012 at 4:15 PM, Lundberg, Per [email protected]
wrote:

waffle-jna.jar file. The require lines all work, but when it get to the
things work like they should which indicate to me that the jar file is OK.

require ‘slf4j-api-1.7.2.jar’

require ‘waffle-jna.jar’

java_import waffle.windows.auth.impl.WindowsAuthProviderImpl


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]

whoops. I should probably say what was wrong too :slight_smile:

We make a bunch of magic methods com,org,java,javax which get defined
on Kernel for those very common package roots. This is why those
appear to just work. Since waffle is not defined you get a NameError.

-Tom

On Wed, Nov 7, 2012 at 5:09 PM, Thomas E Enebo [email protected]
wrote:

didnt give me any help
have tested with both JRuby 1.6.8 and 1.7.0 with similar results.

require ‘waffle-jna.jar’

java_import waffle.windows.auth.impl.WindowsAuthProviderImpl


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]

nice to know - I always wondered why sometime my imports worked and
sometimes not :slight_smile:

  • Kristian