You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by luixv <lu...@gmail.com> on 2013/06/27 14:38:17 UTC

Camel Aggregator Exception

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
	xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:camel="http://camel.apache.org/schema/spring"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
       http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

	<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
		persistent="false">
		<transportConnectors>
			<transportConnector uri="tcp://localhost:61616" />
		</transportConnectors>
	</broker>

	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
		<property name="brokerURL" value="failover:tcp://localhost:61616" />
	</bean>

	<bean id="aggregatorStrategy"
class="org.apache.camel.processor.BodyInAggregatingStrategy" />

	<camelContext xmlns="http://camel.apache.org/schema/spring">
		<camel:route>
			<camel:from uri="file:/inputdir" />
			<camel:aggregate strategyRef="aggregatorStrategy"
				completionSize="3">
				<camel:correlationExpression>
					<camel:simple>header.id</camel:simple>
				</camel:correlationExpression>
				<camel:to uri="file:/outdir" />
			</camel:aggregate>
		</camel:route>
	</camelContext>
</beans>

My pom.xml is as follows:

<?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>example</groupId>
  <artifactId>aggregator</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <name>Camel Web Console Application</name>
  <description>Example</description>
  <url>http://www.myorganization.org</url>

  <packaging>war</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-web</artifactId>
      <version>2.11.0</version>
      <type>war</type>
      <scope>runtime</scope>
    </dependency>

    
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-camel</artifactId>
      <version>5.8.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jms_1.1_spec</artifactId>
      <version>1.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.xbean</groupId>
      <artifactId>xbean-spring</artifactId>
      <version>3.13</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-jms</artifactId>
      <version>2.11.0</version>
    </dependency>

    
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-stream</artifactId>
      <version>2.11.0</version>
    </dependency>

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

    
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test-spring</artifactId>
      <version>2.11.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    	<groupId>org.apache.camel</groupId>
    	<artifactId>camel-csv</artifactId>
    	<version>2.10.4</version>
    </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>

       
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>7.6.8.v20121106</version>
        <configuration>
          <webAppConfig>
            <contextPath>/</contextPath>
          </webAppConfig>
          <systemProperties>
            
            <systemProperty>
              <name>com.sun.management.jmxremote</name>
              <value/>
            </systemProperty>
          </systemProperties>
          <scanIntervalSeconds>10</scanIntervalSeconds>
        </configuration>
      </plugin>

    </plugins>
  </build>

</project>


The exception is as follows:

27.06.2013 14:28:07 org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
27.06.2013 14:28:07 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
27.06.2013 14:28:11 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Exception sending context initialized event to listener
instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'activemq' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'camel-1': Invocation of init method failed; nested
exception is org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [org.apache.camel.processor.BodyInAggregatingStrategy] for
bean with name 'aggregatorStrategy' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]; nested exception is
java.lang.ClassNotFoundException:
org.apache.camel.processor.BodyInAggregatingStrategy

Since a couple of days I am struggling with this problem.
What am I doing wrong?

Thanks in advance.

Luis




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Aggregator-Exception-tp5734896.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Aggregator Exception

Posted by Claus Ibsen <cl...@gmail.com>.
You have a class not found exception

java.lang.ClassNotFoundException:
org.apache.camel.processor.BodyInAggregatingStrategy

The idea is that you create your own custom aggregation strategy where
you "merge" the data together.

Read about the aggregate EIP pattern to learn more
http://camel.apache.org/aggregator2

