Exception in Dynamic Report - java

Hi I am trying to generate dynamic report in NetBeans7 IDE, java6, glassfish3.2 environment.
I am creating project using java> web application. I used below jars
commons-collections-3.2.1
commons-digester-2.0
dynamicreports-1.3.0
dynamicreports-adhoc-4.0.1
dynamicreports-core-4.0.1
itext-2.1.7
jasperreports-6.1.0
commons-logging-1.2
commons-logging-1.2-javadoc
common-lang3.jar
but I am getting
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/Validate
I investigate the issue and find that
I have to add
1)common-lang3.jar
2)and common-lang3.jar is missing inside WEB-INF>lib ,
I added mentioned jar and
it is also available in WEB-INF>lib.
but still I am facing same issue.
find the below exception while running java file
run:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/Validate
at net.sf.dynamicreports.report.base.component.DRList.setType(DRList.java:78)
at net.sf.dynamicreports.report.base.component.DRList.<init>(DRList.java:50)
at net.sf.dynamicreports.report.base.DRBand.<init>(DRBand.java:41)
at net.sf.dynamicreports.report.base.DRReport.init(DRReport.java:113)
at net.sf.dynamicreports.report.base.DRReport.<init>(DRReport.java:97)
at net.sf.dynamicreports.report.builder.ReportBuilder.<init>(ReportBuilder.java:60)
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.<init>(JasperReportBuilder.java:95)
at net.sf.dynamicreports.report.builder.DynamicReports.report(DynamicReports.java:65)
at net.sf.dynamicreports.examples.adhoc.DynamicReporting.main(DynamicReporting.java:20)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.Validate
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 9 more
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
my code:
public class DynamicReporting{
public static void main(String args[]) throws DRException, FileNotFoundException{
JasperReportBuilder report= DynamicReports.report();
report.toPdf(new FileOutputStream(new File("c:/report.pdf")));
System.out.print("Report generated");
}
}
can any one suggest what I am missing.Thanks in advance

From this dynamicreports-core-4.0.1 in your jar list, I can say that you are using 4.0.1 version, So you do not need dynamicreports-1.3.0 this.
I just downloaded dependencies from below link,
http://sourceforge.net/projects/dynamicreports/files/dynamicreports/4.0.1/
And all you need to run snippet of yours is this list of jars in your project class path,
You can see that this does not match with yours so you are mixing lots diff versions of jar.
Note: All this jars can be found under that links.

If you are using Dynamic Reports 4.1.1 released, you should opt for JasperReports 6.2.2
DynamicReports 4.1.0 released JasperReports 6.2.0,
DynamicReports 4.0.2 released JasperReports 6.1.1
etc.
http://www.dynamicreports.org/news
And the libraries to be added should be as follows. I took the same mistake and solved it by loading these libraries,I hope it helps.
result:

Related

BIRT Build standalone report generator in a JAR

