creating new lucene index no class found error - java

i'm using lucene 4.0 and i want to create a new indexWriter in this way:
IndexWriter index = LuceneUtils.createIndexWriter(indexPath, true);
(it worked using lucene 3.6)
where indexPath is a String with the path of the index. I got this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/analysis/SimpleAnalyzer
at lucene.IndexCreator.<init>(IndexCreator.java:25)
at main.Main.main(Main.java:72)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.SimpleAnalyzer
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)
... 2 more
i have read that i need to add lucene-analyzers-common-4.0.0.jar to the project besides lucene-core-4.0.0.jar, but i get the same error.
as a matter of fact the path of SimpleAnalyzer.class inside lucene-analyzers-common-4.0.0.jar is not org.apache.lucene.analysis.SimpleAnalyzer but org.apache.lucene.analysis.core.SimpleAnalyzer.

It looks like you might have a 3.6 jar in your class path. Can you verify that an older version isn't being pulled in, possibly by transitive dependencies?

Related

Java - NoClassDefFoundError on starting up local version of DynamoDB

I'm trying to start local version of DynamoDB on the command line (OSX) using the following command as specified in the documentation:
java –Djava.library.path=. -jar DynamoDBLocal.jar
But getting the following errors:
Exception in thread "main" java.lang.NoClassDefFoundError: �Djava/library/path=/
Caused by: java.lang.ClassNotFoundException: �Djava.library.path=.
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)
Any ideas on how to resolve this issue?
The � shows that it may be a character, which looks like hyphen '-' . Please inspect this.
Also, whenever you are using -D option, its best practice to use a complete jar name (rather than wild card). This will make sure that you are missing nothing.

java.lang.NoClassDefFoundError:oracle/j2ee/ws/common/jaxws/ServiceDelegateImpl

I am using BPM API to retrieve a list of task assigned to a particular user. But, While running the class file I am getting following error:--
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/j2ee/ws/common/jaxws/ServiceDelegateImpl
at oracle.bpm.client.BPMServiceClientFactory.<init>(BPMServiceClientFactory.java:102)
at oracle.bpm.client.BPMServiceClientFactory.getInstance(BPMServiceClientFactory.java:144)
at project3.Fixture.getBPMServiceClientFactory(Fixture.java:33)
at project3.Fixture.getBPMServiceClient(Fixture.java:49)
at project3.GetProcessInstances.testGetProcessInstances(GetProcessInstances.java:29)
at project3.GetProcessInstances.main(GetProcessInstances.java:24)
Caused by: java.lang.ClassNotFoundException: oracle.j2ee.ws.common.jaxws.ServiceDelegateImpl
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:305)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
... 6 more
I have already added the following Jar file to my project:--
Oracle.bpm.runtime.jar
Oracle.bpm.client.jar
Bpm-services.jar
Wsclient.jar
But still the issue is not resolved..
Any Suggestion??????
Aside from the reason it is not working you should be using the TaskQueryService provided by Oracle out of the box.

Convert an XML file to PDF using XSLT and XSL-FO/FOP

I'm trying to convert an XML file to a PDF file using XSL-FO, I found the code in this example:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup
but I receive this Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/image/loader/impl/ImageRawPNG
at org.apache.fop.render.pdf.PDFImageHandlerRawPNG.getSupportedImageClass(PDFImageHandlerRawPNG.java:51)
at org.apache.fop.render.ImageHandlerRegistry.addHandler(ImageHandlerRegistry.java:97)
at org.apache.fop.render.ImageHandlerRegistry.discoverHandlers(ImageHandlerRegistry.java:169)
at org.apache.fop.render.ImageHandlerRegistry.<init>(ImageHandlerRegistry.java:64)
at org.apache.fop.apps.FopFactory.<init>(FopFactory.java:168)
at org.apache.fop.apps.FopFactory.newInstance(FopFactory.java:177)
at searchManagement.export.PdfExporter.main(PdfExporter.java:77)
Caused by: java.lang.ClassNotFoundException: org.apache.xmlgraphics.image.loader.impl.ImageRawPNG
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)
... 7 more
Do you have some advices?
Thanks!
This error means that one of the classes you are using is trying to use the class org/apache/xmlgraphics/image/loader/impl/ImageRawPNG but can't find it.
What you need to do, is find the jar that contains that class and add it to the classpath.

NoClassDefinitionFoundError while using JGAP API

java.lang.NoClassDefFoundError: gnu/trove/THashMap
i am using JGAP API for solving Load Distribution problem using Genetic Algorithm.
Problem i am facing right now is not really related to Jgap.
i am trying to create an object of class WeightedRoulleteSelector and i am getting ths exception :
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: gnu/trove/THashMap
at org.jgap.impl.WeightedRouletteSelector.<init>(WeightedRouletteSelector.java:48)
....
Caused by: java.lang.ClassNotFoundException: gnu.trove.THashMap
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)
Dont have an idea how to overcome this. do i need to add jar file for this??
please help out
You need to add trove library in your runtime classpath

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