On Thu, Jun 27, 2013 at 2:38 PM, luixv <lu...@gmail.com> wrote:
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
>         xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:camel="http://camel.apache.org/schema/spring"
>         xmlns:p="http://www.springframework.org/schema/p"
>         xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>        http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context.xsd
>        http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd
>        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>         <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
>                 persistent="false">
>                 <transportConnectors>
>                         <transportConnector uri="tcp://localhost:61616" />
>                 </transportConnectors>
>         </broker>
>
>         <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                 <property name="brokerURL" value="failover:tcp://localhost:61616" />
>         </bean>
>
>         <bean id="aggregatorStrategy"
> class="org.apache.camel.processor.BodyInAggregatingStrategy" />
>
>         <camelContext xmlns="http://camel.apache.org/schema/spring">
>                 <camel:route>
>                         <camel:from uri="file:/inputdir" />
>                         <camel:aggregate strategyRef="aggregatorStrategy"
>                                 completionSize="3">
>                                 <camel:correlationExpression>
>                                         <camel:simple>header.id</camel:simple>
>                                 </camel:correlationExpression>
>                                 <camel:to uri="file:/outdir" />
>                         </camel:aggregate>
>                 </camel:route>
>         </camelContext>
> </beans>
>
> My pom.xml is as follows:
>
> <?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>example</groupId>
>   <artifactId>aggregator</artifactId>
>   <version>0.0.1-SNAPSHOT</version>
>
>   <name>Camel Web Console Application</name>
>   <description>Example</description>
>   <url>http://www.myorganization.org</url>
>
>   <packaging>war</packaging>
>
>   <properties>
>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>
> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
>   </properties>
>
>   <dependencies>
>     <dependency>
>       <groupId>org.apache.camel</groupId>
>       <artifactId>camel-web</artifactId>
>       <version>2.11.0</version>
>       <type>war</type>
>       <scope>runtime</scope>
>     </dependency>
>
>
>     <dependency>
>       <groupId>org.apache.activemq</groupId>
>       <artifactId>activemq-camel</artifactId>
>       <version>5.8.0</version>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.geronimo.specs</groupId>
>       <artifactId>geronimo-jms_1.1_spec</artifactId>
>       <version>1.1.1</version>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.xbean</groupId>
>       <artifactId>xbean-spring</artifactId>
>       <version>3.13</version>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.camel</groupId>
>       <artifactId>camel-jms</artifactId>
>       <version>2.11.0</version>
>     </dependency>
>
>
>     <dependency>
>       <groupId>org.apache.camel</groupId>
>       <artifactId>camel-stream</artifactId>
>       <version>2.11.0</version>
>     </dependency>
>
>
>     <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>
>
>
>     <dependency>
>       <groupId>org.apache.camel</groupId>
>       <artifactId>camel-test-spring</artifactId>
>       <version>2.11.0</version>
>       <scope>test</scope>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-csv</artifactId>
>         <version>2.10.4</version>
>     </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>
>
>
>       <plugin>
>         <groupId>org.mortbay.jetty</groupId>
>         <artifactId>jetty-maven-plugin</artifactId>
>         <version>7.6.8.v20121106</version>
>         <configuration>
>           <webAppConfig>
>             <contextPath>/</contextPath>
>           </webAppConfig>
>           <systemProperties>
>
>             <systemProperty>
>               <name>com.sun.management.jmxremote</name>
>               <value/>
>             </systemProperty>
>           </systemProperties>
>           <scanIntervalSeconds>10</scanIntervalSeconds>
>         </configuration>
>       </plugin>
>
>     </plugins>
>   </build>
>
> </project>
>
>
> The exception is as follows:
>
> 27.06.2013 14:28:07 org.apache.catalina.core.ApplicationContext log
> INFO: No Spring WebApplicationInitializer types detected on classpath
> 27.06.2013 14:28:07 org.apache.catalina.core.ApplicationContext log
> INFO: Initializing Spring root WebApplicationContext
> 27.06.2013 14:28:11 org.apache.catalina.core.StandardContext listenerStart
> SCHWERWIEGEND: Exception sending context initialized event to listener
> instance of class org.springframework.web.context.ContextLoaderListener
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'activemq' defined in ServletContext resource
> [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested
> exception is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'camel-1': Invocation of init method failed; nested
> exception is org.springframework.beans.factory.CannotLoadBeanClassException:
> Cannot find class [org.apache.camel.processor.BodyInAggregatingStrategy] for
> bean with name 'aggregatorStrategy' defined in ServletContext resource
> [/WEB-INF/applicationContext.xml]; nested exception is
> java.lang.ClassNotFoundException:
> org.apache.camel.processor.BodyInAggregatingStrategy
>
> Since a couple of days I am struggling with this problem.
> What am I doing wrong?
>
> Thanks in advance.
>
> Luis
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Aggregator-Exception-tp5734896.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen