My program contains the following line, and just hangs at this point, and I'm not quite sure why.
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
When debugging in Eclipse, if I try to evaluate "new PoolingHttpClientConnectionManager()" in the Display view I get these errors:
java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
...omitted - referring to specific lines in code...
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.ClassNotFoundException: org.apache.http.config.Lookup
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)
... 10 more
I am using httpclient.jar version 4.3.1 from org.apache.httpcomponents.
Anyone else experience this problem? Any solution? Or am I doing something silly?
Do you also have httpcore jar? (version 4.3 as well) I've found that class there.
The org.apache.http.config.Lookup class is not in httpclient-4.3.1.jar. It is in httpcore-4.3.jar.
If you are not using Maven, to understand the httpclient dependencies, see http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/dependencies.html
Maybe you forgot to include/download HttpCore
http://hc.apache.org/downloads.cgi
Related
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
I get the below error when running the program. Any idea?
Caused by: java.lang.NoClassDefFoundError: com/google/common/base/Charsets
at org.apache.mahout.text.wikipedia.XmlInputFormat$XmlRecordReader.<init>(XmlInputFormat.java:76)
at org.apache.mahout.text.wikipedia.XmlInputFormat.createRecordReader(XmlInputFormat.java:52)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.<init>(MapTask.java:488)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:731)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:223)
at java.util.concurrent.Executors$RunnableAdapter.call(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.ClassNotFoundException: com.google.common.base.Charsets
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)*
Class is not found under the package. Try to extract the jar file & traverse to com/google/common/base package. I think class is missing. Use another jar file which has Charsets class
I am making a webapp using tomcat but its having problems in running in windows...there is a java file(thread.java) which runs another java file(emaildownload.java) so first I need to get to the directory in which class file is stored ...I am using
this.getClass().getClassLoader().getResource("").getPath();
for getting class path...and then I am running file by:
thread foo=new thread();
foo.runProcess("java mainclasses.emaildownload "+credentials[0]+" "+credentials[1]+" "+credentials[2]+" "+credentials[3]+" ");
file structure:
C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\Mazil3.0\WEB-INF\classes\mainclasses\emaildownload.class
and mainclasses is package...
but I am getting this error:
java.lang.NoClassDefFoundError: javax/mail/UIDFolder
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(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: javax.mail.UIDFolder
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)
... 6 more
I don't understand why the error is coming?
Interface UIDFolder belongs to javax.mail package since it is saying NoClassDefFoundError so you might not be having the javamail api in your classpath .Get it from here
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
I am developing a RMI Chat application in Java. I am trying to run simple RMI application in eclipse IDE. But it issues following problem. I know how to run it from command prompt and its running without any problem. If you could suggest me the ways to run RMI application in Eclipse IDE is really appreciated. Thank you!
Error:
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: examples.credit.CreditChecker
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.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.ClassNotFoundException: examples.credit.CreditChecker
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 java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 13 more
Sorry. i am not sure about that it is right or wrong. because i have not work on RMI
applications. but i am sure that following link solve your problem.
running rmi server, classnotfound