camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-4517) got CastException when using endChoice() in Java DSL
Date Wed, 05 Oct 2011 08:43:34 GMT
got CastException when using endChoice() in Java DSL
----------------------------------------------------

                 Key: CAMEL-4517
                 URL: https://issues.apache.org/jira/browse/CAMEL-4517
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.8.1
         Environment: Windows XP, JDK 1.6, Eclipse IDE
            Reporter: Timothy


I am trying CBR pattern and using 'choice', 'when', 'to' and 'endChoice()'.
I can actually have the code compile, but always got cast exception when running it.

this really confused me, because I checked every steps and can't find any problems.
does anyone have similar situation?

here is my Camel route in JDSL:
=========================================================================
18     CamelContext context = new DefaultCamelContext();
19     ConnectionFactory connectionFacotyr = new ActiveMQConnectionFactory("tcp://P10118178-T400:61616");
20     context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFacotyr));
21     
22     context.addRoutes(new RouteBuilder() {
23          	public void configure() throws Exception {
24     		     from("jms:incomingOrders")
25		     .choice()
26			     .when(header("CamelFileName").endsWith(".crt"))
27				     .to("jms:crtQueue").endChoice()
28			     .when(header("CamelFileName").endsWith(".zpx"))
29				     .to("jms:zpxQueue");
30	     }
31     });
=========================================================================

pretty simple route. but always got an 'java.lang.ClassCastException' when I start the Camel
route.
the exception message as below: (the exception occurred at line 27)
=========================================================================
java.lang.ClassCastException: org.apache.camel.model.RouteDefinition cannot be cast to org.apache.camel.model.ChoiceDefinition
	at org.apache.camel.model.ProcessorDefinition.endChoice(ProcessorDefinition.java:1203)
	at SimpleTest$1.configure(SimpleTest.java:27)
	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
	at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:603)
	at SimpleTest.main(SimpleTest.java:22)
=========================================================================

Maven pom.xml:
=========================================================================
<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>com.pic.newigx.sample</groupId>
  <artifactId>rider.auto.parts.sample1.eip.filter1</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
  	<plugins>
  		<plugin>
  			<groupId>org.apache.camel</groupId>
  			<artifactId>camel-maven-plugin</artifactId>
  			<version>2.8.0</version>
  		</plugin>
  	</plugins>
  </build>
  <dependencies>
  	<dependency>
  		<groupId>org.apache.camel</groupId>
  		<artifactId>camel-jms</artifactId>
  		<version>2.8.1</version>
  	</dependency>
  	<dependency>
  		<groupId>org.apache.camel</groupId>
  		<artifactId>camel-spring</artifactId>
  		<version>2.8.1</version>
  	</dependency>
  	<dependency>
  		<groupId>org.apache.activemq</groupId>
  		<artifactId>activemq-core</artifactId>
  		<version>5.3.1</version>
  	</dependency>
  </dependencies>
</project>
=========================================================================


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message