You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by fvillavi <fv...@yahoo.com> on 2013/06/10 21:33:59 UTC

Incompatible types in Object mailBody = template.sendBody()

I am trying to run Apache Camel Tutorial Example Report incident Part 2.
Here are the instructions:

mvn test

And the result:

[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 4.690s
[INFO] Finished at: Mon Jun 10 12:12:58 ECT 2013
[INFO] Final Memory: 14M/83M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.0:compile (default-compile)
on project camel-example-reportincident: Compilation failure: Compilation
failure:
[ERROR]
/var/lib/jetty/webapps/camel-example-reportincident/src/main/java/ReportIncidentEndpointImpl.java:[33,43]
error: incompatible types

The segment of java code:

 public OutputReportIncident reportIncident(InputReportIncident parameters)
{
        // transform the request into a mail body
      .......
  
        Object mailBody = template.sendBody("velocity:MailBody.vm",
parameters);

Browsing the documentation, sendBody (....) is defined as void so it can't
return an object.

Software I am using:
Fedora 17
jdk 1.7
Apache Camel 2.11.0
Apache cxf 2.7.5
Apache maven 3.0.5
Spring 94.11

I don't know how to solve this problem, can some body help me?
Thanks.




--
View this message in context: http://camel.465427.n5.nabble.com/Incompatible-types-in-Object-mailBody-template-sendBody-tp5734074.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Incompatible types in Object mailBody = template.sendBody()

Posted by Christian Müller <ch...@gmail.com>.
As Camel is using GIT since a few weeks [1] [2], I run the following
commands in  my Camel GIT repo:

git checkout camel-2.11.0
cd examples/camel-example-reportincident
mvn clean test

[1] http://camel.apache.org/source.html
[2] http://camel.apache.org/2013/05/14/camel-moved-to-git.html

Best

Christian Müller
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Tue, Jun 11, 2013 at 10:32 PM, fvillavi <fv...@yahoo.com> wrote:

> Amazing!!!, Chris, which one You used, Distro o source code?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Incompatible-types-in-Object-mailBody-template-sendBody-tp5734074p5734113.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Incompatible types in Object mailBody = template.sendBody()

Posted by fvillavi <fv...@yahoo.com>.
Amazing!!!, Chris, which one You used, Distro o source code?



--
View this message in context: http://camel.465427.n5.nabble.com/Incompatible-types-in-Object-mailBody-template-sendBody-tp5734074p5734113.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Incompatible types in Object mailBody = template.sendBody()

Posted by Christian Müller <ch...@gmail.com>.
Did you download the Camel distro or did you checked out the source code?

It works for me and I got the following output (maven-compiler-plugin
version 2.5.1 and not 2.0):

[INFO]
------------------------------------------------------------------------
[INFO] Building Camel :: Example :: Report Incident 2.11.0
[INFO]
------------------------------------------------------------------------
...
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @
camel-example-reportincident ---
[INFO] Compiling 9 source files to
/Users/cmueller/workspaceCamel/camel/examples/camel-example-reportincident/target/classes
[INFO]
...
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------

Best,

Christian Müller
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Mon, Jun 10, 2013 at 9:33 PM, fvillavi <fv...@yahoo.com> wrote:

> I am trying to run Apache Camel Tutorial Example Report incident Part 2.
> Here are the instructions:
>
> mvn test
>
> And the result:
>
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 4.690s
> [INFO] Finished at: Mon Jun 10 12:12:58 ECT 2013
> [INFO] Final Memory: 14M/83M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.0:compile
> (default-compile)
> on project camel-example-reportincident: Compilation failure: Compilation
> failure:
> [ERROR]
>
> /var/lib/jetty/webapps/camel-example-reportincident/src/main/java/ReportIncidentEndpointImpl.java:[33,43]
> error: incompatible types
>
> The segment of java code:
>
>  public OutputReportIncident reportIncident(InputReportIncident parameters)
> {
>         // transform the request into a mail body
>       .......
>
>         Object mailBody = template.sendBody("velocity:MailBody.vm",
> parameters);
>
> Browsing the documentation, sendBody (....) is defined as void so it can't
> return an object.
>
> Software I am using:
> Fedora 17
> jdk 1.7
> Apache Camel 2.11.0
> Apache cxf 2.7.5
> Apache maven 3.0.5
> Spring 94.11
>
> I don't know how to solve this problem, can some body help me?
> Thanks.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Incompatible-types-in-Object-mailBody-template-sendBody-tp5734074.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Incompatible types in Object mailBody = template.sendBody()

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You should use requestBody instead of sendBody.

I assume you may have downloaded that old code which was attached as a
.zip file to the documentation of the tutorial?
If so that code is old as its about 5 years old when that tutorial was
written, and based on Camel 1.x API.

So basically in Camel 2.x you should use requestXXX if you want a
reply back. And sendXXX if its a one-way operation.

On Mon, Jun 10, 2013 at 9:33 PM, fvillavi <fv...@yahoo.com> wrote:
> I am trying to run Apache Camel Tutorial Example Report incident Part 2.
> Here are the instructions:
>
> mvn test
>
> And the result:
>
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 4.690s
> [INFO] Finished at: Mon Jun 10 12:12:58 ECT 2013
> [INFO] Final Memory: 14M/83M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.0:compile (default-compile)
> on project camel-example-reportincident: Compilation failure: Compilation
> failure:
> [ERROR]
> /var/lib/jetty/webapps/camel-example-reportincident/src/main/java/ReportIncidentEndpointImpl.java:[33,43]
> error: incompatible types
>
> The segment of java code:
>
>  public OutputReportIncident reportIncident(InputReportIncident parameters)
> {
>         // transform the request into a mail body
>       .......
>
>         Object mailBody = template.sendBody("velocity:MailBody.vm",
> parameters);
>
> Browsing the documentation, sendBody (....) is defined as void so it can't
> return an object.
>
> Software I am using:
> Fedora 17
> jdk 1.7
> Apache Camel 2.11.0
> Apache cxf 2.7.5
> Apache maven 3.0.5
> Spring 94.11
>
> I don't know how to solve this problem, can some body help me?
> Thanks.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Incompatible-types-in-Object-mailBody-template-sendBody-tp5734074.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