You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by simholte <si...@yahoo.com> on 2013/11/26 18:15:22 UTC
camel-ejb in JBoss AS7
I'm trying to use the Camel EJB component to make a call to an EJB but I'm
having problems calling the bean with anything other then a String.
My Camel version is 2.12.1
When I expose an EJB like:
@Stateless
public class ProcessorService {
public String process(String argument) {
return "My String Plus Yours " + argument;
}
I can call it with the route:
<route>
<from uri="direct:start"/>
<to
uri="ejb:java:app/service/ProcessorService!com.morphotrust.poc.camel.ProcessorService
?method=process(${body})"/>
</route>
And everything works. Side question, the only way I could make it work is
by using the full JNDI address in my URI. Is there a better/best practice
way to register the beans look up information?
But when I try and call the EJB with a object I get a
NoTypeConversionException. I'm pretty sure the body of the in message is a
"Domain" object. For example if I add a method to the above EJB:
public String processAcme(Domain domain) {
return domain.toString();
}
And the error I get when calling the method in the route is:
CamelExecutionException: Exception occurred during execution on the
exchange: Exchange[Message: Domain [persons=[Person [name=your name, dob=Tue
Nov 26 09:28:05 CST 2013, age=11]]]]
org.apache.camel.NoTypeConversionAvailableException: No type converter
available to convert from type: com.acme.domain.Domain to the required type:
com.acme.domain.Domain with value Domain [persons=[Person [name=your name,
dob=Tue Nov 26 09:28:05 CST 2013, age=11]]]
I'm new to Camel so hopefully I'm just missing something obvious. Any help
would be great!
--
View this message in context: http://camel.465427.n5.nabble.com/camel-ejb-in-JBoss-AS7-tp5743866.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-ejb in JBoss AS7
Posted by simholte <si...@yahoo.com>.
You were definitely on to something. If I drop the ear packaging and move my
ejb into the war and deploy only that to AS7 everything works as expected.
Do you have any guidance how I should be packaging Camel into my EE6
application?
I'm going to try and move Camel out of the war file and into a standalone
ejb that I can include in my ear and be a dependency of the war.
--
View this message in context: http://camel.465427.n5.nabble.com/camel-ejb-in-JBoss-AS7-tp5743866p5743952.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-ejb in JBoss AS7
Posted by simholte <si...@yahoo.com>.
I use Camel-cdi to create my CamelContext in a simple .war file that also
exposes a REST endpoint. I then use a CamelProxy to inject data into my
Camel route when the REST endpoint is called. This war file and the ejb get
packaged up in a .ear file for deployment to AS7.
Below is a snippet from my POM that creates the ear
<dependencies>
<dependency>
<groupId>com.acme.poc.camel</groupId>
<artifactId>rest-poc</artifactId>
<version>${rest.poc.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.acme.poc.camel</groupId>
<artifactId>service</artifactId>
<version>${service.version}</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cdi</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ejb</artifactId>
<version>${camel.version}</version>
</dependency>
</dependencies>
Does this answer your question?
--
View this message in context: http://camel.465427.n5.nabble.com/camel-ejb-in-JBoss-AS7-tp5743866p5743894.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-ejb in JBoss AS7
Posted by "John D. Ament" <jo...@gmail.com>.
Sounds like a classloader issue. How are you packaging camel into your app?
On Tue, Nov 26, 2013 at 12:15 PM, simholte <si...@yahoo.com> wrote:
> I'm trying to use the Camel EJB component to make a call to an EJB but I'm
> having problems calling the bean with anything other then a String.
>
> My Camel version is 2.12.1
>
> When I expose an EJB like:
> @Stateless
> public class ProcessorService {
> public String process(String argument) {
> return "My String Plus Yours " + argument;
> }
>
> I can call it with the route:
> <route>
> <from uri="direct:start"/>
> <to
> uri="ejb:java:app/service/ProcessorService!com.morphotrust.poc.camel.ProcessorService
> ?method=process(${body})"/>
> </route>
>
> And everything works. Side question, the only way I could make it work is
> by using the full JNDI address in my URI. Is there a better/best practice
> way to register the beans look up information?
>
>
> But when I try and call the EJB with a object I get a
> NoTypeConversionException. I'm pretty sure the body of the in message is a
> "Domain" object. For example if I add a method to the above EJB:
>
> public String processAcme(Domain domain) {
> return domain.toString();
> }
>
> And the error I get when calling the method in the route is:
>
> CamelExecutionException: Exception occurred during execution on the
> exchange: Exchange[Message: Domain [persons=[Person [name=your name, dob=Tue
> Nov 26 09:28:05 CST 2013, age=11]]]]
>
> org.apache.camel.NoTypeConversionAvailableException: No type converter
> available to convert from type: com.acme.domain.Domain to the required type:
> com.acme.domain.Domain with value Domain [persons=[Person [name=your name,
> dob=Tue Nov 26 09:28:05 CST 2013, age=11]]]
>
> I'm new to Camel so hopefully I'm just missing something obvious. Any help
> would be great!
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-ejb-in-JBoss-AS7-tp5743866.html
> Sent from the Camel - Users mailing list archive at Nabble.com.