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

fatal error #2

Open
postspectacular opened this issue Mar 30, 2013 · 15 comments
Open

fatal error #2

postspectacular opened this issue Mar 30, 2013 · 15 comments

Comments

@postspectacular
Copy link

Hi Gary, just tried giving this a spin, added [lein-nodisassemble "0.1.0"] dependency to :plugins in profiles.clj, then doing lein repl:

Retrieving nodisassemble/nodisassemble/0.1.0/nodisassemble-0.1.0.jar from clojars
Exception in thread "main" java.lang.UnsupportedClassVersionError: no/disassemble/NoDisassemble : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "Thread-3" clojure.lang.ExceptionInfo: Subprocess failed {:exit-code 134}
at clojure.core$ex_info.invoke(core.clj:4327)
at leiningen.core.eval$fn__2648.invoke(eval.clj:214)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at leiningen.core.eval$eval_in_project.invoke(eval.clj:283)
at leiningen.repl$start_server.invoke(repl.clj:104)
at leiningen.repl$server$fn__6100.invoke(repl.clj:172)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$bound_fn_STAR_$fn__4102.doInvoke(core.clj:1810)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:680)

OSX 10.7.4
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)

@gtrak
Copy link
Owner

gtrak commented Mar 30, 2013

Looks like this is due to leiningen's compilation of java classes on my
particular platform, compiling from source wouldn't have this problem. I'll
investigate what it takes to fix it on my end.

On Saturday, March 30, 2013, Karsten Schmidt wrote:

Hi Gary, just tried giving this a spin, added [lein-nodisassemble "0.1.0"]dependency to :plugins in profiles.clj, then doing lein
repl:

Retrieving nodisassemble/nodisassemble/0.1.0/nodisassemble-0.1.0.jar from
clojars
Exception in thread "main" java.lang.UnsupportedClassVersionError:
no/disassemble/NoDisassemble : Unsupported major.minor version 51.0

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at
sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "Thread-3" clojure.lang.ExceptionInfo: Subprocess
failed {:exit-code 134}
at clojure.core$ex_info.invoke(core.clj:4327)
at leiningen.core.eval$fn__2648.invoke(eval.clj:214)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at leiningen.core.eval$eval_in_project.invoke(eval.clj:283)
at leiningen.repl$start_server.invoke(repl.clj:104)
at leiningen.repl$server$fn__6100.invoke(repl.clj:172)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$bound_fn_STAR_$fn__4102.doInvoke(core.clj:1810)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:680)

OSX 10.7.4
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)


Reply to this email directly or view it on GitHubhttps://github.com//issues/2
.

@gtrak
Copy link
Owner

gtrak commented Mar 31, 2013

Should be fixed in 0.1.1, released just a second ago.

@gtrak gtrak closed this as completed Mar 31, 2013
@postspectacular
Copy link
Author

++thanks for looking into this, alas even though the original error has gone, it's still defunkt when attempting to use it (with 0.1.1):

user=> (use 'no.disassemble)
nil
user=> (disassemble (fn []))
java.lang.NullPointerException
at org.eclipse.jdt.internal.core.util.ClassFileStruct.u4At(ClassFileStruct.java:61)
at org.eclipse.jdt.internal.core.util.ClassFileReader.(ClassFileReader.java:76)
at org.eclipse.jdt.internal.core.util.Disassembler.disassemble(Disassembler.java:290)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at no.disassemble$disassemble.invoke(disassemble.clj:23)
at user$eval384.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$repl$read_eval_print__6588$fn__6591.invoke(main.clj:259)
at clojure.main$repl$read_eval_print__6588.invoke(main.clj:259)
at clojure.main$repl$fn__6597.invoke(main.clj:277)
at clojure.main$repl.doInvoke(main.clj:277)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__3636.invoke(interruptible_eval.clj:56)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:41)
at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__3677$fn__3680.invoke(interruptible_eval.clj:171)
at clojure.core$comp$fn__4154.invoke(core.clj:2330)
at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__3670.invoke(interruptible_eval.clj:138)
at clojure.lang.AFn.run(AFn.java:24)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
ClassFormatException org.eclipse.jdt.internal.core.util.ClassFileReader. (ClassFileReader.java:282)

Does this all depend on Java 7 or the Oracle JVM by any chance? (only wondering because of the ClassFormatException...) Sorry, Gary!

@gtrak
Copy link
Owner

gtrak commented Apr 1, 2013