I have built a Java 1.8 application under Maven in Eclipse that allows me to generate BIRT reports in a programmatic way without the need for the UI. Within Eclipse everything works fine. If I compile the code into a JAR file and try to run it however I run into problems with java.lang.NoClassDefFoundErrors. Clearly I have a missing dependancy but I don't know how to resolve the problem.
The error is
java -cp target/* com.resonancex.scheduler.Scheduler
Establishing conection...
Connected
Got products to report
ProductId=1 ProductType=BREN Isin=XS1939207996 Template=BREN_MU
* birtEngine EngineConfig: org.eclipse.birt.report.engine.api.EngineConfig.emitterConfigs={html=org.eclipse.birt.report.engine.api.HTMLEmitterConfig#71bbf57e};
* Birt Engine Startring ....
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/CoreException
at org.eclipse.birt.core.framework.Platform.createPlatformLauncher(Platform.java:115)
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:74)
at com.resonancex.scheduler.BirtEngine.start(BirtEngine.java:33)
at com.resonancex.scheduler.BirtEngine.getBirtEngine(BirtEngine.java:47)
at com.resonancex.scheduler.BIRTReportGenerator.setReportCustom(BIRTReportGenerator.java:67)
at com.resonancex.scheduler.Scheduler.generateAllReports(Scheduler.java:68)
at com.resonancex.scheduler.Scheduler.main(Scheduler.java:79)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.CoreException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
I added the library org.eclipse.birt.runtime_4.8.0-20180626-4.8.0 which appears to be the required BIRT runtime. Can anyone give me a few pointers as to what else I may need?
Just in case anyone else tries to do this I thought I would list the libraries I needed to install to get standalone BIRT report generation running running. The list is as follows. Obviously this list may change over time so keep that in mind:
axis-1.4.jar
batik-anim-1.7.jar
batik-awt-util-1.7.jar
batik-bridge-1.7.jar
batik-css-1.7.jar
batik-dom-1.7.jar
batik-gvt-1.7.jar
batik-i18n-1.9.jar
batik-parser-1.7.jar
batik-script-1.7.jar
batik-svg-dom-1.7.jar
batik-transcoder-1.7.jar
batik-util-1.8.jar
batik-xml-1.7.jar
hibernate-agroal-5.4.9.Final.jar
icu4j-4.8.jar
itext-2.1.7.jar
mssql-jdbc-7.4.1.jre8.jar
org.apache.batik.css-1.6.0.jar
org.eclipse.birt.runtime_4.8.0-20180626-4.8.0.jar
org.eclipse.core.runtime_3.14.0.v20180417-0825-4.8.0.jar
org.eclipse.datatools.connectivity.oda-3.5.0.201603142002.jar
org.eclipse.datatools.connectivity.oda.consumer-3.3.0.201603142002.jar
org.eclipse.emf.common-2.16.0.jar
org.eclipse.emf.ecore-2.11.1.jar
org.eclipse.emf.ecore.xmi-2.11.1.jar
org.eclipse.equinox.common_3.10.0.v20180412-1130-4.8.0.jar
org.eclipse.equinox.registry_3.8.0.v20180426-1327-4.8.0.jar
org.eclipse.osgi_3.13.0.v20180409-1500-4.8.0.jar
org.mozilla.javascript-1.7.5.v201504281450.jar
org.w3c.dom.smil_1.0.1.v200903091627-4.8.0.jar
org.w3c.dom.svg-1.1.0.jar
sac-1.3.jar
xml-apis-1.4.01.jar

Install and compile JacORB

I was following this tutorial to install JacORB Tutorial. In the last step, when I want to compile it, I got this error
Buildfile: /Users/adm/Downloads/jacorb/build.xml
base-init:
init-properties:
init-path:
init-javac-common:
init-javac-jdk:
init-javac-j2me:
init:
src-check:
BUILD FAILED
/Users/adm/Downloads/jacorb/build.xml:21: Unable to find src files. Is this a binary distribution?
But if I try ant in a demo file it builde successfully. I don't have to do the last step in the tutorial ? The second question is how to excute the build file ? after I builded the hello demo, I tried "jaco build" but I got a java exception
jaco build
Exception in thread "main" java.lang.NoClassDefFoundError: build
Caused by: java.lang.ClassNotFoundException: build
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
You likely have the binary distribution of JacORB.
Download the source distribution of JacORB instead. On the JacORB Download page, click the link for Full source code.
Or see https://github.com/JacORB/JacORB/ for the official source code.
I would recommend asking questions about JacORB on the jacorb-developer list (http://www.jacorb.org/contact.html)

How to fix ClassPath in Netbeans on Windows

I just restarted java for university and I have a pretty basic program that I need to code. The thing is every time I try to run it, I get a NoClassDefFoundError as follow:
run:
java.lang.NoClassDefFoundError: log120/devoir1/LOG120Devoir1
Caused by: java.lang.ClassNotFoundException: log120.devoir1.LOG120Devoir1
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)
Could not find the main class: log120.devoir1.LOG120Devoir1. Program will exit.
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
I am using Netbeans 7.0.1 since it was the IDE I was using a couple of years ago to code java. I googled the error and found something about the class path but all the example I found were for LINUX based OS so I am kinda lost as to how to set it right on Windows.
The class does exist, the program did compile, from what I understand this error comes when the JVM tries to run the code and does not find the class.
Anyone can help me with finding the ClassPath on Netbeans 7.0.1 or if it is not the ClassPath finding why this error keeps popping up?
If you're trying to run your own code, setting your classpath is probably barking up the wrong tree. Netbeans should be including your code automatically on the classpath when it tries to run it.
Please describe how you have your code laid out within your project (eg do you have LOG120Devoir1.java in a log120/devoir1 directory?) as well as how you told netbeans that you wanted to run that class as your main method.

classifier4j class not found exception on addMatch() method

i have a strange behaviour when trying to use bayesian classifier class from classifier4j package
basically my code is:
String test_string = "some bla bla web designers in here whatever";
SimpleWordsDataSource wds = new SimpleWordsDataSource();
BayesianClassifier classifier = new BayesianClassifier(wds);
wds.addMatch("Web Design")
Double d = classifier.classify(test_string);
what i'm getting when trying to run this code is:
run:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at net.sf.classifier4J.bayesian.WordProbability.calculateProbability(WordProbability.java:167)
at net.sf.classifier4J.bayesian.WordProbability.setMatchingCount(WordProbability.java:138)
at net.sf.classifier4J.bayesian.WordProbability.<init>(WordProbability.java:115)
at net.sf.classifier4J.bayesian.SimpleWordsDataSource.addMatch(SimpleWordsDataSource.java:94)
at tothego_classifier_test.Main.main(Main.java:44)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 5 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
which is pretty annoying since i've been trying to run a simple hello-world test (as in the website's usage part). I'm on netbeans 6.9 and i've ofc included classifier4j 0.6 jar and optional jar, also have the correct import statements in my main class.
I know Nick Lothian contributes here, so i tought would be good asking!
thanks everybody for efforts
ok i solved the problem, and here we go with a quick howto for everyone:
http://commons.apache.org/logging/download_logging.cgi click on this link and download the binary file
unzip the file you just downloaded
add commons-logging-xxx.jar, commons-logging-adapters.jar, commons-logging-api.jar to your CLASSPATH / project libs (i tried an awful lot, and it only seems to work with the whole jars included)
rebuild and rerun
hope this is helpful :)

google data api for youtube

I'm trying to run the sample program, which comes with Google Data API. I get a runtime error at following line
YouTubeService myService = new YouTubeService("gdataSample-YouTube-1");
The error is the following:
run:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:118)
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:100)
at com.google.gdata.client.Service.<clinit>(Service.java:532)
at YouTubeReadonlyClient.main(YouTubeReadonlyClient.java:713)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 4 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
I tried both Google Data API versions 1.35.0 and 1.35.1, and I get the same error in both cases.
Looks like you don't have the collections library in your class path.
It's in the gdata/java/deps directory in the zip file. Include the google-collect-1.0-rc1.jar file in your classpath and you should be fine. (You may also need jsr305.jar - I'm not sure.)
Three little steps:
Download the zip file from
http://www.docjar.com/jar_detail/google-collect-1.0-rc1.jar.html
Extract the zip file
Add the jar to your build path.

Categories

Resources