Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.HasBeenInstrumented - java

We had installed version of our applications (without any instrumentation or cobertura jar included before generating application bundles).
After installation we instrumented all the jar with cobertura, and included cobertura jar file in java classpath. but while starting application it give below error.
any input will really help, thanks.
Java version "1.7.0_25"
cobertura ver 1.9.4.1
Exception in thread "main" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.HasBeenInstrumented
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more

You should add cobetura.jar to Bootstrap Classes with -Xbootclasspath. More info: https://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
This needs to be done in order to load the cobetura classes, which are needed in order to load your app classes.

I have been able to get rid of this problem by running a late package goal, as it re-compiles and re-packages de code without Cobertura.
The goals I use are:
clean site package

Related

In Prod env Java batch Fails sometimes with NoClassdeffoundError due to class not found exception. Occurres atleast once in a day or a week

I am facing NoClassdeffoundError due to class not found exception for Java batch application.jar files are deployed on the windows server these batch jars are getting executed via bat file from Tivoli job schedular .But I am totally clueless why it is occurring only some times in a day or in week.This issue is not coming on QA Environment but on production it occurring.My logs are as follows
java.io.IOException: An unexpected network error occurred
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(Unknown Source)
at org.apache.logging.log4j.core.appender.OutputStreamManager.writeToDestination(OutputStreamManager.java:256)
... 29 more
java.lang.NoClassDefFoundError: org/apache/commons/lang3/exception/ExceptionUtils
at com.xxx.yy.batch.BatchExecutor.processFiles(BatchExecutor.java:322)
at com.xxx.yy.batch.BatchExecutor.processZipFiles(BatchExecutor.java:235)
at com.xxx.yy.batch.BatchExecutor.readFilesAndUpdateTables(BatchExecutor.java:204)
at com.xxx.yy.batch.BatchExecutor.executeBatch(BatchExecutor.java:85)
at com.xxx.yy.batch.BatchExecutor.main(BatchExecutor.java:65)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.exception.ExceptionUtils
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/Java7Support
at org.apache.commons.io.FileUtils.isSymlink(FileUtils.java:3089)
at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1574)
at com.xxx.yy.batch.processor.BatchProcessor.cleanFiles(BatchProcessor.java:426)
at com.xxx.yy.batch.BatchExecutor.executeBatch(BatchExecutor.java:147)
at com.xxx.yy.batch.BatchExecutor.main(BatchExecutor.java:65)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.Java7Support
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
I confirmed that my class path is correct all the jars and classes are present.

Lucene ClassNotFoundError when loading analyzer

I tried to run Lucene Indexer but it gives me the following error:
java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
Exception in thread "main"
I used compile command:
javac -classpath 'C:/Users/Daniel/desktop/Java WorkSpace/JavaPackage/lucene-3.0.0/lucene-core-3.0.0.jar' Indexer.java;
and it works.
But when I tried to execute the compiled class:
java Indexer;
It gives me the ClassNotFoundException(). PS: the compiled class file and jar file are not in the same folder. Would that matter?
Thanks!
The Lucene Analyzers are no longer in the Lucene core. Download the JAR (or add to your Maven dependencies) for the corresponding version here: http://mvnrepository.com/artifact/org.apache.lucene/lucene-analyzers

Can not deploy JavaFX 2 application

I have the project based on JavFX 2, it`s done and works perfect in Eclipse. Now i am trying to deploy it on computer(self-service,terminal,..). I have created jar file, but when i am trying to "java -jar myproject.jar" i take the following
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more
UDT:
I think there is some problem with jfxrt.jar where javafx.application.Application class stored, in eclipse i added this jar in build path manually..
In Java 7, JavaFX is included with the JDK download but is not on the classpath (JavaFX is not part of the core libraries in Java 7). Have a look at the tutorial on deployment, which shows mechanisms for deploying a jar file that will work.
(In Java 8, JavaFX becomes part of the core libraries and will be included on the classpath, so your regular jar file may well work. There are still some cool things you can do with the proper deployment process, though.)

Getting java.lang.NoClassDefFoundError: org/apache/xerces/dom/ElementNSImpl with Apache ODF Toolkit

I am trying to read an ods file using Apache ODF Toolkit. I am getting java.lang.NoClassDefFoundError error while while trying to load the Spreadsheet using below code-
SpreadsheetDocument data = SpreadsheetDocument.loadDocument(file);
Below is the error trace-
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/dom/ElementNSImpl
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at test.read.ODSFile.ReadODS.main(ReadODS.java:33)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.dom.ElementNSImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 25 more
Below is the project structure, which shows the classpath-
Is there any dependencies missing?
It seems your code can not find the class:
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.dom.ElementNSImpl
from ODF Toolkit
Note: ODFDOM requires Apache Xerces. The jar file xercesImpl.jar also must exist in a folder lib next to odfxsltrunner.jar file, or it must be in the classpath. The ODF XSLT Runner NetBeans projects includes a reference to xersesImpl.jar in the runtime classpath which has to be adapted after checking out the project.

Eclipselink problem in a javase project

I am getting this error when I am running my eclipselink project.
[EL Warning]: 2008.12.05 11:47:08.056--java.lang.NoClassDefFoundError: org/jboss/resource/adapter/jdbc/ValidConnectionChecker was thrown on attempt of PersistenceLoadProcessor to load class com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker. The class is ignored.
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/resource/adapter/jdbc/ValidConnectionChecker
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.loadClass(PersistenceUnitProcessor.java:261)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.initPersistenceUnitClasses(MetadataProcessor.java:247)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processEntityMappings(MetadataProcessor.java:422)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:299)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:830)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:101)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:149)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initialize(JPAInitializer.java:135)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:104)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:64)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at Main.main(Main.java:32)
Caused by: java.lang.ClassNotFoundException: org.jboss.resource.adapter.jdbc.ValidConnectionChecker
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 24 more
Any ideas? Why would eclipselink need something from jboss? What jboss jar do I need. I would use open jpa, but for some reason after quit a few persists from my app it starts giving a bunch of stackoverflow errors.
If your project is not supposed to used JBoss at all, and yet still needs some JBoss class, that could means:
either your default server is JBoss (in the server view)
or your persistence.xml in your yourProjectEJB/ejbModule/META-INF does reference JBoss

Categories

Resources