Ha, I don't think it's anything specific to your jvm version. I appreciate you checking it out, though. The library itself is very simple. There's a HashMap returned by the getter (no.disassemble.NoDisassemble/getClasses) in the java class.

  1. One thing I'd like you to try, access the hash-map in the Java class directly and see if any classes are getting set in there?
  2. Do you see a startup message on System.out? "Initializing NoDisassemble Transformer".
    If that's not the case, then there's a problem with initializing the java agent. That's the job of the lein-plugin, but its job can be done manually by adding the appropriate jar to your jvm-opts.

@gtrak gtrak reopened this Apr 1, 2013
@gtrak
Copy link
Owner

gtrak commented Apr 1, 2013

right here: https://github.com/gtrak/no.disassemble/blob/master/lein-nodisassemble/src/lein_nodisassemble/plugin.clj#L20

this is automatically adding the nodissasemble dependency, then grabbing the path to the maven jar and throwing it into the -javaagent commmand line parameter.

This can be done manually, but it's a pain.

@gtrak
Copy link
Owner

gtrak commented Apr 1, 2013

I originally developed it on Ubuntu on jdk7, I just tried it on a macos machine with java 1.6.0_43 and it's working fine.

@qerub
Copy link

qerub commented May 5, 2014

I think I've figured it out. Leiningen does only spawn a second VM (with javaagent set) when run from inside a project directory. Running lein repl from outside a project directory gives the behavior @postspectacular is describing.

@gtrak
Copy link
Owner

gtrak commented May 5, 2014

Ah, interesting. Since there's no project map, this isn't really a bug?
The plugin relies on the :jvm-opts key in the project map.

On Mon, May 5, 2014 at 6:01 PM, Christoffer Sawicki <
notifications@github.com> wrote:

I think I've figured it out. Leiningen does only spawn a second VM (with
javaagent set) when run from inside a project directory. Running lein replfrom outside a project directory gives the behavior
@postspectacular https://github.com/postspectacular is describing.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-42246191
.

@qerub
Copy link

qerub commented May 5, 2014

Even project-less Leiningen invocations have a project map, but without the #{:group :license :name :root :version :url :description} keys.

I don't know if this is how Leiningen should work. I'll try to reach @technomancy.

@technomancy
Copy link

Probably best to provide a default value for :jvm-opts if this is a thing it makes sense to run outside a project.

@gtrak
Copy link
Owner

gtrak commented May 6, 2014

Burden on lein or me? Not sure I understand.

On Monday, May 5, 2014, Phil Hagelberg notifications@github.com wrote:

Probably best to provide a default value for :jvm-opts if this is a thing
it makes sense to run outside a project.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-42254695
.

@technomancy
Copy link

I don't think it's necessarily reasonable to require all Leiningen
project maps to have a :jvm-opts key; this should be considered an
implementation detail. Besides, if it changed in Leiningen you would
still have this problem for all versions older than 2.4.0 anyway.

@qerub
Copy link

qerub commented May 6, 2014

@technomancy: I wonder about this: When I run lein repl inside a project directory it spawns a second VM with the configured :jvm-opts/:java-agents set. If I run it outside a project directory, it doesn't spawn a second VM and those settings are thereby rendered void. Is this expected behavior?

The plugin relies on the :jvm-opts key in the project map.

@gtrak meant that the plugin relies on :jvm-opts working, not that it already has to be present.

@technomancy
Copy link

@qerub Oh right; sure. Yes, we shouldn't spawn a new JVM when running outside a project; that would be very slow. The :jvm-opts setting can't affect Leiningen's own JVM since the process obviously has already been launched by the time the settings are read. If you want to change the opts to Leiningen's JVM you have to use the JVM_OPTS environment variable.

@technomancy
Copy link

I should mention you could construct a profile that could act as a dummy app and let you spin up repls in any directory without a project if you didn't mind the slowdown.

In profiles.clj:

 :fakeproject {:root "/tmp"
               :eval-in :subprocess
               :dependencies [[org.clojure/clojure "1.6.0"]
                              [org.clojure/tools.nrepl "0.2.3"]]}

Then run lein with-profile fakeproject repl anywhere.

qerub added a commit to qerub/no.disassemble that referenced this issue Jul 27, 2014
qerub added a commit to qerub/no.disassemble that referenced this issue Jul 27, 2014
qerub added a commit to qerub/no.disassemble that referenced this issue Jul 27, 2014
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

4 participants