NoClassDefFoundError: Не удалось инициализировать класс com.amazonaws.http.AmazonHttpClient - PullRequest
0 голосов
/ 20 апреля 2019

Я получаю следующее исключение при настройке верблюжьего маршрута для отправки сообщения в AWS на Red Hat Fuse 7.2.0 с camel-aws.Я выполнил maven -forcer-plugin и разрешил конфликты зависимостей, но все равно получаю то же исключение.Я также пробовал разные исключения и зависимости.Я включил мой оригинальный файл pom.xml.

jboss.fuse.version: 7.2.0.fuse-720035-redhat-00001

верблюжья версия: 2.21.0.fuse-720050-redhat-00001

Java 1.8

Кто-нибудь еще сталкивался с этим на Red Hat Fuse 7.2?

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.http.AmazonHttpClient
    at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:170) ~[281:org.apache.servicemix.bundles.aws-java-sdk:1.11.269.1]
    at com.amazonaws.services.sns.AmazonSNSClient.<init>(AmazonSNSClient.java:251) ~[281:org.apache.servicemix.bundles.aws-java-sdk:1.11.269.1]
    at com.amazonaws.services.sns.AmazonSNSClientBuilder.build(AmazonSNSClientBuilder.java:60) ~[281:org.apache.servicemix.bundles.aws-java-sdk:1.11.269.1]
    at com.amazonaws.services.sns.AmazonSNSClientBuilder.build(AmazonSNSClientBuilder.java:26) ~[281:org.apache.servicemix.bundles.aws-java-sdk:1.11.269.1]
    at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46) ~[281:org.apache.servicemix.bundles.aws-java-sdk:1.11.269.1]
    at com.my.package.aws.internal.SubSNSTemplateRoute.configure(SubSNSTemplateRoute.java:279) ~[300:com.my.package.aws.subsns:1.0.0.redhat-720035]
    at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:462) ~[60:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
    at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:402) ~[60:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
    at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:383) ~[60:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]

pom.xml

<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.my.package.aws</groupId>
        <artifactId>aws_templates</artifactId>
        <version>1.0.0.redhat-720035</version>
    </parent>

    <artifactId>subsns</artifactId>
    <packaging>bundle</packaging>

    <properties>
        <awsSDKVersion>1.11.289</awsSDKVersion>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jms</artifactId>
      </dependency>
      <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-aws</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-velocity</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-scr</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jasypt</artifactId>
        </dependency>
         <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>artemis-jms-client</artifactId>
       </dependency>

        <!-- logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>

        <!-- testing -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-test</artifactId>
        </dependency>
    </dependencies>

    <build>
        <!-- set filtering to true makes sure versions are replaced in the features.xml 
            file in the src/main/resources directory -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
                <artifactId>maven-java-formatter-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>features-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-features-to-repo</id>
                        <phase>install</phase>
                        <goals>
                            <goal>add-features-to-repo</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</descriptor>
                                <!-- Features included in this project's feature descriptor may depend 
                                    on other features -->
                                <!-- These other features can be found in one or more of following 
                                    list of feature descriptors -->
                                <descriptor>mvn:org.apache.karaf.features/enterprise/4.2.0.fuse-720061-redhat-00001/xml/features</descriptor>
                                        <descriptor>mvn:org.fusesource/activemq-karaf/7.2.0.fuse-720046-redhat-00001/xml/features</descriptor>  
                                        <descriptor>mvn:org.apache-extras.camel-extra.karaf/camel-extra/2.21.0.fuse-720050-redhat-00001/xml/features</descriptor>   
                                        <descriptor>mvn:org.apache.activemq/artemis-features/2.4.0.amq-711002-redhat-1/xml/features</descriptor>    
                                        <descriptor>mvn:org.apache.karaf.features/framework/4.2.0.fuse-720061-redhat-00001/xml/features</descriptor>    
                                        <descriptor>mvn:org.apache.karaf.features/spring-legacy/4.2.0.fuse-720061-redhat-00001/xml/features</descriptor>    
                                        <descriptor>mvn:org.apache.karaf.features/standard/4.2.0.fuse-720061-redhat-00001/xml/features</descriptor> 
                                        <descriptor>mvn:org.apache.cxf.karaf/apache-cxf/3.1.11.fuse-720057-redhat-00001/xml/features</descriptor>   
                                        <descriptor>mvn:org.jboss.fuse/fuse-karaf-framework/7.2.0.fuse-720035-redhat-00001/xml/features</descriptor>    
                                        <descriptor>mvn:org.apache.camel.karaf/apache-camel/2.21.0.fuse-720050-redhat-00001/xml/features</descriptor>   
                                        <descriptor>mvn:io.hawt/hawtio-karaf/2.0.0.fuse-720044-redhat-00001/xml/features</descriptor>   
                                                                        <!-- Some of these are not relevent for this project's features -->
                                        <descriptor>mvn:org.jboss.fuse.modules.patch/patch-features/7.2.0.fuse-720035-redhat-00001/xml/features</descriptor>    
                            </descriptors>
                            <features>
                                <feature>${project.artifactId}</feature>
                            </features>
                            <addTransitiveFeatures>true</addTransitiveFeatures>
                            <repository>${basedir}/target/local-repo</repository>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
            </plugin>

            <!-- testing -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
<!--                <testFailureIgnore>true</testFailureIgnore> -->
                    <includes>
                        <include>**/*Test*.java</include>
                    </includes>
                    <environmentVariables>
                        <FUSE_ENCRYPTION_PASSWORD>rosebud</FUSE_ENCRYPTION_PASSWORD> 
                    </environmentVariables>
                </configuration>
            </plugin>
            <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M2</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <skip>true</skip>
              <rules>
                <requireUpperBoundDeps>
                  <!-- 'uniqueVersions' (default:false) can be set to true if you want to compare the timestamped SNAPSHOTs  -->
                  <!-- <uniqueVersions>true</uniqueVersions> -->
                  <!-- If you wish to ignore certain cases:
                  <excludes>
                    <exclude>com.google.guava:guava</exclude>
                  </excludes>
                  -->
                </requireUpperBoundDeps>
                <!-- <DependencyConvergence/> -->
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
        </plugins>
    </build>
</project>
...