Getting an Illegal Argument Exception/Runtime Exception when using Jetty in Eclipse - eclipse

I know this might be difficult to answer, but I have tried everything and cannot get a solution. I am trying to create a web project in Java for the first time, using Eclipse and Jetty and JSF, and everything works well until I introduce a Java class. I write in HTMl/XHTML and run the programs, but when I add a Java class - even with nothing in the class, I get the following exceptions:
java.lang.RuntimeException: Error scanning file C:\Users\****\eclipse-workspace\donationFinder\target\classes\com\testingClass\Test.class
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:783)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:876)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:165)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:552)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by:
java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:986)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:777)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:876)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:165)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:552)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.base/java.lang.Thread.run(Thread.java:835)
Does anyone know what might be causing this? Thanks in advance.

The version of asm you are using is too old for your JVM runtime.
For Jetty 9.4.x you should be using (at least) asm-7.1.jar if you want to scan bytecode produced for Java 8 thru Java 13.
Use asm-7.2.jar if you want to scan bytecode produced for Java 8 thru 14.
Use asm-7.3.1.jar if you want to scan bytecode produced for Java 8 thru 15.
See prior answer for details.
https://stackoverflow.com/a/26496604/775715

Related

Intellij will not run ScalaTests - "Incompatible Class Change Error"

I'm trying to run tests for an sbt-based Scala application in intellij. But I get the following error which I'm not sure how to fix:
Testing started at 21:07 ...
java.lang.IncompatibleClassChangeError: Found class scala.collection.mutable.ArrayOps, but interface was expected
at org.scalatest.tools.Runner$.checkArgsForValidity(Runner.scala:895)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:729)
at org.scalatest.tools.Runner$.run(Runner.scala:711)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:144)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
When I decorate my classes with the Junit runner attribute they work fine (and it's actually a much better run in terms of the visuals):
#RunWith(classOf[JUnitRunner])
I got the same error when trying to run tests for my Play Framework app. Drilling down into the stack trace, I found that the problem class was FakeRequest, which is in the play-test library. I had two different versions of the library, one for Play 2.4 and one for 2.3. I was able to resolve this issue by removing the play-test version for Play 2.3 (open Module Settings -> Libraries -> find and delete the bad dependency).
Your issue is probably with some other problematic dependency, but following the same steps as above may help fix it.
This seems to be a problem with scala test runner framework. I had come across the same problem; eventually like you suggested end up using junit test runner to make it work. But the problem in my case was it was pulling in a transitive dependency and no such class error.
Make sure the libraries what you are using for the JUnitRunner are same. Most of the times “Incompatible Class Change Error” occurs because of backward compatibility. And also have a look at scala library jar at the time of compiling and running.

xuggler give me such error please help me what i do?

2013-06-21 07:25:59,162 [main] ERROR com.xuggle.ferry.JNILibraryLoader - Could not load library: xuggle-xuggler; version: 3; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem
Exception in thread "main" java.lang.UnsatisfiedLinkError: no xuggle-xuggler in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(JNILibraryLoader.java:265)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary(JNILibraryLoader.java:168)
at com.xuggle.xuggler.XugglerJNI.(XugglerJNI.java:19)
at com.xuggle.xuggler.IContainer.(IContainer.java:1457)
at com.xuggle.mediatool.MediaReader.(MediaReader.java:137)
at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77)
at com.xuggle.xuggler.demo.GetContainerinfo.main(GetContainerinfo.java:22)
This problem occurs for Library Dependency. I solved this problem by adding jars sequentially as bellow:
1) commons-cli-1.1.jar
2) commons-lang-2.1.jar
3) logback-classic-1.0.0.jar
4) logback-core-1.0.0.jar
5) slf4j-api-1.6.4.jar
6) xuggle-xuggler-5.4.jar
There's a list of reasons that could cause this on the Xuggler FAQ, these seem to be the main causes I think.
This error can occur if you are using the 32 bit version of Xuggler with a 64 bit Java JVM, or if you are using the 64 bit version of Xuggler with a 32 bit Java JVM.
It can also occur if you are using Xuggler without having it installed, which i see you're using Xuggler version 3 in that stack trace, and the no-install build of Xuggler started with version 5.3, so that's another possibility.
It could ALSO occur if you don't have your environment variables set up correctly.
You can also take a look at the FAQ if none of those are the problem in your case.

facing issue with GWT designer mode

