Getting this error in eclipse editor - java

I am getting this error in eclispe editor all of a sudden It was working previously. I am using Mac OSx
I was not getting that before. I am building the project using ant which is working fine. I am using Eclipse 4.3.2. Is it specific to MAC OS ? I am also cobertura to generate reports. Also when I run a groovy test case I am getting this
java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2436)
at java.lang.Class.getDeclaredFields(Class.java:1806)
at org.spockframework.runtime.SpecInfoBuilder.buildFields(SpecInfoBuilder.java:86)
at org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:57)
at org.spockframework.runtime.SpecInfoBuilder.build(SpecInfoBuilder.java:42)
at org.spockframework.runtime.Sputnik.getSpec(Sputnik.java:78)
at org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:86)
at org.spockframework.runtime.Sputnik.getDescription(Sputnik.java:55)
at org.junit.runner.Runner.testCount(Runner.java:41)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.countTestCases(JUnit4TestClassReference.java:30)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.countTests(RemoteTestRunner.java:487)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:455)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.HasBeenInstrumented
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 28 more
Thanks in advance for your Help.

Cobertura was pretty much dead project a year ago. Latest Java version it could handle was JDK6. So your problems can be caused by newer version of Java.
There was some development done lately, but my concerns are:
It is not clear (from Cobertura current website) with what versions of Java it can cooperate
Which is the official Maven bundle
How can I get latest version. Obviously not from github.
So we switched to different coverage tool called JaCoCo. It can handle Java7 coverage (not sure about Java8 so far). If you want nice plugin in Eclipse, go to Help -> Eclipse Marketplace... -> Type "EclEmma" into Find bar -> Go. This plugin is using JaCoCo under the hood.
EDIT
After posting your versions of Java and Cobertura, my suspects become true. Your version of Cobertura works only with Java6. Thy to update Cobertura version somehow, or switch to above suggested alternative.

Related

running job in hadoop - ERROR

I'm trying to run a program in hadoop ~ $ Desktop/HadoopProject2016.jar input output and i keep getting this error :
Exception in thread "main" java.lang.UnsupportedClassVersionError:
hadoop_project_16/AggregateJob : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method) at
java.lang.ClassLoader.defineClass(ClassLoader.java:803) at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at
java.net.URLClassLoader.access$100(URLClassLoader.java:71) at
java.net.URLClassLoader$1.run(URLClassLoader.java:361) at
java.net.URLClassLoader$1.run(URLClassLoader.java:355) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:354) at
java.lang.ClassLoader.loadClass(ClassLoader.java:425) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at
java.lang.ClassLoader.loadClass(ClassLoader.java:358) at
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Also i dont know how to check the output... Is the error normal?
1) Check if your JRE (java version) of your project in your workspace(eg: eclipse properties window) is same as your java version in your machine from which you are running the hadoop jar command.
2) I am assuming that you are submitting the jar as
hadoop jar
Hadoop jars, you need to check them. Make sure all jars are updated (better bring in the latest version for every jar) and compatible with each other. You can find the version dependencies at http://www.mvnrepository.com/

Raspberry pi - java - Serial Com

I've got a serious problem with my Raspberry Pi (OS: Raspbian) and Java (JDK-7-Armhf). My code wont execute without creating a Exception.
I'll been reading and trying several proposals and nothing have worked yet.
So now i am confused of what went wrong..?
So it goes like this:
I've got a Java source code that will run in my Eclipes IDE.
But when i export the .jar-file, even with library (JRE System lib. _86, JavaSE1.7, JAVAX.comm), as "Runnabel JAR" or just .JAR and execute it om my Raspberry pi, i've got "NoCLassDefFoundExecption: SerialPortEventListener..!
I just don't know why, it won't find the library and use it..!
On my Pi i have librxtx-java installed and JDK-7-oracle-armhf.
librxtx-java should be setting its JAVA_PATH on it's own when installed, but not sure that is done correct!
(I've got a folder /usr/jni and it contains: librxtxSerial.so and
/usr/lib/jvm/jdk-7-oracle-armhf/).
Looking at the library Javax.RXTXcomm in Eclipse, i've got RXTXcomm.jar, that contains SerialPortEventListener, so it is defininated i the .jar.
I'm thinking about, could it be, that there is a missing link between my Java JVM and linux serialport driver? My JRE is working in some way, because it will execute a code to readout HOSTNAME & IP-Adress.
So is there some one who knows how to fix this..?
This is a readout of Java Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/SerialPortEventListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: javax.comm.SerialPortEventListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
A copy of my code. "SimpleRead.java" The original from java comm API samples
You have to change the reference from javax.comm to gnu.io in your source code.
Try following:
Switch to root and run the program you created
If that helps do following
sudo adduser username dialout
then log out and log in from all terminals and GUIs

