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

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

Related

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>

Maven default compile not picking up custom plugin goal

I have written a custom plugin, then I installed it. Then I modified the pom.xml of the project from which I want to use the custom plugin. When I invoke my plugin goal directly the plugin goal is executed successfully, but when I try to mvn compile my custom plugin goal is not executed. What might be the reason?
My plugin's 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>com.xxx.plugins.maven</groupId>
<artifactId>datanucleus-enhance-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Datanucleus-enhance Maven Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
My project using custom plugin I added following:
<!-- enhance JDO classes -->
<plugin>
<groupId>com.sukantu.plugins.maven</groupId>
<artifactId>datanucleus-enhance-maven-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<configuration>
<jdoClassDirList>
<param>target/${project.artifactId}-${project.version}/WEB-INF/classes/</param>
</jdoClassDirList>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
I followed section Attaching the Mojo to the Build Lifecycle from maven guide site: https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
The following command successfully calls my plugin goal:
mvn com.xxx.plugins.maven:datanucleus-enhance-maven-plugin:enhance
The following command does NOT successfully call my plugin goal:
mvn compile
Thanks for any inputs!
I came across this link:
How do I link a plugin execution to a phase in maven without forcing me to specify plugin on command line
So I removed <pluginManagement> tags so <plugins> appear directly under '<build>'. Then I tried 'mvn compile' from command line and it successfully called my custom plugin goal!
But when I checked pom.xml in Eclipse I saw another error referenced here How to solve “Plugin execution not covered by lifecycle configuration” .
Since the command line is working correctly, I think this is m2e Eclipse plugin error and so I have disabled the marked by going to 'Eclipse' -> 'Window' -> 'Show View' -> 'Markers' -> right click that marker -> 'Delete'. Now Eclipse is not showing any error and command line is also working as expected. Hope this helps someone else.

How to build GAE application for SDK v1.7.5 (with Maven)

I'm trying to make GAE 1.7.5 work with Maven:
<properties>
<gae.version>1.7.5</gae.version>
<gae-runtime.version>1.7.5.1</gae-runtime.version>
<maven.gae.plugin.version>0.9.6</maven.gae.plugin.version>
</properties>
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>${maven.gae.plugin.version}</version>
<configuration>
<unpackVersion>${gae.version}</unpackVersion>
<serverId>appengine.google.com</serverId>
<appDir>${webappDirectory}</appDir>
</configuration>
<dependencies>
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae-runtime.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
However there is this problem:
[WARNING] The POM for net.kindleit:maven-gae-plugin:jar:0.9.6 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for net.kindleit:maven-gae-plugin:0.9.6: Plugin net.kindleit:maven-gae-plugin:0.9.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for net.kindleit:maven-gae-plugin:jar:0.9.6
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
Then eventually, will end into BUILD FAILURE.
How to build my GAE against version 1.7.5 with Maven?
You can use the App Engine Maven Plugin. We also have a guestbook sample app on github.
The official appengine-maven-plugin supports 1.7.6, you could use the 1.7.5 version if you want, but 1.7.6 is current now.

GWT - Unable to find /path/to/war/WEB-INF/lib/shared?

I'm trying to use the Google Plugin for eclipse to run a GWT/GAE project as a web application, but I keep running into the error:
Unable to find path/to/war/WEB-INF/lib/shared
More specifically, I get:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.google.appengine.tools.util.Logging.initializeLogging(Logging.java:35)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:77)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.IllegalArgumentException: Unable to find path/to/war/WEB-INF/lib/shared
at com.google.appengine.tools.info.SdkInfo._getLibs(SdkInfo.java:76)
at com.google.appengine.tools.info.SdkInfo.getLibsRecursive(SdkInfo.java:69)
at com.google.appengine.tools.info.SdkInfo.determineSharedLibFiles(SdkInfo.java:302)
at com.google.appengine.tools.info.SdkInfo.init(SdkInfo.java:237)
at com.google.appengine.tools.info.SdkInfo.getSdkRoot(SdkInfo.java:190)
at com.google.appengine.tools.info.SdkImplInfo.<clinit>(SdkImplInfo.java:19)
I had this application running fine previously, but it's been a while since I've worked on it. The GWT code compiles fine. It's only on attempting to run the code in a development server that this error arises. Looking through my previous commits I don't seem to see a time when WEB-INF/lib/shared ever existed, so either this is some new requirement or shared was just never committed in the past.
The only "solution" I've found online claims that they fixed it by removing appengine-utils-client-1.0.jar and appengine-utils-server-1.0.jar. However, neither of these seem to be in my project, so I don't think this solution will help me.
Any suggestions? Thank you much.
I ran into this problem also, after upgrading to GAE 1.8.0. Removing the appengine-tools-api.jar from the WEB-INF/lib directory solved the problem.
For anyone having the same trouble, I just ended up creating a new GWT setup and copying in my src files, and WEB-INF files that I specifically created/modified.
I got the same error when using GWTUpload. The previous posts helped me get on the right track, although I didn't have the jars mentioned in my web-inf/lib. Finally solved it by adding a Maven exclusion for appengine-tools-sdk. So my final GWTUpload pom.xml Maven code is:
<!-- GWTUpload -->
<dependency>
<groupId>com.googlecode.gwtupload</groupId>
<artifactId>gwtupload</artifactId>
<version>0.6.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.gwtupload</groupId>
<artifactId>gwtupload-gae</artifactId>
<version>0.6.6</version>
<exclusions>
<!-- This exclusion got rid of the super hard to track down IllegalArgumentException on startup related to SdkInfo -->
<exclusion>
<artifactId>appengine-tools-sdk</artifactId>
<groupId>com.google.appengine</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.3</version>
</dependency>
</dependencies>

mvn-gae-plugin suddenly broken

I'm not sure what happened but I've made not changes to my pom and have only done a clean install but now running my app with mvn gae:run gives me the following error:
[ERROR] Failed to execute goal net.kindleit:maven-gae-plugin:0.9.4:run (default-cli) on project geoip-service: Execution default-cli of goal net.kindleit:maven-gae-plugin:0.9.4:run failed: Plugin net.kindleit:maven-gae-plugin:0.9.4 or one of its dependencies could not be resolved: Failed to collect dependencies for net.kindleit:maven-gae-plugin:jar:0.9.4 (): Failed to read artifact descriptor for net.kindleit:gae-runtime:pom:1.7.5: Could not find artifact net.kindleit:maven-gae-parent:pom:0.9.6-SNAPSHOT in genius (our_own_repo_here)
I'm using the 1.7.2 version of the sdk so I'm not sure where the 1.7.5 could be coming from.
For the time being, you can use this ugly hack
<properties>
<gae.version>1.7.5</gae.version>
<gae-runtime.version>1.7.5.1</gae-runtime.version>
</properties>
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>${maven.gae.plugin.version}</version>
<configuration>
<unpackVersion>${gae.version}</unpackVersion>
<serverId>appengine.google.com</serverId>
<appDir>${webappDirectory}</appDir>
</configuration>
<dependencies>
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae-runtime.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
I still don't know what the issue was, I.e. who was pulling in gae-runtime of version 1.7.5 but this is the work around that worked for me. Add the following under your maven-gae-plugin in profile/build/plugins/plugin etc.
<dependencies>
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>1.7.2</version>
<type>pom</type>
</dependency>
</dependencies>

Resources