我正在尝试使用https://github.com/hucmaggie/camel-salesforce-integration的代码示例来学习驼峰式销售人员。我能够完成大部分代码(因为我一直在阅读其他培训材料)。但是当我执行部分时,它失败了。教程代码/配置非常简单,但在运行时失败并出现java.lang.ClassNotFoundException错误。
我做的第一步。
我还验证了[project directory] / 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$1.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>
答案 0 :(得分:0)
<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>
答案 1 :(得分:0)
我最近遇到了同样的问题,结果发现这是一个我失踪的简单步骤。
自动生成所有Salesforce类后,您必须从 org 文件夹中移动或复制它们到 src / main / java 文件夹。