Camel-salesforce Sobject 错误

Camel-salesforce Sobject error

我正在尝试使用 https://github.com/hucmaggie/camel-salesforce-integration 中的代码示例来学习 camel-salesforce。我能够遵循大部分代码(因为我一直在阅读其他培训材料)。但是当我执行部分时,它失败了。教程 code/config 非常简单,但是它在 运行 时因 java.lang.ClassNotFoundException 错误而失败。

步骤我做到了。

  1. 原始 git 代码无效(mvn Install failed with 依赖问题)。
  2. 所以我更新了 POM 使用骆驼版本 2.16.2(从 2.12.0.redhat-610394)并删除了 fusesource.org 存储库引用。
  3. Mvn 安装成功完成
  4. mvn camel:run 失败并出现以下错误

我还验证了 [项目目录]/target/classes 是否在正确的包文件夹 org/apache/camel/salesforce/dto 中也有 Account.class。在过去的 3 天里,我一直在寻找问题的线索,但没有成功。我有一种感觉,这是导致问题的非常愚蠢的事情,但我迷路了。希望有人能帮忙帮忙

    {message:'Error processing query: [0] "SObject class not found org.apache.camel.salesforce.dto.Account.class, org.apache.camel.salesforce.dto.Account.class"',statusCode:0}
at org.apache.camel.component.salesforce.internal.processor.AbstractRestProcessor.process(AbstractRestProcessor.java:157)
at org.apache.camel.component.salesforce.SalesforceProducer.process(SalesforceProducer.java:100)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165)
at org.apache.camel.component.timer.TimerConsumer.run(TimerConsumer.java:73)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
    Caused by: {message:'SObject class not found org.apache.camel.salesforce.dto.Account.class, org.apache.camel.salesforce.dto.Account.class',statusCode:0}
at org.apache.camel.component.salesforce.internal.processor.AbstractRestProcessor.setResponseClass(AbstractRestProcessor.java:666)
at org.apache.camel.component.salesforce.internal.processor.AbstractRestProcessor.processQuery(AbstractRestProcessor.java:450)
at org.apache.camel.component.salesforce.internal.processor.AbstractRestProcessor.process(AbstractRestProcessor.java:142)
... 12 more

    Caused by: java.lang.ClassNotFoundException: org.apache.camel.salesforce.dto.Account.class
at org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:80)
at org.apache.camel.component.salesforce.internal.processor.AbstractRestProcessor.setResponseClass(AbstractRestProcessor.java:663)
... 14 more

<?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>

  <groupId>org.blogdemo</groupId>
  <artifactId>camel-spring-salesforce</artifactId>
  <packaging>jar</packaging>
  <version>1.0.0-SNAPSHOT</version>

  <name>A Camel Spring Route</name>
  <url>http://www.myorganization.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <camel-version>2.16.2</camel-version>
    <camel2-version>2.15.1.redhat-621084</camel2-version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>${camel-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-spring</artifactId>
      <version>${camel-version}</version>
    </dependency>
    
    <!-- camel-salesforce -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-salesforce</artifactId>
      <version>${camel-version}</version>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test-spring</artifactId>
      <version>${camel-version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <defaultGoal>install</defaultGoal>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>

      <!-- allows the route to be ran via 'mvn camel:run' -->
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>${camel-version}</version>
      </plugin>
      
      <!-- camel -->
      <plugin>
        <groupId>org.apache.camel.maven</groupId>
        <artifactId>camel-salesforce-maven-plugin</artifactId>
        <version>${camel-version}</version>
      </plugin>
      
    </plugins>
  </build>

</project>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <org.apache.camel.version>2.16.0</org.apache.camel.version>
</properties>


<repositories>
    <repository>
        <id>release.redhat.com</id>
        <name>Red Hat Release Repository</name>
        <url>https://maven.repository.redhat.com/ga/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
    <repository>
        <id>release.fusesource.org</id>
        <name>FuseSource Release Repository</name>
        <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
    <repository>
        <id>ea.fusesource.org</id>
        <name>FuseSource Community Early Access Release Repository</name>
        <url>http://repo.fusesource.com/nexus/content/groups/ea</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
    <repository>
        <id>snapshot.fusesource.org</id>
        <name>FuseSource Snapshot Repository</name>
        <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>release.redhat.com</id>
        <name>Red Hat Release Repository</name>
        <url>https://maven.repository.redhat.com/ga/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
    <pluginRepository>
        <id>release.fusesource.org</id>
        <name>FuseSource Release Repository</name>
        <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
    <pluginRepository>
        <id>ea.fusesource.org</id>
        <name>FuseSource Community Early Access Release Repository</name>
        <url>http://repo.fusesource.com/nexus/content/groups/ea</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
    <pluginRepository>
        <id>snapshot.fusesource.org</id>
        <name>FuseSource Snapshot Repository</name>
        <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>

我最近遇到了同样的问题,结果发现我漏掉了一个简单的步骤。

在您自动生成所有 Salesforce 类 后,您必须将它们从 org 文件夹开始移动或复制到您的 src/main/java 文件夹。