camel + service mix + spring aspect

by akshay_ajmanion 2009-07-02T13:47:24+00:00

Hi,

I have implemented the following example
http://cwiki.apache.org/SM/order-file-processing.html and it is working
fine. I need to add few modifications to my camel context.xml. My question
is , is it possible to add spring aspects to camel-context.xml i.e








org.camel.su




I have my pointcuts defined in the java code using spring annotations.
The code is as follows:
@Aspect
public class SystemArchitecture {


@Pointcut("execution(* *(..))")
public void myFirstPointCut()
{

}
}
package org.aspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class FirstAspect {

@Around("SystemArchitecture.myFirstPointCut()")
public void firstAspect(ProceedingJoinPoint joinPoint)
{
System.out.println("PRINTING FIRST ASPECT");
try {
joinPoint.proceed();
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

If defining aspects in camel-context.xml is possible, then how do I define
aspects on my RouteBuilder class.Because I want a particular piece of code
to be always executed before my route builder class is called and I do not
want to embed that code in the routebuilder class.
For ex: If I do some thing like this below,













public class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
System.out.println("IN ROUTE BUILDER#####");

// from our camelService which is called by the file poller

from("jbi:service:http://servicemix.apache.org/example/orderProcessing")
// we process the received order xml
.process(new OrderProcessor())
// and send the result xml back to the file sender
.to("jbi:service:http://servicemix.apache.org/example/fileSender");


}


}
I get an exception is saying that routeBuilder should of type
org.apache.camel.builder.RouteBuilder. I do not understand why I am getting
this exception as my RouteBuilder class is already extending the camel
RouteBuilder class.
Please help me these queries.I thank you all for your time.

--
View this message in context: http://www.nabble.com/camel-%2B-service-mix-%2B-spring-aspect-tp24307030p24307030.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel + service mix + spring aspect

by Claus Ibsenon 2009-07-03T11:28:35+00:00.
Hi
What version of Camel are you using?
There was an issue with 1.6.0 or older not being able to be IoC in
some circumstances if the bean was a RouteBuilder instance.
And thats the case with your route builder.
However when using proxy it can be on interface or class level. And
aspectj looks like it does at classlevel so hence something can go
wrong when Camel is not able to see it as a RouteBuilder instance.
On Thu, Jul 2, 2009 at 3:46 PM, akshay_ajmani wrot=
e:
>
> Hi,
>
> =A0 =A0I have implemented the following example
> http://cwiki.apache.org/SM/order-file-processing.html and it is working
> fine. I need to add few modifications to my camel context.xml. My questio=
n
> is , is it possible to add spring aspects to camel-context.xml i.e
>
>
>
> =A0 =A0 =A0 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
> =A0 =A0 =A0 xmlns:aop=3D"http://www.springframework.org/schema/aop"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0xmlns:context=3D"http://www.springframewor=
k.org/schema/context"
> =A0 =A0 =A0 xsi:schemaLocation=3D"
> =A0 =A0 =A0 http://www.springframework.org/schema/beans
> =A0 =A0 =A0 http://www.springframework.org/schema/beans/spring-beans-2.5.=
xsd
> =A0 =A0 =A0 http://activemq.apache.org/camel/schema/spring
> =A0 =A0 =A0 http://activemq.apache.org/camel/schema/spring/camel-spring.x=
sd
> =A0 =A0 =A0 http://www.springframework.org/schema/aop
> =A0 =A0 =A0 http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> =A0 =A0 =A0 http://www.springframework.org/schema/context
>
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>
>
> =A0 =A0 =A0
>
> =A0 =A0 =A0 =A0
>
>
>
> =A0 xmlns=3D"http://activemq.apache.org/camel/schema/spring">
> =A0 =A0 =A0 =A0 =A0 org.camel.su
> =A0
> =A0
>
>
>
>
>
> I have my pointcuts defined in the java code using spring annotations.
>
> The code is as follows:
>
> @Aspect
> public class SystemArchitecture {
>
>
>
> =A0 =A0 =A0 =A0@Pointcut("execution(* *(..))")
> =A0 =A0 =A0 =A0public void myFirstPointCut()
> =A0 =A0 =A0 =A0{
>
> =A0 =A0 =A0 =A0}
>
> }
>
> package org.aspect;
>
> import org.aspectj.lang.ProceedingJoinPoint;
> import org.aspectj.lang.annotation.Around;
> import org.aspectj.lang.annotation.Aspect;
>
> @Aspect
> public class FirstAspect {
>
>
> =A0 =A0 =A0 =A0@Around("SystemArchitecture.myFirstPointCut()")
> =A0 =A0 =A0 =A0public void firstAspect(ProceedingJoinPoint joinPoint)
> =A0 =A0 =A0 =A0{
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0System.out.println("PRINTING FIRST ASPECT"=
);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0try {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0joinPoint.=
proceed();
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} catch (Throwable e) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// TODO Auto-generated cat=
ch block
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0e.printStackTrace();
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0}
> }
>
>
>
>
> If defining aspects in camel-context.xml is possible, then how do I defin=
e
> aspects on my RouteBuilder class.Because I want a particular piece of cod=
e
> to be always executed before my route builder class is called and I do no=
t
> want to embed that code in the routebuilder class.
>
> For ex: If I do some thing like this below,
>
>
> =A0 =A0 =A0 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
> =A0 =A0 =A0 xmlns:aop=3D"http://www.springframework.org/schema/aop"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0xmlns:context=3D"http://www.springframewor=
k.org/schema/context"
> =A0 =A0 =A0 xsi:schemaLocation=3D"
> =A0 =A0 =A0 http://www.springframework.org/schema/beans
> =A0 =A0 =A0 http://www.springframework.org/schema/beans/spring-beans-2.5.=
xsd
> =A0 =A0 =A0 http://activemq.apache.org/camel/schema/spring
> =A0 =A0 =A0 http://activemq.apache.org/camel/schema/spring/camel-spring.x=
sd
> =A0 =A0 =A0 http://www.springframework.org/schema/aop
> =A0 =A0 =A0 http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> =A0 =A0 =A0 http://www.springframework.org/schema/context
>
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>
>
> =A0 =A0 =A0
>
> =A0 =A0 =A0 =A0
>
>
>
> =A0 xmlns=3D"http://activemq.apache.org/camel/schema/spring">
>
> =A0
> =A0
> =A0
>
>
> public class MyRouteBuilder extends RouteBuilder {
>
> =A0 =A0 =A0 =A0@Override
> =A0 =A0 =A0 =A0public void configure() throws Exception {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0System.out.println("IN ROUTE BUILDER#####"=
);
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// from our camelService which is called b=
y the file poller
>
> from("jbi:service:http://servicemix.apache.org/example/orderProcessing")
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // we process the received order xml
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .process(new OrderProcessor())
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // and send the result xml back to th=
e file sender
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .to("jbi:service:http://servicemix.ap=
ache.org/example/fileSender");
>
>
> =A0 =A0 =A0 =A0}
>
>
> =A0 =A0 =A0 =A0}
>
>
>
> I get an exception is saying that routeBuilder should of type
> org.apache.camel.builder.RouteBuilder. I do not understand why I am getti=
ng
> this exception as my RouteBuilder class is already extending the camel
> RouteBuilder class.
>
>
> Please help me these queries.I thank you all for your time.
>
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/camel-%2B-service-mix=
-%2B-spring-aspect-tp24307030p24307030.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--=20
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel + service mix + spring aspect

by akshay_ajmanion 2009-07-03T17:34:03+00:00.

This is my pom.xml


camel
camel.trial
0.0.1-SNAPSHOT

4.0.0
camel.trial
camel-su
jbi-service-unit
A Camel based JBI Service Unit
0.0.1-SNAPSHOT
http://www.myorganization.org

install


maven-compiler-plugin

1.5
1.5



org.apache.servicemix.tooling
jbi-maven-plugin
${servicemix-version}
true


org.apache.camel
camel-maven-plugin
${camel-version}





=09
=09=09=09=09false
=09=09=09
=09=09=09
=09=09=09open.iona.m2-snapshot
=09=09=09IONA Open Source Community Snapshot Repository
=09=09=09http://repo.open.iona.com/maven2-snapshot
=09=09=09
=09=09



false

apache
Apache Repository
http://people.apache.org/repo/m2-ibiblio-rsync-repository



false


apache.snapshots
Apache Snapshots Repository
http://people.apache.org/repo/m2-snapshot-repository






false

apache
Apache Repository
http://people.apache.org/repo/m2-ibiblio-rsync-repository



false


apache.snapshots
Apache Snapshots Repository
http://people.apache.org/repo/m2-snapshot-repository




org.apache.servicemix
servicemix-camel
${servicemix-version}


org.apache.servicemix
servicemix-core
${servicemix-version}
provided


=09org.aspectj
=09aspectjrt
=091.6.5




=09=093.3.1.17-fuse
1.6.0


I am getting the following error.It seems there is some jar version
mismatch.
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'camelContext': Invoca
tion of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'myBuilder' defined in file
[C:\progress\fuse-esb-3.4.0.2\data\smx\service-assemblies\camel-sa\version_=
15
\sus\servicemix-camel\camel-su\camel-context.xml]: Initialization of bean
failed; nested exception is java.lang.NoSuchMe
thodError:
org.springframework.util.ReflectionUtils.isEqualsMethod(Ljava/lang/reflect/=
Method;)Z

Claus Ibsen-2 wrote:
>=20
> Hi
>=20
> What version of Camel are you using?
> There was an issue with 1.6.0 or older not being able to be IoC in
> some circumstances if the bean was a RouteBuilder instance.
> And thats the case with your route builder.
>=20
> However when using proxy it can be on interface or class level. And
> aspectj looks like it does at classlevel so hence something can go
> wrong when Camel is not able to see it as a RouteBuilder instance.
>=20
>=20
>=20
> On Thu, Jul 2, 2009 at 3:46 PM, akshay_ajmani
> wrote:
>>
>> Hi,
>>
>> =C2=A0 =C2=A0I have implemented the following example
>> http://cwiki.apache.org/SM/order-file-processing.html and it is working
>> fine. I need to add few modifications to my camel context.xml. My
>> question
>> is , is it possible to add spring aspects to camel-context.xml i.e
>>
>>
>>
>> > =C2=A0 =C2=A0 =C2=A0 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-insta=
nce"
>> =C2=A0 =C2=A0 =C2=A0 xmlns:aop=3D"http://www.springframework.org/schema/=
aop"
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
>> =C2=A0xmlns:context=3D"http://www.springframework.org/schema/context"
>> =C2=A0 =C2=A0 =C2=A0 xsi:schemaLocation=3D"
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans/spring-=
beans-2.5.xsd
>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring
>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring/came=
l-spring.xsd
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop/spring-ao=
p-2.5.xsd
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/context
>>
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>
>>
>> =C2=A0 =C2=A0 =C2=A0
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0
>>
>>
>>
>> =C2=A0> xmlns=3D"http://activemq.apache.org/camel/schema/spring">
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 org.camel.su
>> =C2=A0
>> =C2=A0
>>
>>
>>
>>
>>
>> I have my pointcuts defined in the java code using spring annotations.
>>
>> The code is as follows:
>>
>> @Aspect
>> public class SystemArchitecture {
>>
>>
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0@Pointcut("execution(* *(..))")
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0public void myFirstPointCut()
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0{
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>
>> }
>>
>> package org.aspect;
>>
>> import org.aspectj.lang.ProceedingJoinPoint;
>> import org.aspectj.lang.annotation.Around;
>> import org.aspectj.lang.annotation.Aspect;
>>
>> @Aspect
>> public class FirstAspect {
>>
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0@Around("SystemArchitecture.myFirstPointCut()=
")
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0public void firstAspect(ProceedingJoinPoint j=
oinPoint)
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0{
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.printl=
n("PRINTING FIRST ASPECT");
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0try {
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0joinPoint.proceed();
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} catch (Throwabl=
e e) {
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0// TODO Auto-generated catch block
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0e.printStackTrace();
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>> }
>>
>>
>>
>>
>> If defining aspects in camel-context.xml is possible, then how do I
>> define
>> aspects on my RouteBuilder class.Because I want a particular piece of
>> code
>> to be always executed before my route builder class is called and I do
>> not
>> want to embed that code in the routebuilder class.
>>
>> For ex: If I do some thing like this below,
>>
>>
>> > =C2=A0 =C2=A0 =C2=A0 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-insta=
nce"
>> =C2=A0 =C2=A0 =C2=A0 xmlns:aop=3D"http://www.springframework.org/schema/=
aop"
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
>> =C2=A0xmlns:context=3D"http://www.springframework.org/schema/context"
>> =C2=A0 =C2=A0 =C2=A0 xsi:schemaLocation=3D"
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans/spring-=
beans-2.5.xsd
>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring
>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring/came=
l-spring.xsd
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop/spring-ao=
p-2.5.xsd
>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/context
>>
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>
>>
>> =C2=A0 =C2=A0 =C2=A0
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0
>>
>>
>>
>> =C2=A0> xmlns=3D"http://activemq.apache.org/camel/schema/spring">
>>
>> =C2=A0
>> =C2=A0
>> =C2=A0
>>
>>
>> public class MyRouteBuilder extends RouteBuilder {
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0@Override
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0public void configure() throws Exception {
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.printl=
n("IN ROUTE BUILDER#####");
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0// from our camel=
Service which is called by the file
>> poller
>>
>> from("jbi:service:http://servicemix.apache.org/example/orderProcessing")
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // we pro=
cess the received order xml
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .process(=
new OrderProcessor())
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // and se=
nd the result xml back to the file sender
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
>> .to("jbi:service:http://servicemix.apache.org/example/fileSender");
>>
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>
>>
>>
>> I get an exception is saying that routeBuilder should of type
>> org.apache.camel.builder.RouteBuilder. I do not understand why I am
>> getting
>> this exception as my RouteBuilder class is already extending the camel
>> RouteBuilder class.
>>
>>
>> Please help me these queries.I thank you all for your time.
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/camel-%2B-service-mix-%2B-spring-aspect-tp24307030=
p24307030.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>=20
>=20
>=20
> --=20
> Claus Ibsen
> Apache Camel Committer
>=20
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>=20
>=20
--=20
View this message in context: http://www.nabble.com/camel-%2B-service-mix-%=
2B-spring-aspect-tp24307030p24326507.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel + service mix + spring aspect

by akshay_ajmanion 2009-07-03T17:55:44+00:00.

akshay_ajmani wrote:
>=20
> This is my pom.xml
>
>
> camel
> camel.trial
> 0.0.1-SNAPSHOT
>
> 4.0.0
> camel.trial
> camel-su
> jbi-service-unit
> A Camel based JBI Service Unit
> 0.0.1-SNAPSHOT
> http://www.myorganization.org
>
> install
>
>
> maven-compiler-plugin
>
> 1.5
> 1.5
>
>
>
> org.apache.servicemix.tooling
> jbi-maven-plugin
> ${servicemix-version}
> true
>
>
> org.apache.camel
> camel-maven-plugin
> ${camel-version}
>
>
>
>
>
> =09
> =09=09=09=09false
> =09=09=09
> =09=09=09
> =09=09=09open.iona.m2-snapshot
> =09=09=09IONA Open Source Community Snapshot Repository
> =09=09=09http://repo.open.iona.com/maven2-snapshot
> =09=09=09
> =09=09
>
>
>
> false
>
> apache
> Apache Repository
> http://people.apache.org/repo/m2-ibiblio-rsync-repository
>
>
>
> false
>
>
> apache.snapshots
> Apache Snapshots Repository
> http://people.apache.org/repo/m2-snapshot-repository
>
>
>
>
>
>
> false
>
> apache
> Apache Repository
> http://people.apache.org/repo/m2-ibiblio-rsync-repository
>
>
>
> false
>
>
> apache.snapshots
> Apache Snapshots Repository
> http://people.apache.org/repo/m2-snapshot-repository
>
>
>
>
> org.apache.servicemix
> servicemix-camel
> ${servicemix-version}
>
>
> org.apache.servicemix
> servicemix-core
> ${servicemix-version}
> provided
>
>
> =09org.aspectj
> =09aspectjrt
> =091.6.5
>
>
>
>
> =09=093.3.1.17-fuse
> 1.6.0
>
>
>=20
> I am getting the following error.It seems there is some jar version
> mismatch.
>=20
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'camelContext': Invoca
> tion of init method failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'myBuilder' defined in file
> [C:\progress\fuse-esb-3.4.0.2\data\smx\service-assemblies\camel-sa\versio=
n_15
> \sus\servicemix-camel\camel-su\camel-context.xml]: Initialization of bean
> failed; nested exception is java.lang.NoSuchMe
> thodError:
> org.springframework.util.ReflectionUtils.isEqualsMethod(Ljava/lang/reflec=
t/Method;)Z
>=20
> My camel context file is
>
>=20
> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
> xmlns:aop=3D"http://www.springframework.org/schema/aop"
> =09=09xmlns:context=3D"http://www.springframework.org/schema/context"
> =09=09xmlns:camel=3D"http://camel.apache.org/schema/spring"
> xsi:schemaLocation=3D"
> http://www.springframework.org/schema/beans=20
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://activemq.apache.org/camel/schema/spring=20
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
> http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> http://www.springframework.org/schema/context
> =20
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
> =20
>
>=20
> =09
> =20
> xmlns=3D"http://activemq.apache.org/camel/schema/spring">
> =20
> =20
>=20
>
>
>
>=20
> I have spring core 2.5.6 jar which does not have this method defined.Is m=
y
> POM.xml correct as I think I may need to change the version of the jar to
> make this work.
>=20
>=20
> Claus Ibsen-2 wrote:
>>=20
>> Hi
>>=20
>> What version of Camel are you using?
>> There was an issue with 1.6.0 or older not being able to be IoC in
>> some circumstances if the bean was a RouteBuilder instance.
>> And thats the case with your route builder.
>>=20
>> However when using proxy it can be on interface or class level. And
>> aspectj looks like it does at classlevel so hence something can go
>> wrong when Camel is not able to see it as a RouteBuilder instance.
>>=20
>>=20
>>=20
>> On Thu, Jul 2, 2009 at 3:46 PM, akshay_ajmani
>> wrote:
>>>
>>> Hi,
>>>
>>> =C2=A0 =C2=A0I have implemented the following example
>>> http://cwiki.apache.org/SM/order-file-processing.html and it is working
>>> fine. I need to add few modifications to my camel context.xml. My
>>> question
>>> is , is it possible to add spring aspects to camel-context.xml i.e
>>>
>>>
>>>
>>> >> =C2=A0 =C2=A0 =C2=A0 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-inst=
ance"
>>> =C2=A0 =C2=A0 =C2=A0 xmlns:aop=3D"http://www.springframework.org/schema=
/aop"
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
>>> =C2=A0xmlns:context=3D"http://www.springframework.org/schema/context"
>>> =C2=A0 =C2=A0 =C2=A0 xsi:schemaLocation=3D"
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans/spring=
-beans-2.5.xsd
>>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring
>>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring/cam=
el-spring.xsd
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop/spring-a=
op-2.5.xsd
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/context
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>
>>>
>>> =C2=A0 =C2=A0 =C2=A0
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0
>>>
>>>
>>>
>>> =C2=A0>> xmlns=3D"http://activemq.apache.org/camel/schema/spring">
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 org.camel.su
>>> =C2=A0
>>> =C2=A0
>>>
>>>
>>>
>>>
>>>
>>> I have my pointcuts defined in the java code using spring annotations.
>>>
>>> The code is as follows:
>>>
>>> @Aspect
>>> public class SystemArchitecture {
>>>
>>>
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0@Pointcut("execution(* *(..))")
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0public void myFirstPointCut()
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0{
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>>
>>> }
>>>
>>> package org.aspect;
>>>
>>> import org.aspectj.lang.ProceedingJoinPoint;
>>> import org.aspectj.lang.annotation.Around;
>>> import org.aspectj.lang.annotation.Aspect;
>>>
>>> @Aspect
>>> public class FirstAspect {
>>>
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0@Around("SystemArchitecture.myFirstPointCut(=
)")
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0public void firstAspect(ProceedingJoinPoint =
joinPoint)
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0{
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.print=
ln("PRINTING FIRST ASPECT");
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0try {
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0joinPoint.proceed();
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} catch (Throwab=
le e) {
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0// TODO Auto-generated catch block
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0e.printStackTrace();
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>> }
>>>
>>>
>>>
>>>
>>> If defining aspects in camel-context.xml is possible, then how do I
>>> define
>>> aspects on my RouteBuilder class.Because I want a particular piece of
>>> code
>>> to be always executed before my route builder class is called and I do
>>> not
>>> want to embed that code in the routebuilder class.
>>>
>>> For ex: If I do some thing like this below,
>>>
>>>
>>> >> =C2=A0 =C2=A0 =C2=A0 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-inst=
ance"
>>> =C2=A0 =C2=A0 =C2=A0 xmlns:aop=3D"http://www.springframework.org/schema=
/aop"
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
>>> =C2=A0xmlns:context=3D"http://www.springframework.org/schema/context"
>>> =C2=A0 =C2=A0 =C2=A0 xsi:schemaLocation=3D"
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/beans/spring=
-beans-2.5.xsd
>>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring
>>> =C2=A0 =C2=A0 =C2=A0 http://activemq.apache.org/camel/schema/spring/cam=
el-spring.xsd
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/aop/spring-a=
op-2.5.xsd
>>> =C2=A0 =C2=A0 =C2=A0 http://www.springframework.org/schema/context
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>
>>>
>>> =C2=A0 =C2=A0 =C2=A0
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0
>>>
>>>
>>>
>>> =C2=A0>> xmlns=3D"http://activemq.apache.org/camel/schema/spring">
>>>
>>> =C2=A0
>>> =C2=A0
>>> =C2=A0
>>>
>>>
>>> public class MyRouteBuilder extends RouteBuilder {
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0@Override
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0public void configure() throws Exception {
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out.print=
ln("IN ROUTE BUILDER#####");
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0// from our came=
lService which is called by the file
>>> poller
>>>
>>> from("jbi:service:http://servicemix.apache.org/example/orderProcessing"=
)
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // we pr=
ocess the received order xml
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .process=
(new OrderProcessor())
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // and s=
end the result xml back to the file sender
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
>>> .to("jbi:service:http://servicemix.apache.org/example/fileSender");
>>>
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>>
>>>
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>>>
>>>
>>>
>>> I get an exception is saying that routeBuilder should of type
>>> org.apache.camel.builder.RouteBuilder. I do not understand why I am
>>> getting
>>> this exception as my RouteBuilder class is already extending the camel
>>> RouteBuilder class.
>>>
>>>
>>> Please help me these queries.I thank you all for your time.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/camel-%2B-service-mix-%2B-spring-aspect-tp2430703=
0p24307030.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>=20
>>=20
>>=20
>> --=20
>> Claus Ibsen
>> Apache Camel Committer
>>=20
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>=20
>>=20
>=20
>=20
--=20
View this message in context: http://www.nabble.com/camel-%2B-service-mix-%=
2B-spring-aspect-tp24307030p24326755.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel + service mix + spring aspect

by Claus Ibsenon 2009-07-04T06:00:55+00:00.
>> I have spring core 2.5.6 jar which does not have this method defined.Is my
>> POM.xml correct as I think I may need to change the version of the jar to
>> make this work.
Hi
You are using an old version of ServiceMix 3.3.x that uses Spring 2.0.x.
And Camel 1.6.0 uses Spring 2.5.x. Camel 1.6.1 and newer should work
better with Spring 2.0.x.
So try using 1.6.1 instead and keep the old spring 2.0.x jars.
Or you could consider upgrading SMX also to 3.4.x as it uses Spring 2.5.x AFAIR.
3.3.1.17-fuse
1.6.0
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel + service mix + spring aspect

by akshay_ajmanion 2009-07-06T13:08:56+00:00.

Hi,
This is my new pom.xml. I changed the service mix version as follows:
3.4.0-fuse
But now it is giving me errors related to artifacts not found.Missing:
----------
1) org.apache.servicemix:servicemix-camel:jar:3.4.0-fuse
I was getting the same errors for jbi-maven-plugin, so I changed the version
for this to 3.3.1.17-fuse.
Repositories that I am using are:
1)http://repo.open.iona.com/maven2-snapshot
2)http://people.apache.org/repo/m2-ibiblio-rsync-repository
3)http://people.apache.org/repo/m2-snapshot-repository
Please let me know the correct versions to use and repository locations.
My properties tag in pom.xml is as follows:

3.3.1.17-fuse
3.4.0-fuse
1.6.0

http://www.nabble.com/file/p24355125/pom.xml pom.xml
Claus Ibsen-2 wrote:
>
>>> I have spring core 2.5.6 jar which does not have this method defined.Is
>>> my
>>> POM.xml correct as I think I may need to change the version of the jar
>>> to
>>> make this work.
>
> Hi
>
> You are using an old version of ServiceMix 3.3.x that uses Spring 2.0.x.
> And Camel 1.6.0 uses Spring 2.5.x. Camel 1.6.1 and newer should work
> better with Spring 2.0.x.
> So try using 1.6.1 instead and keep the old spring 2.0.x jars.
>
> Or you could consider upgrading SMX also to 3.4.x as it uses Spring 2.5.x
> AFAIR.
>
> 3.3.1.17-fuse
> 1.6.0
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
--
View this message in context: http://www.nabble.com/camel-%2B-service-mix-%2B-spring-aspect-tp24307030p24355125.html
Sent from the Camel - Users mailing list archive at Nabble.com.