I'm working with Eclipse Helios 3.6 (32-bit). I installed the GWT plug-in and created a new Web application. In the Client folder I was trying to open a file with GWT designer, but unfortunately I was getting an error:
Internal Error encountered unexpected internal error. This could be caused by a bug or by a misconfiguration issue, conflict, partial update, etc.
java.lang.UnsupportedClassVersionError: Bad version number in .class file
Stack trace:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at com.google.gdt.eclipse.designer.hosted.tdt.HostedModeSupport.loadImpl
(HostedModeSupport.java:110)
at com.google.gdt.eclipse.designer.hosted.tdt.HostedModeSupport.<init>
(HostedModeSupport.java:83)
at com.google.gdt.eclipse.designer.hosted.tdt.HostedModeSupportFactory.create
(HostedModeSupportFactory.java:32)
at com.google.gdt.eclipse.designer.model.widgets.support.GwtState.getHostedModeSupport
(GwtState... (missing part here)
...org.eclipse.wb.internal.core.editor.errors.ExceptionComposite$3.widgetSelected
(ExceptionComposite.java:129)
--- etc
I have JavaCompiler in project properties 1.6 and from preferences->java->installed JDK/JRE using 1.6.
I am not sure of the specifics but most likely you are trying to run the designer with JDK 1.5. That is the cause of that error. I would recheck everything.
Also off the top of my head I would verify 32 bit versus 64 bit java sdk.
Generally when anything is wrong in JavaCompiler Project properties it will throw error of major/minor version 51.0 . So here most probably by checking the java version installed in the system and the version through which you are working are differnet. Make both of them compatible and the error will be solved.

Counterclockwise eclipse error on 1st command

I began looking into lisp recently, and installed Counterclockwise with Eclipse.
Then, hating the fact that the 1.2 version is built in, I manually linked the 1.3 library into it (not very difficult honestly)...
Then I noticed that each time I run a new REPL session, the first command always makes a bunch of errors show up, with no effect on the session itself. At the same time, all following commands work fine.
It's only a minor annoyance, but still pretty unnerving. I've tested it with 1.2 (built in version) by reversing the changes I made, but that didn't help.
Here is the long list of Eclipse Console output (there are 6 more, but eclipse didn't write them, I might go and try to simulate the same inside of a cmd, but please tell me if it's necessary 1st)
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at clojure.tools.nrepl$handle_response.invoke(nrepl.clj:265)
at clojure.tools.nrepl$message_dispatch$fn__181.invoke(nrepl.clj:305)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at clojure.core$refer.doInvoke(core.clj:3775)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$load_lib.doInvoke(core.clj:5252)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$load_libs.doInvoke(core.clj:5271)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:604)
at clojure.core$use.doInvoke(core.clj:5363)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.main$repl.doInvoke(main.clj:258)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at clojure.tools.nrepl$handle_request.invoke(nrepl.clj:240)
at clojure.lang.Var.invoke(Var.java:409)
at clojure.tools.nrepl$message_dispatch$fn__181$fn__184.invoke(nrepl.clj:302)
... 6 more
Edit: There's a chance this may be linked to namespaces
(ns Something)
even if nothing in the file is actually used.
Post an issue on the google code page here: http://code.google.com/p/counterclockwise/issues/list
and send email to the google group here: http://groups.google.com/group/clojuredev-users?pli=1
It looks like a namespace name problem.
I can generate this error easily on ccw 0.5.0.STABLE002:
1) I create a new project using wizard: File->New->Project..->Clojure Project
2) I create file core.clj in src folder
3) I change namespace name.
After running REPL for the file core.clj I get the same exception.
I found this problem after creating project with lein with the name containing HYPEN "-"
When I use project name with hypen then package names are created with underscore "_". After calling lein eclipse (:dev-dependencies [[lein-eclipse "1.0.0"]]) project clould be imported properly to eclipse. REPL works perfect. But it is not possible to compile project with lein. For this hypen in namespace name have to be changed to underscore. After the change compilation with lein became possible but REPL in ccw started generating not well described exception enclosed by you in the question.
My advice after this experience do not use hypens or underscores in project names.

Working IntelliJ Scala Plugin Tutorial?

I'm having some trouble getting the scala plugin to work with IntelliJ IDEA 10.5.1 Community Edition on Mac OSX 10.6.8. I'm following these instructions but whenever I try to run the simple HelloWorld application, I get this error:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Didea.launcher.port=7533 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA 10 CE.app/bin -Dfile.encoding=UTF-8 -classpath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-string.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/charsets.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/Users/A482930/IdeaProjects/ScalaPractice/out/production/ScalaPractice:/Users/A482930/scala/lib/scala-library.jar:/Users/A482930/scala/lib/scala-swing.jar:/Users/A482930/scala/lib/scala-dbc.jar:/Applications/IntelliJ IDEA 10 CE.app/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain HelloWorld
Exception in thread "main" java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Process finished with exit code 1
I checked the module settings and the compiler library seems to be set up correctly. The version of scala I'm using is the 2.9.0.1 with the IzPack Installer. I've tried both the IDEA plugin listed under available plugins as well as the July 5 2011 nightly here.
Rather then helping me troubleshoot my specific issue, does anyone know of a step by step tutorial that actually works without issues for a configuration similar to mine? I'm ok with using older versions of scala and even IDEA as long as they work.
I'm not sure you still need help with this, but I just ran a simple example with Scala 2.9.0.1 and it worked. I've been having tons of issues with the plugin though, so I guess it would help to know the exact steps you followed.
In my case, I did this:
Created Project
Added Scala Facet in the Project Wizard and added the Scala libs as a global lib (there are a few issues with this, but it should work here)
Create your HelloWorld example
Create a new Scala Compilation Server Runner. Add the Classpath of your project
Run the project
A colleague of mine created this some months ago, after having some issues getting started:
https://github.com/runeflobakk/sbt-idea-scalatest
Guess it is more SBT focused, but maybe you can find some use in it anyway?