Setup GAE project with Resteasy using Maven in Eclipse - google-app-engine

I am trying to learn Maven and to that end I want to create a project in Eclipse 4.3 targetting the GAE (latest version: 1.8.4) and using Maven for building/dependency management. I want to include Resteasy and CDI, but for the time being I have problems with Resteasy.
What have I done:
Followed this guide (without the Jersey part) to setup a Maven/Eclipse/GAE project. I had to change the Java source and target configuration to 1.7 and it worked great.
To include Resteasy:
Added the following dependencies:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.7.Final</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.3.7.Final</version>
</dependency>
Implemented javax.ws.rs.core.Application.
And the following configuration in web.xml:
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>npara.expenses.server.JaxRsApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
When running the project, using the launch configuration created by Maven, I get the following exception:
java.lang.ClassNotFoundException:
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
The HttpServletDispatcher is located in resteasy-jaxrs-2.3.7.Final.jar, which is correctly placed in WEB-INF/lib. I already have created a similar project using GAE, Resteasy, CDI without Maven (manual JAR management) and this exact configuration and it works perfectly.
Any help appreciated!

Try to use Jersey it is easier to use.
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.9.1</version>
</dependency>

Related

Google App Engine Application Suddenly Stopped Working, returning 503

I have an application running on Google App Engine, I deployed the last version of latest version of the application on Sep 6, 2018 but today the application stopped serving request and it is returning error 503 with the following
<HTML>
<HEAD>
<TITLE>Service Unavailable</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Service Unavailable</H1>
<H2>Error 503</H2>
</BODY>
</HTML>
I thought it was because i have not migrated to the deprecated Cloud Endpoint v1.1 to V2.0
But after I made the changes necessary for migration, when I try to deploy it still returns 503 while running the Maven command to deploy or generate Docs.
I am aware that Google stated that they are experiencing issues with some App Engine regions yesterday but I am not sure if it has anything to do with what I am experiencing.
My App engine application is using Us-central region.
Update: Looks like cloud endpoint V1.1 has been turned off and can no longer serve traffic so following the migration guide, I have been able to migrate to version 2.0 but unfortunately I am getting an error with the api-discovery doc
This is the error
500
API discovery response missing required fields.
I am trying to get around this
here is my pom.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>group-id</groupId>
<artifactId>artifact-id</artifactId>
<properties>
<app.id>project-id</app.id>
<app.version>1</app.version>
<appengine.version>1.9.64</appengine.version>
<gcloud.plugin.version>2.0.9.121.v20160815</gcloud.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<jackson.version>2.9.0</jackson.version>
<archiveClasses>true</archiveClasses>
</properties>
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
<dependencies>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Objectify library ready -->
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>6.0</version>
</dependency>
<!-- Apache Commons Library -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<!-- Add support for joda money library -->
<dependency>
<groupId>org.joda</groupId>
<artifactId>joda-money</artifactId>
<version>0.10.0</version>
</dependency>
<!--Added support for joda time library -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<!-- end joda time api.-->
<!-- Load scrypt library for password encryption and decryption -->
<dependency>
<groupId>com.lambdaworks</groupId>
<artifactId>scrypt</artifactId>
<version>1.4.0</version>
</dependency>
<!-- Objectify utils to help us with currency -->
<dependency>
<groupId>com.sappenin.objectify</groupId>
<artifactId>objectify-utils</artifactId>
<version>5.1.3</version>
</dependency>
<!-- google guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<!-- Apache poi for excel file processing -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<!-- jackson-dataformat-csv-->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.7.0</version>
</dependency>
<!-- jackson data bind library for json -->
<!-- Google cloud storage ends -->
<!-- google cloud storage client -->
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
<exclusions>
<exclusion>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-appengine</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>0.4.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-appengine</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<!-- Mail Dependencies with MailGun -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.19.1</version>
</dependency>
<!-- End Mail Dependencies with MailGun -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker-gae</artifactId>
<version>2.3.25-incubating</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<!-- Note: core-annotations version x.y.0 is generally compatible with
(identical to) version x.y.1, x.y.2, etc. -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application-->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<stage.enableJarClasses>true</stage.enableJarClasses>
<cloudSdkPath>/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk</cloudSdkPath>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<!-- deploy configuration -->
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>endpoints-framework-maven-plugin</artifactId>
<version>1.0.2</version>
<configuration>
<!-- plugin configuration -->
<hostname>project-id.appspot.com</hostname>
</configuration>
<executions>
<execution>
<goals>
<goal>discoveryDocs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Here is my web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Endpoints web.xml -->
<!-- [START web] -->
<servlet>
<display-name>Remote API Servlet</display-name>
<servlet-name>RemoteApiServlet</servlet-name>
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Grader</servlet-name>
<servlet-class>com.softquest.apollo.servlets.Grader</servlet-class>
</servlet>
<servlet>
<servlet-name>SheetHandler</servlet-name>
<servlet-class>com.softquest.apollo.servlets.SheetHandler</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RemoteApiServlet</servlet-name>
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>
<!-- Score Sheet Servlet -->
<!-- Remote Api Servlet -->
<servlet>
<servlet-name>EndpointsServlet</servlet-name>
<servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.softquest.apollo.services.UserServices</param-value>
</init-param>
</servlet>
<!-- Payment Response Servlet -->
<servlet>
<servlet-name>PaymentResponseServlet</servlet-name>
<servlet-class>com.softquest.apollo.servlets.PaymentResponseServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PaymentResponseServlet</servlet-name>
<url-pattern>/PaymentResponse</url-pattern>
</servlet-mapping>
<!-- Payment Response Servlet-->
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
<!-- Objectify filter registration -->
<filter>
<filter-name>ObjectifyFilter</filter-name>
<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ObjectifyFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Setup ServletContextListener to start up objectify entities on application -->
<servlet>
<servlet-name>BackEndStarter</servlet-name>
<servlet-class>com.softquest.apollo.BackEndStarter</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>BackEndStarter</servlet-name>
<url-pattern>/backend/starter</url-pattern>
</servlet-mapping>
<!-- Migration servlet -->
<servlet>
<servlet-name>MigrationServlet</servlet-name>
<servlet-class>com.softquest.apollo.servlets.MigrationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MigrationServlet</servlet-name>
<url-pattern>/migration/*</url-pattern>
</servlet-mapping>
<!-- Migration Servlet-->
<!-- Migration Handler Servlet -->
<servlet>
<servlet-name>MigrationHandler</servlet-name>
<servlet-class>com.softquest.apollo.servlets.MigrationHandler</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MigrationHandler</servlet-name>
<url-pattern>/migration-handler/*</url-pattern>
</servlet-mapping>
<!-- End of Migration handler Servlet-->
<!-- Setup web.xml to start up context listener -->
<servlet-mapping>
<servlet-name>Grader</servlet-name>
<url-pattern>/Grader</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SheetHandler</servlet-name>
<url-pattern>/SheetHandler</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
I get this error when trying to call the api discovery doc, I have traced it to a null pointer error on line 72 of the
com.google.api.server.spi.EndpointsServlet file
if (!dispatcher.dispatch(method, path, context)) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
response.getWriter().append("Not Found");
}
I am guessing the error is released to some third party library probably still using any of the older cloud endpoint maven dependencies or plugins. So I would remove all the dependencies from my pom.xml and try to deploy.
UPDATE:
I was able to fix the API discovery error, it was caused by a reflection error that had to do with the Google Guava Library, while the migration Doc had stated that Version 19 would work, it didn't, upgrading to version 20 and above fixed that for me, now I am getting error 404 on all the endpoints. I would write an answer when I am able to fix this.
Im getting the same problem on an endpoint that hasn't been changed in months, nothing is appearing in the logs either. I assume its probably an app engine problem.
EDIT
I fixed our problem, though you mention the you've attempted to update to the new Cloud Endpoint v2.0 and you are still having the problem it turns out for our project following the migration steps from v1.1 to v2 fixed the problem https://cloud.google.com/endpoints/docs/frameworks/python/migrating.
The docs say v1.1 was to be turned off August 2nd, I guess they have just got round to it
I have successfully migrated to Endpoints V2 after series of hit and trial method.
App Engine project developed on Android Studio has following structure-
project
app
backend
build.gradle
I have to change build.gradle in all 3 places. Where project is root project, app is android app, backend is App Engine app. All of these have thier own build.gradlew.
Let's change one by one.
/app/build.gradle (Make changes in the android client)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.+'
// Remove this line
//compile project(path: ':micirclews', configuration: 'android-endpoints')
}
Apply the endpoints plugin after the android plugin
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
/backend/build.gradle (Make changes in the backend/appengine module)
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
//Remove this
//classpath 'com.google.appengine:gradle-appengine-plugin:1.9.59'
//Add these two lines
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
}
}
Remove this- apply plugin: 'appengine'
Add these two-
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
dependencies {
//Remove these 3 lines-
//appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.59'
//compile 'com.google.appengine:appengine-endpoints:1.9.59'
//compile 'com.google.appengine:appengine-endpoints-deps:1.9.59'
//Add these 2 lines-
compile 'com.google.endpoints:endpoints-framework:2.0.9'
compile 'javax.inject:javax.inject:1'
.....
}
// delete this whole block, it's configuration for the older plugin
// appengine {
// downloadSdk = true
// appcfg {
// oauth2 = true
// }
// endpoints {
// getClientLibsOnBuild = true
// getDiscoveryDocsOnBuild = true
// }
// }
/build.gradle (Make changes in the root's build.gradle)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
//Add these 2 lines
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
}
}
After making all the changes carefully, Clean the project, Rebuild it and run it. Finally deploy it when everything work perfect.
You may refer the whole process here -
https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/blob/master/ANDROID_README.md
As saiyr stated in the comments, Google Cloud Endpoints v1.1 has been completely deprecated and has stopped serving traffic and that is the reason for the errors I was having.
I solved this problem by migrating to cloud endpoints v2, the process is as easy as following the guide in the migration docs but here are some issues I had with Migration and how I fixed it.
Google guava library has to be updated to a version greater than version 19, using version 19 or lower could result in the application throwing reflection errors when handling requests.
If you have multiple service classes they have to be added to the web.xml file as service parameters while declaring the com.google.api.server.spi.EndpointsServlet Servlet.
for some reasons listing only one service class worked for me in cloud endpoint 1.0 Api docs and routes were generated for all the service classes I had without declaring everyone of them explicitly under the com.google.api.server.spi.SystemServiceServlet Servlet, I think it has something to do with Objectify filters though. See the Docs for more info
Since the Google App Engine Java 7 runtime is deprecated too, I decided to migrate to Java 8 but unfortunately the library I used to abstract the process of connecting to datastore (Objectify) appears not to work with the Java 8 runtime, I would look into this later, but reverting back to Java 7 runtime worked for me and the application is back up and running.
Update: The issue I faced migrating to Java 8 runtime had nothing to do with Objectify, the library I used for encrypting passwords (BCrypt) was the issue, it just did not work on the Google App Engine Java 8 runtime, I had to switch to the Encryption library in spring security.

Flink application writing to S3a filesystem failed due to AWS credential not found from any loader

I trying to do migration from S3n to S3a for my Flink application.
I have written my custom rolling sink for writing data into aws S3. Its accepts URL as base path like S3a:///.
Its works for S3n and when i did following changes for S3a, its throws following exception.
Its seems like core-site.xml is not picking up incase of S3a for AWS credential.
its using AWS default loader for loading the credentials.
Please let me know what configuration is missing for this. Right now i am running in eclipse development enviornment,how its works in flink cluster mode?
Exception is:
com.amazonaws.AmazonClientException: Unable to load AWS credentials from any provider in the chain
at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:117)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3521)
at com.amazonaws.services.s3.AmazonS3Client.headBucket(AmazonS3Client.java:1031)
at com.amazonaws.services.s3.AmazonS3Client.doesBucketExist(AmazonS3Client.java:994)
at org.apache.hadoop.fs.s3a.S3AFileSystem.initialize(S3AFileSystem.java:297)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2316)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:90)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2350)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2332)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:369)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:296)
at com.abc.abc.common.sinks.CustomRollingSink.open(CustomRollingSink.java:260)
I am using the flink 1.0.0 version and following dependecies into the project pom file and core-site .xml for AWS credentials.
<property>
<name>fs.s3a.awsAccessKeyId</name>
<value>value..</value>
</property>
<property>
<name>fs.s3a.awsSecretAccessKey</name>
<value>values...</value>
</property>
<property>
<name>fs.s3a.impl</name>
<value>org.apache.hadoop.fs.s3a.S3AFileSystem</value>
</property>
Pom file:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aws</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.2.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.6.3</version>
</dependency>

NoSuchMethodError on DeferredFileOutputStream when called from RestEasy ApacheHttpClient4Engine

I have looked at a few links which seems related with no luck:
*How to solve this java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream?
*RESTEasy Client + NoSuchMethodError
The exception reads:
Caused by: java.lang.NoSuchMethodError:
org.apache.commons.io.output.DeferredFileOutputStream.(ILjava/lang/String;Ljava/lang/String;Ljava/io/File;)V
at
org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.writeRequestBodyToOutputStream(ApacheHttpClient4Engine.java:554)
at
org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.buildEntity(ApacheHttpClient4Engine.java:524)
The dependencies I have are:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.7.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.7.Final</version>
</dependency>
System is running on JDK 1.7, JBoss 5.1 GA with ESB modules.
Thanks
Late but but last update.. this method was found inside the JBoss application server; when I replaced this jar inside JBoss with the same (was using v1.4) then there was no more exceptions such as above
You are missing a dependency. You need to add commons-io to your pom.xml:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>

Error when doing "mvn gae:run" using Spring Roo on Google App Engine with GWT

There seems to be a problem with Spring Roo, GAE, and GWT.
Here is a simple roo script.
project --topLevelPackage com.my.gae --projectName gaetest --java 6
persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE
entity jpa --class ~.domain.Person
field string --fieldName name
web gwt setup
web gwt all --proxyPackage ~.proxy --requestPackage ~.request
web gwt gae update
logging setup --level DEBUG
roo script <path-to-above-script>
Fix a bug in the pom by adding <scope>runtime</scope> to the datanucleus-core dependency
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.7</version>
<scope>runtime</scope>
</dependency>
3. mvn gae:run
There will be many errors.
[INFO] Checking rule
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/req
uest/ApplicationRequestFactory.java'
[INFO] [ERROR] Line 11: No source code is available for type com.my.gae.request.PersonRequest; did you
forget to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationDetailsActivities_Roo_Gwt.java'
[INFO] [ERROR] Line 29: No source code is available for type com.my.gae.proxy.PersonProxy; did you for
get to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationMasterActivities_Roo_Gwt.java'
I am using 1.2.1.RELEASE [rev 6eae723] of Roo.
Is there a workaround or perhaps I have made an error ?
I was getting several errors as well when trying to create GWT application for the Google App Engine using Spring Roo 1.2.1. I created my project using the SpringSource Tool Suite (STS). Took me forever, but I finally got it working by making some changes to my pom.xml.
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>3.0.7</version>
</dependency>
I also enabled Datanucleus Support (right click on project, Datanucleus -> Add Data Nucleus Support), then enhanced the classes manually (right click on project, Datanucleus -> Run Enhancer Tool). These Datanucleus steps failed without the preceding pom.xml changes.
The application launches fine. However, now I can't get the RequestValidationTool to work.

Faild to read artifact descriptor error while adding resteasy-jaxb-provider

I am learing REST throught java using JBoss RestEasy. To use JAXB api implementation I given the following dependency in pom.xml, {I am using maven project in eclipse}
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.1.GA</version>
</dependency>
But I am getting some set of build errors. But the below is the root cause of the errors I guess,
ArtifactDescriptorException: Failed to read artifact descriptor for javax.xml.stream:stax-api:jar:1.0-2:
ArtifactResolutionException: Failure to transfer javax.xml.stream:stax-api:pom:1.0-2 from
http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval
of central has elapsed or updates are forced.
Original error: Could not transfer artifact javax.xml.stream:stax-api:pom:1.0-2 from/to central (http://repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.pom
By the above error I understand that it failed to transfer the stax-api depency file. I added the dependency for that stax-api later. But no use. Still getting the same error.
Is my perception of the above error correct? If so do I have to give the repository info for this file too in pom.xml? Then is it not contradicting the main advantage of Maven usage(auto download of dependency files)?
Please correct me if I were wrong
Below is my complete pom.xml,
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.droidaceapps.services</groupId>
<artifactId>RestServicesProject</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>RestServicesProject Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.1.GA</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.1.GA</version>
</dependency>
</dependencies>
<build>
<finalName>RestServicesProject</finalName>
</build>
</project>
Thanks
Hurrah...I solved this. I did execute the MVN from command line .. it just worked. Then I went back to eclipse and refreshed the project then all the bugs gone and all dependancies are in place.
seems there is a problem with the m2eclipse plugin (whichi I conculde as root cause of the bug.. :-)
i solved this problem....not using maven.......just by creating a Dynamic web project...with jboss server..with web.xml
and then...go to source > new >other >web service > create a sample restful web serivce
click to update the web.xml......and it support jboss in eclipse

Resources