NoClassDefFoundError: com/google/appengine/api/urlfetch/ResponseTooLargeException - java

I am using Google + API to search for people using the following statement.
Plus plus = new Plus.Builder(httpTransport, jsonFactory, null).
setApplicationName("AppName").setGoogleClientRequestInitializer(new
PlusRequestInitializer(API_KEY)).build();
Plus.People.Search searchPeople = plus.people().search(personName).setMaxResults(1L);
PeopleFeed peopleFeed = searchPeople.execute();
I put the dependencies for the library in pom.xml so that it can be build when maven executed
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-plus</artifactId>
<version>v1-rev64-1.13.2-beta</version>
</dependency>
But I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/appengine/api/urlfetch/ResponseTooLargeException
at com.google.api.client.extensions.appengine.http.urlfetch.UrlFetchTransport.buildGetRequest(UrlFetchTransport.java:61)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:867)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:399)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
at com.google.PeopleSearch.googleAccountSearch(PeopleSearch.java:52)
at com.google.Search.main(Search.java:128)
Caused by: java.lang.ClassNotFoundException: com.google.appengine.api.urlfetch.ResponseTooLargeException
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)
Any suggestions?

I had a similar error NoClassDefFoundError: com/google/appengine/api/urlfetch/HTTPMethod , for me it was resolved by copying the App Engine SDK jar file from SDK/lib/user/appengine-api-1.0-sdk-1.9.27.jar into my project's WEB-INF/lib folder (I was not using Maven).

Related

ClassNotFoundException: org.apache.xerces.parsers.AbstractSAXParser when using boilerpipe

I am very new to boilerpipe and I am trying out the following basic code:
package contentExtraction;
import java.net.URL;
import de.l3s.boilerpipe.extractors.ArticleExtractor;
public class ContentExtractor {
public static void main(String[] args) throws Exception {
final URL url = new URL(
// "http://www.l3s.de/web/page11g.do?sp=page11g&link=ln104g&stu1g.LanguageISOCtxParam=en"
"http://www.dn.se/nyheter/vetenskap/annu-godare-choklad-med-hjalp-av-dna-teknik"
);
System.out.println(ArticleExtractor.INSTANCE.getText(url));
}
}
But I am getting the following error when trying to run the above piece of code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/parsers/AbstractSAXParser
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 de.l3s.boilerpipe.sax.BoilerpipeSAXInput.getTextDocument(BoilerpipeSAXInput.java:51)
at de.l3s.boilerpipe.extractors.ExtractorBase.getText(ExtractorBase.java:69)
at de.l3s.boilerpipe.extractors.ExtractorBase.getText(ExtractorBase.java:87)
at contentExtraction.ContentExtractor.main(ContentExtractor.java:16)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.AbstractSAXParser
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)
... 16 more
I googled the error and came across this link. I thought that I was missing xercesImpl.jar in my dependencies. I included the same, still my code is giving the same error. What is the issue?
I figured the solution myself. The boilerpipe jar has further dependencies. I converted my project to maven project, included the dependency:
<dependency>
<groupId>com.syncthemall</groupId>
<artifactId>boilerpipe</artifactId>
<version>1.2.1</version>
</dependency>
When I build the above project, I can see there are actually 4 jars that are imported in Maven Dependencies folder:
boilerpipe-1.2.1.jar
nekohtml-1.9.18.jar
xercesImpl-2.11.0.jar
xml-apis-1.4.01.jar

Exception in thread "main" java.lang.ExceptionInInitializerError caused by java.lang.RuntimeException: Unable to instance KieServices

I am trying to get started with Drools 6x, and in eclipse, I have created a Drools project, which creates the boilerplate code to run a simple drl.
I have the drools runtime installed via Eclipse.
I have drools libraries, drools-core-5.0.1.jar,kie-api-6.0.0.beta4.jar,kie-internal-6.0.0.beta2.jar as External jars in my project.
Yet, when I try to run the following, I get the following error:
java.lang.ExceptionInInitializerError
at com.sample.PetStoreExample.init(PetStoreExample.java:78)
at com.sample.PetStoreExample.main(PetStoreExample.java:67) Caused by: java.lang.RuntimeException: Unable to instance KieServices
at org.kie.api.KieServices$Factory.<clinit>(KieServices.java:137)
... 1 more Caused by: java.lang.ClassNotFoundException:org.drools.compiler.kie.builder.impl.KieServicesImpl 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 java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.kie.api.KieServices$Factory.<clinit>(KieServices.java:165)
... 1 more
If you downloaded the zip of Jars from http://www.drools.org/, you're going to want to include every jar from /binaries in your project. Even the ones that seem like you won't use.
I had this same problem too because I assumed I only needed to use a few Jars, but it turns out they all depend on classes from the other jars in that zip folder.
I had this problem because I had both kie-api and kie-ci as dependencies in my pom file. I removed the kie-ci dependency and I'm not getting this issue any more.

Upload an Object Using the AWS SDK for Java

I am using the following code from AWS documentation:
http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadObjSingleOpJava.html
And i have used the following jars :
And i am getting the following error :
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.amazonaws.AmazonWebServiceClient.(AmazonWebServiceClient.java:58)
at UploadObject.main(UploadObject.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
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
Any help would be appreciated for the same. I have tried adding the common logging jars but no luck.
Hi there are quite a few third-party library's required for AWS to work. The ones below are the extras packaged with the SDK download. I seem to remember there being one missing though so let me know if this doesn't work and i'll check my dependencys.
All of these can be found in '\aws-java-sdk-1.9.1\third-party'
aspectj-1.6
commons-codec-1.6
commons-logging-1.1.3
freemarker-2.3.1.8
httpcomponents-client-4.3
jackson-annotations-2.3.0
jackson-core-2.3.2
jackson-databind-2.3.2
javax-mail-1.4.6
joda-time-2.2
spring-3.0

eclipse errors while running custom code

While adding custom jar files in the project and executing some java code I am getting this error any idea how to solve this .There is no error in code ,it was running smoothly before this happen.
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
at com.util.DfExSession.connectToDocbase(DfExSession.java:18)## Heading ##
at com.console.TestConsole.main(TestConsole.java:17)
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.Signature
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
Look's like the aspectjrt.jar is missing in your classptah. Download & add it to your classpath.

How to upload files to google drive using java-Google Docs Api?

Already I used older version of the API to upload files to Google docs but now the API version is revised, so I couldn't upload.
Previously I used these lines for authorization:
DocsService service = new DocsService("MyDocumentsListIntegration-v1");
service.setUserCredentials(USERNAME, PASSWORD);
But now it is giving this error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
at sample.main(sample.java:15)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
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
Can anyone help me?
It seems like you are missing one of the external dependencies, mail.jar, which is part of Sun's JavaMail API.
Check this page for instructions on how to get it as well as all other external dependencies: https://developers.google.com/gdata/articles/java_client_lib

Categories

Resources