I want to read the Outlook calendar. So I'm started first to try to connect to the server. I found http://code.msdn.microsoft.com/exchange-ews-java-api-12-1a5a1143 and want just to get the connect and try around.
I found a example and tried this:
import microsoft.exchange.webservices.data.*;
...
public void test(){
ExchangeService es = new ExchangeService();
ExchangeCredentials credentials = new WebCredentials("user", "Password");
}
It crashes by Exchange Service:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpConnectionManager
at ExchangeTest.test(ExchangeTest.java:15)
at Window.main(Window.java:19)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpConnectionManager
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)
... 2 more
I tried to import a library but didn't got the correct one or the fault is something else. Can you tell me which library I need or where/how I can fix it. Thanks.
I'm using a Win7.
You need this library The Commons HttpClient and you have to add this library to the build path of your project.
Related
I have been trying to use this external class folder which was given from my programming lecturer a few months back. I followed people's explanations of how to add via "configure build class", and the application somewhat recognises the class because a shortlist of some of the methods are given. It also does not return any errors prior to runtime but once it's ran I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: Console
at lab3.q2.main(q2.java:15)
Caused by: java.lang.ClassNotFoundException: Console
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)
... 1 more
This is really frustrating as it works from the linux computers in my college without issue. The class file is just a variation of the scanner that we use for user i/o, I have it attached.
Console.class file
I have been using libGdx for a while now. I have created a new project without using libGdx and created some class trying to practice some code if it works as I intended. However, I'm getting error that main class is not found in the libgdx package.
How Do I switch between libgdx and just native IDE.
So for example...
package com.example.example;
public class Example
{
public static void main (String[] args)
{
System.out.println("hey");
}
}
when i try to run this code I get error
Exception in thread "main" java.lang.NoClassDefFoundError: com/badlogic/gdx/jnigen/BuildTarget$TargetOs
at com.badlogic.gdx.physics.box2d.utils.Box2DBuild.main(Box2DBuild.java:13)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.jnigen.BuildTarget$TargetOs
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)
... 1 more
How do I fix this? Thanks in advance!
I ran into this error today and Lestat was correct.
In your IDE (in my case Eclipse): go to Run> Run As> Java application.
I wrote a Java Client Enterprise Application, and it works very good when i run it from Netbeans.
please notice that there is a query run on start up of the application which send a query to Entitybean.
the problem is when i try to run this JAR Application from windows command line, this error appear to me:
java -jar Apps.jar
Exception in thread "main" java.lang.NoClas
sDefFoundError: javax/persistence/Query
at Apps.Main.main(Main.java:75)
Caused by: java.lang.ClassNotFoundException: javax.persistence.Query
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)
... 1 more
I'm surprised! because it connected successfully between EntityManger and Database, so it used libraries of javax.persistence! .. so Why it don't see the library while trying to send a query?!
So how i solve this problem to run the application by command line any where? not from Netbeans only ?!
Notes:
Windows 8
JDK8
I Set JAVA_HOME and PATH Variables on Windows
Thanks,
I'm using the Apache Commons HTTP Client and I have included all the required jar files (ie commons-httpclient-3.0.1.jar and commons-httpclient-3.1.jar) in the class path.
The purpose of this code is to send files (in this case images) to the content management system when a website user creates and saves a new image article. The exception appears in the File Sender window when the filesender attempts to transfer images from the Tomcat temp folder to the CMS. This causes the process to fail and the images remain stuck in the temp folder.
What could be the cause of this error?
SEVERE: Policy class "uk.co.content.article.MoodboardArticlePolicy" spec
ified by input template MoodboardArticle as top policy has a dependency
on some class where runtime version is incompatible with the version compiled ag
ainst
java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEnt
ity
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.polopoly.cm.policy.PolicyFactoryDependencyInjecting$DependencyInj
ectionPolicyInstantiator.createInstance(PolicyFactoryDependencyInjecting.java:71
)
at com.polopoly.cm.policy.PolicyFactory.createPolicyInstance(PolicyFacto
ry.java:141)
at com.polopoly.cm.policy.PolicyFactoryDependencyInjecting.createPolicyI
nstance(PolicyFactoryDependencyInjecting.java:49)
at com.polopoly.cm.policy.PolicyFactory.createPolicy(PolicyFactory.java:
103)
at com.polopoly.cm.policy.PolicyCMServerBase.getPolicyFor(PolicyCMServer
Base.java:1046)
at com.polopoly.cm.policy.PolicyCMServerBase.getPolicyFor(PolicyCMServer
Base.java:972)
at com.polopoly.cm.policy.PolicyCMServerBase.createNewVersion(PolicyCMSe
rverBase.java:177)
at com.polopoly.cm.policy.PolicyCMServerBase.createNewVersion(PolicyCMSe
rverBase.java:157)
at com.polopoly.cm.policy.PolicyCMServerBase.createContentVersion(Policy
CMServerBase.java:740)
at com.polopoly.cm.policy.PolicyCMServerBase.createContentVersion(Policy
CMServerBase.java:754)
at uk.co.prestige.ftpclient.FileSender.updatePolopolyContent(Fil
eSender.java:244)
at uk.co.prestige.ftpclient.FileSender.sendFile(FileSender.java:
194)
at uk.co.prestige.ftpclient.HotFolderWorker.notifyFileProcessLis
teners(HotFolderWorker.java:61)
at uk.co.prestige.ftpclient.DirectoryScanner.scanNow(DirectorySc
anner.java:79)
at uk.co.prestige.ftpclient.HotFolderWorker.run(HotFolderWorker.
java:88)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.metho
ds.RequestEntity
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)
... 17 more
I am new to jUnit and unit testing in general, and have been trying to set up my testing environment and failing all day. This is trying to test a method in my android application.
I added a test class to the same package the java class is in. I added a method as below:
#Test
public void testIsExpectedNote() {
assertTrue(Frequency.isExpectedNote(440, "A"));
}//should return true
This fails with the following stack trace:
java.lang.NoClassDefFoundError: android/util/Log
at dataLogicLayer.Frequency.isExpectedNote(Frequency.java:13)
at dataLogicLayer.FrequencyTest.testIsExpectedNote(FrequencyTest.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: android.util.Log
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)
... 25 more
Any ideas what is going wrong? I have been playing with my run configurations and in the classpath i have:
jre system library [jre7]
junit 4
Do you have the android sdk in your classpath? search for the jar containing the class android.util.Log in your classpath
regards
Grub
The answer was to make a new project and do testing in there instead, must make it an android junit test, and make sure the run configs are correct. thanks to Grub for your help
Seems like you are mixing Android SDK and Java SDK. You should not be doing that. Android is a self sufficient library.