Hadoop 2.2.0 mapreduce job not running after upgrading from hadoop 1.0.4

I have upgraded my hadoop version from 1.0.4 to 2.2.0. The mapreduce job was running fine earlier. Now i have added almost all jars provided for hadoop 2.2.0. Still it gives me this exception. Let me know where i am doing wrong.
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/protobuf/ServiceException
at org.apache.hadoop.ipc.ProtobufRpcEngine.<clinit>(ProtobufRpcEngine.java:69)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.conf.Configuration.getClassByNameOrNull(Configuration.java:1659)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1624)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1718)
at org.apache.hadoop.ipc.RPC.getProtocolEngine(RPC.java:203)
at org.apache.hadoop.ipc.RPC.getProtocolProxy(RPC.java:537)
at org.apache.hadoop.hdfs.NameNodeProxies.createNNProxyWithClientProtocol(NameNodeProxies.java:328)
at org.apache.hadoop.hdfs.NameNodeProxies.createNonHAProxy(NameNodeProxies.java:235)
at org.apache.hadoop.hdfs.NameNodeProxies.createProxy(NameNodeProxies.java:139)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:510)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:453)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:136)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2433)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:88)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2467)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2449)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:367)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:166)
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.ServiceException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Thanks in advance.
Please check your protobuf dependency. AFAIR Hadoop 2.x needs 2.5.x (please check your hadoop dependencies) and you could just take outdated one because of some external component.
Just for note: if your job uses org.apache.hadoop.mapreduce package it could be binary incompatible with Hadoop 2.x. You should recompile in this case. There should be no such issue with "old" API org.apache.hadoop.mapred. But I'd recommend recompile in any case.
Hope this at least help.

Unable to run Scala-Neo4j project from command line [duplicate]

This question already has answers here:
Building JAR that includes all its dependencies
(5 answers)
Closed 8 years ago.
I developed a Java project in which I wrote some Scala classes and some Java classes. I used Scala-Neo4j wrapper in the project to write Scala functions for inserting and retrieval of Neo4j nodes. I also wrote Thrift services in java in the project as I need to call these Scala functions from Php. Finally I extracted a jar file using Eclipse and I tried to run it from the command line and I got the following Exception
Exception in thread "main" java.lang.NoClassDefFoundError: org/neo4j/scala/Neo4jWrapper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at dum.Sad.main(Sad.scala)
at dum.ScalaRunner.main(ScalaRunner.java:7)
Caused by: java.lang.ClassNotFoundException: org.neo4j.scala.Neo4jWrapper
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 14 more
It works completely fine when I run the project from Eclipse. But, while running the jar file which I extracted from the project I get the Exception above. Where did i go wrong?
It seems your are not setting the classpath up properly. Try this:
scala -cp ./where/is/Neo4jWrapper/jar YourClass
Of course, replace ./where/is/Neo4jWrapper/jar with the path to the .jar. Notice that if you need to point to more than one jar or class directory you need to separate them with : if on Linux/Mac or ; if in Windows. And avoid spaces in the classpath.

JMS Application giving error

I'm trying to run some applications (both my own and tutorial-applications) to help me understanding the basics of JMS. The code in the applications should be correct (for at least some). My added libraries are: Java EE 6 API Library - javaee-api-6.0.jar, jndi-properties.jar, appserv-rt.jar, javaee.jar and JDK 1.7(Default).
But with every single application I try to start, I get the following error message:
run:
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/jms/JMSException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getMethod0(Class.java:2685)
at java.lang.Class.getMethod(Class.java:1620)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:488)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:480)
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
Note that it does say BUILD SUCCESSFUL, but it's a runnable form class (with 2 textfields and a button) and I don't see my form.
I'm trying my applications in NetBeans 7.1.1 using GlassFish Server 3.1.2 1. I've configured the used connection factories and destination resources in the admin console.
As seen by other related questions, I've tried moving the javaee.jar up and down the classpath, and even removed it, with no results. The same goes for Java EE 6 API Library, but that jar is needed for my project.
Changing the javaee-api-6.0.jar to javaee-api-5.0.5.jar fixed it.

Categories

Resources