Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError: lancet/core$WsdlToDotnet when trying to run uberjar #18

Closed
venantius opened this issue Sep 11, 2015 · 4 comments
Closed

Comments

@venantius
Copy link

I'm not sure what the root cause of this is, but it seems to have been something other people have encountered at least once in the past.

I got this trying to run autodoc from an uberjar'd build of autodoc master. Figure at the very least we can document resolution steps in a google-able way :)

Exception in thread "main" java.lang.NoClassDefFoundError: lancet/core$WsdlToDotnet (wrong name: lancet/core$wsdltodotnet)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at lancet.core__init.load(Unknown Source)
    at lancet.core__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at clojure.lang.RT.loadClassForName(RT.java:2098)
    at clojure.lang.RT.load(RT.java:430)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$require.doInvoke(core.clj:5496)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at autodoc.deps$loading__4910__auto__.invoke(deps.clj:1)
    at autodoc.deps__init.load(Unknown Source)
    at autodoc.deps__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at clojure.lang.RT.loadClassForName(RT.java:2098)
    at clojure.lang.RT.load(RT.java:430)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:621)
    at clojure.core$use.doInvoke(core.clj:5507)
    at clojure.lang.RestFn.invoke(RestFn.java:512)
    at autodoc.collect_info_wrapper$loading__4910__auto__.invoke(collect_info_wrapper.clj:1)
    at autodoc.collect_info_wrapper__init.load(Unknown Source)
    at autodoc.collect_info_wrapper__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at clojure.lang.RT.loadClassForName(RT.java:2098)
    at clojure.lang.RT.load(RT.java:430)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:621)
    at clojure.core$use.doInvoke(core.clj:5507)
    at clojure.lang.RestFn.invoke(RestFn.java:619)
    at autodoc.autodoc$loading__4910__auto__.invoke(autodoc.clj:1)
    at autodoc.autodoc__init.load(Unknown Source)
    at autodoc.autodoc__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at clojure.lang.RT.loadClassForName(RT.java:2098)
    at clojure.lang.RT.load(RT.java:430)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.lang.Var.invoke(Var.java:415)
    at autodoc.autodoc.<clinit>(Unknown Source)
@tomfaulhaber
Copy link
Owner

@venantius: can you tell me something about your environment and how you're invoking autodoc? It does work on my system, but it does funky stuff to separate the information collection from the doc building, so I'm not sure.

@venantius
Copy link
Author

Sure. I'm running this on OS X 10.10.5, Lein 2.5.2, Java 1.8.0_60.

Running lein uberjar generates some warnings, but nothing urgent (I don't think):

Warning: specified :main without including it in :aot.
Implicit AOT of :main will be removed in Leiningen 3.0.0.
If you only need AOT for your uberjar, consider adding :aot :all into your
:uberjar profile instead.
WARNING!!! version ranges found for:
[enlive "1.0.0"] -> [org.clojure/clojure "[1.1.0,)"]
Consider using [enlive "1.0.0" :exclusions [org.clojure/clojure]].

Compiling autodoc.autodoc
Created /Users/william_jarvis/Code/autodoc/target/autodoc-1.0.0.jar
Created /Users/william_jarvis/Code/autodoc/target/autodoc-1.0.0-standalone.jar

Then if I navigate to a directory that contains, say, ultra and invoke as follows:

[william_jarvis@jackalope:ultra] 16:17:55 $ java -jar ../autodoc/target/autodoc-1.0.0-standalone.jar 
Exception in thread "main" java.lang.NoClassDefFoundError: lancet/core$WsdlToDotnet (wrong name: lancet/core$wsdltodotnet)
...etc...

@tomfaulhaber
Copy link
Owner

Argh. I see the problem. lancet.core has both WsdlToDotnet and wsdltodotnet. I think this might work on Ubuntu and not on Mac, but I'm not sure.

Let me see if this has been fixed in Lancet or maybe I can just drop my dependency on that library.

@tomfaulhaber
Copy link
Owner

This happens in lancet because it tries to create a list of ant tasks and turn them into functions. On the mac this breaks, I think, because when you make the uberjar, it temporarily pulls everything out of the source lancet jar into files so that it can create the uberjar. On the mac, file names can't differ by case only and, so, one class file gets overwritten by the other and goes into the uberjar wrong.

In any case, lancet is old and we hate ant in general. This whole chunk of code was ripped out of leiningen years ago and leiningen has improved in a couple of ways that we can take advantage of here. First, it can now be used directly as a library, leiningen-core, so we don't need to cut and paste. Second, it uses pomegranate to compute dependencies and classpaths so lancet is now completely unnecessary.

I'm going to take a shot at converting the collect-info-wrapper to use leiningen-core.classpath and see if we can drop the lancet dependency altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants