Skip to content

Instantly share code, notes, and snippets.

Last active Dec 14, 2015
What would you like to do?
JRuby NameError: missing class or uppercase package name (`')

I'm attempting to use the Exchange Webservices API. Unfortunately it has a weird package, but I thought that wouldn't be hard to overcome. So I wrote this script:

require 'java'
require 'vendor/lib/EWSJavaAPI_1.2.jar'

def microsoft

version =
service =

Getting the ExchangeVersion enum worked fine, but trying to access the ExchangeService class resulted in this error:

NameError: missing class or uppercase package name (`')
get_proxy_or_package_under_package at org/jruby/javasupport/
method_missing at file:/Users/adam/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/java/java_package_module_template.rb:14
(root) at lib/sandbox.rb:11

I can't figure out what would cause this error. The .class is in the jar, as unzip -l shows. Anything I could try?

Copy link

adamstegman commented Mar 4, 2013

I figured this out, it's actually that the EWS API is missing its dependencies. It needed commons-httpclient and commons-logging-api on the classpath. I discovered this via clojure's error message for similar code:

(import '( ExchangeService))

ClassNotFoundException org.apache.commons.httpclient.HttpConnectionManager$ (

So the real issue here is JRuby's error message. Interestingly enough, JRuby did give me a better error once commons-httpclient was on the classpath: `': java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

That told me commons-logging-api was also missing. Not sure why JRuby didn't tell me that in the first place.

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