2017-06-26 4 views
1

Ich verwende das AWS Java S3 SDK mit der folgenden Abhängigkeit.AWS Java SDK von Groovy Script - Provider com.bea.xml.stream.MXParserFactory nicht gefunden

<dependency> 
    <groupId>com.amazonaws</groupId> 
    <artifactId>aws-java-sdk-s3</artifactId> 
    <version>1.11.155</version> 
</dependency> 

Alles funktioniert super aus Java:

BasicAWSCredentials credentials = new BasicAWSCredentials(key, secret); 
AmazonS3 s3 = AmazonS3ClientBuilder 
    .standard() 
    .withCredentials(new AWSStaticCredentialsProvider(credentials)) 
    .withRegion(region) 
    .build(); 

Wenn ich versuche und tue genau, was durch ein starkes Drehbuch:

def credentials = new BasicAWSCredentials(key, secret); 
def s3 = AmazonS3ClientBuilder 
    .standard() 
    .withCredentials(new AWSStaticCredentialsProvider(credentials)) 
    .withRegion(s3region) 
    .build() 

ich eine Ausnahme erhalten:

Caught: javax.xml.stream.FactoryConfigurationError: 
Provider com.bea.xml.stream.MXParserFactory not found 

Explizit die Stax de hinzufügen Die Anhängigkeit zu meinem .pom beginnt mir anderswo widersprüchliche Klassen zu geben.

Gibt es einen Trick mit Groovy?

Antwort

0

Versuchen ohne stax-api:

@GrabConfig(systemClassLoader = true) 
@Grab('stax:stax:1.2.0') 
@GrabExclude('stax:stax-api') 

in nur stax Pulling gab mir:

java.lang.LinkageError: loader constraint violation: when resolving field "DATETIME" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the referring class, javax/xml/datatype/DatatypeConstants, and the class loader (instance of <bootloader>) for the field's resolved type, javax/xml/namespace/QName, have different Class objects for that type 

Die stax-api Abhängigkeit hat eine javax.xml.namespace.QName-Klasse, die mit Konflikten der von der JRE (https://docs.oracle.com/javase/7/docs/api/javax/xml/namespace/QName.html) zur Verfügung gestellte.

Verwandte Themen