Skip to content

Instantly share code, notes, and snippets.

@machty
Last active February 14, 2017 13:29
Show Gist options
  • Save machty/1591272eefd92d0b6d1e50f55668641c to your computer and use it in GitHub Desktop.
Save machty/1591272eefd92d0b6d1e50f55668641c to your computer and use it in GitHub Desktop.

Given this directory structure:

./target
./target/com
./target/com/futureproofretail
./target/com/futureproofretail/utils
./target/com/futureproofretail/utils/GenericAvroDeserializer.class
./target/com/futureproofretail/utils/GenericAvroSerde.class
./target/com/futureproofretail/utils/GenericAvroSerializer.class

I'm running code with jruby service.rb

It fails on

java_import 'com.futureproofretail.utils.GenericAvroSerde'

NameError: cannot load Java class com.futureproofretail.utils.GenericAvroSerde
        from org/jruby/javasupport/JavaClass.java:286:in `for_name'
        from org/jruby/javasupport/JavaUtilities.java:34:in `get_proxy_class'
        from uri:classloader:/jruby/java/core_ext/object.rb:49:in `block in java_import'
        from org/jruby/RubyArray.java:2485:in `map'
        from uri:classloader:/jruby/java/core_ext/object.rb:36:in `java_import'
        from (irb):56:in `<eval>'
        from org/jruby/RubyKernel.java:1000:in `eval'
        from org/jruby/RubyKernel.java:1298:in `loop'
        from org/jruby/RubyKernel.java:1120:in `catch'
        from org/jruby/RubyKernel.java:1120:in `catch'

I've tried adding

$LOAD_PATH << '/Users/machty/code/exc/exc-kafka-consumer/target/com/futureproofretail/utils/GenericAvroDeserializer.class'
$LOAD_PATH << '/Users/machty/code/exc/exc-kafka-consumer/target/com/futureproofretail/utils/GenericAvroSerializer.class'
$LOAD_PATH << '/Users/machty/code/exc/exc-kafka-consumer/target/com/futureproofretail/utils/GenericAvroSerde.class'

$CLASSPATH << '/Users/machty/code/exc/exc-kafka-consumer/target/com/futureproofretail/utils/GenericAvroDeserializer.class'
$CLASSPATH << '/Users/machty/code/exc/exc-kafka-consumer/target/com/futureproofretail/utils/GenericAvroSerializer.class'
$CLASSPATH << '/Users/machty/code/exc/exc-kafka-consumer/target/com/futureproofretail/utils/GenericAvroSerde.class'

What do I need to change? How can I debug stuff like this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment