You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by akshay_ajmani <ak...@gmail.com> on 2009/07/02 15:45:19 UTC

Service mix + camel + spring aop aspects

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

<?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:aop="http://www.springframework.org/schema/aop"
		xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://activemq.apache.org/camel/schema/spring 
       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
      
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
       
       
       <context:annotation-config />

	<aop:aspectj-autoproxy/>


 
  <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
   	   <package>org.camel.su</package>
  </camelContext>
 <bean id="firstAspect" class="org.aspect.FirstAspect"/>

</beans>


 
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,
<?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:aop="http://www.springframework.org/schema/aop"
		xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://activemq.apache.org/camel/schema/spring 
       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
      
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
       
       
       <context:annotation-config />

	<aop:aspectj-autoproxy/>


 
  <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<routeBuilder ref="someRouterBuilder"/>
  </camelContext>
 <bean id="firstAspect" class="org.aspect.FirstAspect"/>
 <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
</beans>

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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Service mix + camel + spring aop aspects

Posted by akshay_ajmani <ak...@gmail.com>.
I believe I used service-mix-camel-service-unit while creating the service
unit.To avoid the exception 
unexpected element (uri:"http://camel.apache.org/schema/spring",
local:"camelContext"), I think I would have to use camel-archetype-spring.

My main concern is how to make the aspect run on routebuilder.

akshay_ajmani wrote:
> 
> Hi,
>    I will tell u the complete procedure that I followed.
> 1)Created the various service units and assemblies corresponding to the
> example:
> http://cwiki.apache.org/SM/order-file-processing.html 
> 
> 2) In order to try spring aspects , I did all possible steps required for
> it i.e defining the pointcuts etc.
>  My camel-context.xml looked like the one pasted in the previous.
> 
> 3) After deploying it in service mix, I got exception ..RefelectionUtils .
> isNotEqualMethod not defined.
> 
> I changed the camel version in the pom.xml to avoid this error. The
> relevant portion of  pom.xml currently is like this:
> 
>  <plugin>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-maven-plugin</artifactId>
>         <version>1.6.0</version>
>       </plugin>
>  <dependency>
>       <groupId>org.apache.servicemix</groupId>
>       <artifactId>servicemix-camel</artifactId>
>       <version>${servicemix-version}</version>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.servicemix</groupId>
>       <artifactId>servicemix-core</artifactId>
>       <version>${servicemix-version}</version>
>       <scope>provided</scope>
>     </dependency>
> 
> <dependency>
>     	<groupId>org.apache.camel</groupId>
>     	<artifactId>camel-spring</artifactId>
>     	<version>2.0-M2</version>
>     </dependency>
>   </dependencies>
> 
>   <properties>
>     <servicemix-version>3.2.3</servicemix-version>
>     <!--  <camel-version>1.4.0</camel-version>-->
>     		<camel-version>1.6.0.0-fuse</camel-version>
>   </properties>
> 
> 4) After doing this , the aspect was not being called.I think the pointcut
> expression i.e the method which the aspect was defined, its class was not
> being loaded by spring framework.
> 
> 5)So I tried to create an aspect on the route builder class.I changed my
> camel-context.xml to the following:
> 
> <?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:camel="http://camel.apache.org/schema/spring"
>        xsi:schemaLocation="
>           http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>           http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
>           http://www.springframework.org/schema/aop
>        http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> 	   http://camel.apache.org/schema/spring/camel-spring.xsd
>        http://www.springframework.org/schema/context
>       
> http://www.springframework.org/schema/context/spring-context-2.5.xsd
> 	    http://www.springframework.org/schema/aop
>        http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>        http://www.springframework.org/schema/context
>       
> http://www.springframework.org/schema/context/spring-context-2.5.xsd
> 	   ">
>         
>        <context:annotation-config />
> 
> 	<aop:aspectj-autoproxy/>
>  
> <camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
>     <routeBuilder ref="myBuilder" />    
>   </camelContext>
>   
>   <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
> </beans>
> 
> 
> I changed my point cut expression so that my advice gets called before the
> routebuilder configure method.
> 
> But now I am getting an exception 
> unexpected element (uri:"http://camel.apache.org/schema/spring",
> local:"camelContext").It is expecting all uris having activemq.
> 
> I have attached my camel-su pom.xml for your reference
> 
>  http://www.nabble.com/file/p24308838/pom.xml pom.xml 
> 
> 
> Gert Vanthienen wrote:
>> 
>> L.S.,
>> 
>> We should be able to get this to work, but I guess the way classes are
>> loaded in JBI can make this just a bit harder -- some of the Spring
>> AOP bits are being loaded from the JBI container classloader so we
>> might have to add things there.  Just a few informational questions
>> before we start digging into this:
>> - what version of servicemix are you using and which version of the
>> servicemix-camel component?
>> - could you make sure that you're using the same version of Camel in
>> your own pom.xml (e.g. when defining extra components etc)?
>> - can you send us the complete stack trace that you're seeing?
>> 
>> Regards,
>> 
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>> 
>> 
>> 
>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>
>>> 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
>>>
>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>              
>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>       xsi:schemaLocation="
>>>       http://www.springframework.org/schema/beans
>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>       http://activemq.apache.org/camel/schema/spring
>>>       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
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>
>>>
>>>       <context:annotation-config />
>>>
>>>        <aop:aspectj-autoproxy/>
>>>
>>>
>>>
>>>  <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>           <package>org.camel.su</package>
>>>  </camelContext>
>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>
>>> </beans>
>>>
>>>
>>>
>>> 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,
>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>              
>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>       xsi:schemaLocation="
>>>       http://www.springframework.org/schema/beans
>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>       http://activemq.apache.org/camel/schema/spring
>>>       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
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>
>>>
>>>       <context:annotation-config />
>>>
>>>        <aop:aspectj-autoproxy/>
>>>
>>>
>>>
>>>  <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>> <routeBuilder ref="someRouterBuilder"/>
>>>  </camelContext>
>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>>> </beans>
>>>
>>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24309002.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Service mix + camel + spring aop aspects

Posted by akshay_ajmani <ak...@gmail.com>.
I added a new repository location to my pom.xml and made the following
changes highlighted in bold.

<?xml version="1.0" encoding="UTF-8"?><project>
  <parent>
    <artifactId>camel</artifactId>
    <groupId>camel.trial</groupId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>camel.trial</groupId>
  <artifactId>camel-su</artifactId>
  <packaging>jbi-service-unit</packaging>
  <name>A Camel based JBI Service Unit</name>
  <version>0.0.1-SNAPSHOT</version>
  <url>http://www.myorganization.org</url>
  <build>
    <defaultGoal>install</defaultGoal>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.servicemix.tooling</groupId>
        <artifactId>jbi-maven-plugin</artifactId>
        <version>${servicemix-version}</version>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>${camel-version}</version> <!--  ${camel-version}-->
      </plugin>
    </plugins>
  </build>
  <repositories>
  <repository>
  	<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots />
			<id>open.iona.m2-snapshot</id>
			<name>IONA Open Source Community Snapshot Repository</name>
			<url>http://repo.open.iona.com/maven2-snapshot
			</url>
		</repository>
    <repository>
      <releases />
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>apache</id>
      <name>Apache Repository</name>
      <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
    </repository>
    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>apache.snapshots</id>
      <name>Apache Snapshots Repository</name>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases />
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>apache</id>
      <name>Apache Repository</name>
      <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
    </pluginRepository>
    <pluginRepository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>apache.snapshots</id>
      <name>Apache Snapshots Repository</name>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
    </pluginRepository>
  </pluginRepositories>
  <dependencies>
    <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-camel</artifactId>
      <version>${servicemix-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-core</artifactId>
      <version>${servicemix-version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
    	<groupId>org.aspectj</groupId>
    	<artifactId>aspectjrt</artifactId>
    	<version>1.6.5</version>
    </dependency>
     <!-- 
        <dependency>
    	<groupId>org.apache.camel</groupId>
    	<artifactId>camel-spring</artifactId>
        <version>${camel-version}</version>
    </dependency>
      -->
  </dependencies>
  <properties>
    		<servicemix-version>3.3.1.17-fuse</servicemix-version>
    <camel-version>1.6.0</camel-version> <!-- 1.4.0 original value -->
  </properties>
</project>

My camel-context.xml file is:
<?xml version="1.0"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
		xmlns:context="http://www.springframework.org/schema/context"
		xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://activemq.apache.org/camel/schema/spring 
       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
      
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
       
       <context:annotation-config />

	<aop:aspectj-autoproxy/>
     
  <camelContext id="camelContext" useJmx="true"
xmlns="http://activemq.apache.org/camel/schema/spring">
     <routeBuilder ref="myBuilder" />  
  </camelContext> 

<bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
<bean id="firstAspect" class="org.aspect.FirstAspect"/>
</beans>


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 

The jar file that is created has spring-core 2.5.6 jar which does not have
this method defined.

Can you please tell me the correct versions to use to avoid this error.I am
pretty sure it is some jar version issue but when I try to change from one
version to other, I get some new error.

As I said in my previous post, I was getting artifacts not present at the
location , so I thought to use service mix version 3.3.1-17 fuse.

Thanks for your help.


akshay_ajmani wrote:
> 
> I did this:
> <plugin>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-maven-plugin</artifactId>
>         <version>4.1</version> 
>       </plugin>
> After doing this, I am getting the following errors.
> 
> Reason: Unable to download the artifact from any repository
> 
>   org.apache.camel:camel-maven-plugin:pom:4.1
> 
> from the specified remote repositories:
>   central (http://repo1.maven.org/maven2),
>   apache (http://people.apache.org/repo/m2-ibiblio-rsync-repository),
>   apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository)
> 
> These r not present in the above locations.Do I need to add a new
> repository location where I would find the missing artifact.
> 
> I was getting the similar error when I changed service mix version to
> 3.3.1 i.e
> <dependency>
>       <groupId>org.apache.servicemix</groupId>
>       <artifactId>servicemix-camel</artifactId>
>       <version>3.3.1</version>
>     </dependency>
> 
> As you said , I am using 4.1 plugin , service mix version 3.3.1 and camel
> version 1.6
> 
> 
> 
> 
> Gert Vanthienen wrote:
>> 
>> L.S.,
>> 
>> For the plugin, you can use the latest version available (4.1).
>> 
>> The components also no longer carry the same version number as the
>> container, because they are now being shared between containers (e.g.
>> servicemix-camel 2009.01 is being used in ServiceMix 3.3.1 and 4.0.0).
>>  ServiceMix 3.3.1 comes with servicemix-camel 2009.01 and uses Camel
>> 1.6.0.
>> 
>> Regards,
>> 
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>> 
>> 
>> 
>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>
>>> Also if I change the service mix version to 3.3.1, I get the following
>>> error
>>> [INFO] Unable to find resource
>>> 'org.apache.servicemix:servicemix-camel:pom:3.3.1' in repository apache
>>> (http://people.apache.org/repo/m2-ibiblio-rsync-repository)
>>>
>>>
>>> Gert Vanthienen wrote:
>>>>
>>>> L.S.,
>>>>
>>>> With this configuration, you're using jar files from three different
>>>> Camel versions together: ServiceMix 3.2.3 comes with Camel 1.4.0 and I
>>>> see references to 1.6.0 and 2.0-M2 in your pom.xml file.  If you want
>>>> to use Camel 1.6.0, I would strongly recommend you to upgrade to
>>>> Servicemix 3.3.1 which ships with support for Camel 1.6.0.  The only
>>>> way to use Camel 2.0-SNAPSHOT/Mx in ServiceMix at the moment is by
>>>> building the servicemix-camel component locally yourself (cfr.
>>>> https://issues.apache.org/activemq/browse/SMXCOMP-563)
>>>>
>>>> Aligning on one single version of Camel will probably get rid of most
>>>> of the Exceptions you're seeing...
>>>>
>>>> Regards,
>>>>
>>>> Gert Vanthienen
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>
>>>>
>>>>
>>>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>>>
>>>>> Hi,
>>>>>   I will tell u the complete procedure that I followed.
>>>>> 1)Created the various service units and assemblies corresponding to
>>>>> the
>>>>> example:
>>>>> http://cwiki.apache.org/SM/order-file-processing.html
>>>>>
>>>>> 2) In order to try spring aspects , I did all possible steps required
>>>>> for
>>>>> it
>>>>> i.e defining the pointcuts etc.
>>>>>  My camel-context.xml looked like the one pasted in the previous.
>>>>>
>>>>> 3) After deploying it in service mix, I got exception
>>>>> ..RefelectionUtils
>>>>> .
>>>>> isNotEqualMethod not defined.
>>>>>
>>>>> I changed the camel version in the pom.xml to avoid this error. The
>>>>> relevant
>>>>> portion of  pom.xml currently is like this:
>>>>>
>>>>>  <plugin>
>>>>>        <groupId>org.apache.camel</groupId>
>>>>>        <artifactId>camel-maven-plugin</artifactId>
>>>>>        <version>1.6.0</version>
>>>>>      </plugin>
>>>>>  <dependency>
>>>>>      <groupId>org.apache.servicemix</groupId>
>>>>>      <artifactId>servicemix-camel</artifactId>
>>>>>      <version>${servicemix-version}</version>
>>>>>    </dependency>
>>>>>    <dependency>
>>>>>      <groupId>org.apache.servicemix</groupId>
>>>>>      <artifactId>servicemix-core</artifactId>
>>>>>      <version>${servicemix-version}</version>
>>>>>      <scope>provided</scope>
>>>>>    </dependency>
>>>>>
>>>>> <dependency>
>>>>>        <groupId>org.apache.camel</groupId>
>>>>>        <artifactId>camel-spring</artifactId>
>>>>>        <version>2.0-M2</version>
>>>>>    </dependency>
>>>>>  </dependencies>
>>>>>
>>>>>  <properties>
>>>>>    <servicemix-version>3.2.3</servicemix-version>
>>>>>    <!--  <camel-version>1.4.0</camel-version>-->
>>>>>                <camel-version>1.6.0.0-fuse</camel-version>
>>>>>  </properties>
>>>>>
>>>>> 4) After doing this , the aspect was not being called.I think the
>>>>> pointcut
>>>>> expression i.e the method which the aspect was defined, its class was
>>>>> not
>>>>> being loaded by spring framework.
>>>>>
>>>>> 5)So I tried to create an aspect on the route builder class.I changed
>>>>> my
>>>>> camel-context.xml to the following:
>>>>>
>>>>> <?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:camel="http://camel.apache.org/schema/spring"
>>>>>       xsi:schemaLocation="
>>>>>          http://www.springframework.org/schema/beans
>>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>>          http://camel.apache.org/schema/spring
>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>>>>          http://www.springframework.org/schema/aop
>>>>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>>>>           http://camel.apache.org/schema/spring/camel-spring.xsd
>>>>>       http://www.springframework.org/schema/context
>>>>>
>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>>>>            http://www.springframework.org/schema/aop
>>>>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>>>>       http://www.springframework.org/schema/context
>>>>>
>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>>>>           ">
>>>>>
>>>>>       <context:annotation-config />
>>>>>
>>>>>        <aop:aspectj-autoproxy/>
>>>>>
>>>>> <camelContext id="camel5"
>>>>> xmlns="http://camel.apache.org/schema/spring">
>>>>>    <routeBuilder ref="myBuilder" />
>>>>>  </camelContext>
>>>>>
>>>>>  <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>> </beans>
>>>>>
>>>>>
>>>>> I changed my point cut expression so that my advice gets called before
>>>>> the
>>>>> routebuilder configure method.
>>>>>
>>>>> But now I am getting an exception
>>>>> unexpected element (uri:"http://camel.apache.org/schema/spring",
>>>>> local:"camelContext").It is expecting all uris having activemq.
>>>>>
>>>>> I have attached my camel-su pom.xml for your reference
>>>>>
>>>>> http://www.nabble.com/file/p24308838/pom.xml pom.xml
>>>>>
>>>>>
>>>>> Gert Vanthienen wrote:
>>>>>>
>>>>>> L.S.,
>>>>>>
>>>>>> We should be able to get this to work, but I guess the way classes
>>>>>> are
>>>>>> loaded in JBI can make this just a bit harder -- some of the Spring
>>>>>> AOP bits are being loaded from the JBI container classloader so we
>>>>>> might have to add things there.  Just a few informational questions
>>>>>> before we start digging into this:
>>>>>> - what version of servicemix are you using and which version of the
>>>>>> servicemix-camel component?
>>>>>> - could you make sure that you're using the same version of Camel in
>>>>>> your own pom.xml (e.g. when defining extra components etc)?
>>>>>> - can you send us the complete stack trace that you're seeing?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Gert Vanthienen
>>>>>> ------------------------
>>>>>> Open Source SOA: http://fusesource.com
>>>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>>>>
>>>>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>>>>       xsi:schemaLocation="
>>>>>>>       http://www.springframework.org/schema/beans
>>>>>>>      
>>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>>>>       http://activemq.apache.org/camel/schema/spring
>>>>>>>      
>>>>>>> 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
>>>>>>>
>>>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>>>>
>>>>>>>
>>>>>>>       <context:annotation-config />
>>>>>>>
>>>>>>>        <aop:aspectj-autoproxy/>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  <camelContext id="camel"
>>>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>>>>           <package>org.camel.su</package>
>>>>>>>  </camelContext>
>>>>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>>>>
>>>>>>> </beans>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 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,
>>>>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>>>>
>>>>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>>>>       xsi:schemaLocation="
>>>>>>>       http://www.springframework.org/schema/beans
>>>>>>>      
>>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>>>>       http://activemq.apache.org/camel/schema/spring
>>>>>>>      
>>>>>>> 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
>>>>>>>
>>>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>>>>
>>>>>>>
>>>>>>>       <context:annotation-config />
>>>>>>>
>>>>>>>        <aop:aspectj-autoproxy/>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  <camelContext id="camel"
>>>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>>>> <routeBuilder ref="someRouterBuilder"/>
>>>>>>>  </camelContext>
>>>>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>>>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>>>>> </beans>
>>>>>>>
>>>>>>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>>>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> -----
>>>>>> ---
>>>>>> Gert Vanthienen
>>>>>> http://gertvanthienen.blogspot.com
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24308838.html
>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>> -----
>>>> ---
>>>> Gert Vanthienen
>>>> http://gertvanthienen.blogspot.com
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24314123.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24326737.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Service mix + camel + spring aop aspects

Posted by akshay_ajmani <ak...@gmail.com>.
I did this:
<plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>4.1</version> 
      </plugin>
After doing this, I am getting the following errors.

Reason: Unable to download the artifact from any repository

  org.apache.camel:camel-maven-plugin:pom:4.1

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  apache (http://people.apache.org/repo/m2-ibiblio-rsync-repository),
  apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository)

These r not present in the above locations.Do I need to add a new repository
location where I would find the missing artifact.

I was getting the similar error when I changed service mix version to 3.3.1
i.e
<dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-camel</artifactId>
      <version>3.3.1</version>
    </dependency>

As you said , I am using 4.1 plugin , service mix version 3.3.1 and camel
version 1.6




Gert Vanthienen wrote:
> 
> L.S.,
> 
> For the plugin, you can use the latest version available (4.1).
> 
> The components also no longer carry the same version number as the
> container, because they are now being shared between containers (e.g.
> servicemix-camel 2009.01 is being used in ServiceMix 3.3.1 and 4.0.0).
>  ServiceMix 3.3.1 comes with servicemix-camel 2009.01 and uses Camel
> 1.6.0.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>
>> Also if I change the service mix version to 3.3.1, I get the following
>> error
>> [INFO] Unable to find resource
>> 'org.apache.servicemix:servicemix-camel:pom:3.3.1' in repository apache
>> (http://people.apache.org/repo/m2-ibiblio-rsync-repository)
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> L.S.,
>>>
>>> With this configuration, you're using jar files from three different
>>> Camel versions together: ServiceMix 3.2.3 comes with Camel 1.4.0 and I
>>> see references to 1.6.0 and 2.0-M2 in your pom.xml file.  If you want
>>> to use Camel 1.6.0, I would strongly recommend you to upgrade to
>>> Servicemix 3.3.1 which ships with support for Camel 1.6.0.  The only
>>> way to use Camel 2.0-SNAPSHOT/Mx in ServiceMix at the moment is by
>>> building the servicemix-camel component locally yourself (cfr.
>>> https://issues.apache.org/activemq/browse/SMXCOMP-563)
>>>
>>> Aligning on one single version of Camel will probably get rid of most
>>> of the Exceptions you're seeing...
>>>
>>> Regards,
>>>
>>> Gert Vanthienen
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> Blog: http://gertvanthienen.blogspot.com/
>>>
>>>
>>>
>>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>>
>>>> Hi,
>>>>   I will tell u the complete procedure that I followed.
>>>> 1)Created the various service units and assemblies corresponding to the
>>>> example:
>>>> http://cwiki.apache.org/SM/order-file-processing.html
>>>>
>>>> 2) In order to try spring aspects , I did all possible steps required
>>>> for
>>>> it
>>>> i.e defining the pointcuts etc.
>>>>  My camel-context.xml looked like the one pasted in the previous.
>>>>
>>>> 3) After deploying it in service mix, I got exception
>>>> ..RefelectionUtils
>>>> .
>>>> isNotEqualMethod not defined.
>>>>
>>>> I changed the camel version in the pom.xml to avoid this error. The
>>>> relevant
>>>> portion of  pom.xml currently is like this:
>>>>
>>>>  <plugin>
>>>>        <groupId>org.apache.camel</groupId>
>>>>        <artifactId>camel-maven-plugin</artifactId>
>>>>        <version>1.6.0</version>
>>>>      </plugin>
>>>>  <dependency>
>>>>      <groupId>org.apache.servicemix</groupId>
>>>>      <artifactId>servicemix-camel</artifactId>
>>>>      <version>${servicemix-version}</version>
>>>>    </dependency>
>>>>    <dependency>
>>>>      <groupId>org.apache.servicemix</groupId>
>>>>      <artifactId>servicemix-core</artifactId>
>>>>      <version>${servicemix-version}</version>
>>>>      <scope>provided</scope>
>>>>    </dependency>
>>>>
>>>> <dependency>
>>>>        <groupId>org.apache.camel</groupId>
>>>>        <artifactId>camel-spring</artifactId>
>>>>        <version>2.0-M2</version>
>>>>    </dependency>
>>>>  </dependencies>
>>>>
>>>>  <properties>
>>>>    <servicemix-version>3.2.3</servicemix-version>
>>>>    <!--  <camel-version>1.4.0</camel-version>-->
>>>>                <camel-version>1.6.0.0-fuse</camel-version>
>>>>  </properties>
>>>>
>>>> 4) After doing this , the aspect was not being called.I think the
>>>> pointcut
>>>> expression i.e the method which the aspect was defined, its class was
>>>> not
>>>> being loaded by spring framework.
>>>>
>>>> 5)So I tried to create an aspect on the route builder class.I changed
>>>> my
>>>> camel-context.xml to the following:
>>>>
>>>> <?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:camel="http://camel.apache.org/schema/spring"
>>>>       xsi:schemaLocation="
>>>>          http://www.springframework.org/schema/beans
>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>          http://camel.apache.org/schema/spring
>>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>>>          http://www.springframework.org/schema/aop
>>>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>>>           http://camel.apache.org/schema/spring/camel-spring.xsd
>>>>       http://www.springframework.org/schema/context
>>>>
>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>>>            http://www.springframework.org/schema/aop
>>>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>>>       http://www.springframework.org/schema/context
>>>>
>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>>>           ">
>>>>
>>>>       <context:annotation-config />
>>>>
>>>>        <aop:aspectj-autoproxy/>
>>>>
>>>> <camelContext id="camel5"
>>>> xmlns="http://camel.apache.org/schema/spring">
>>>>    <routeBuilder ref="myBuilder" />
>>>>  </camelContext>
>>>>
>>>>  <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>> </beans>
>>>>
>>>>
>>>> I changed my point cut expression so that my advice gets called before
>>>> the
>>>> routebuilder configure method.
>>>>
>>>> But now I am getting an exception
>>>> unexpected element (uri:"http://camel.apache.org/schema/spring",
>>>> local:"camelContext").It is expecting all uris having activemq.
>>>>
>>>> I have attached my camel-su pom.xml for your reference
>>>>
>>>> http://www.nabble.com/file/p24308838/pom.xml pom.xml
>>>>
>>>>
>>>> Gert Vanthienen wrote:
>>>>>
>>>>> L.S.,
>>>>>
>>>>> We should be able to get this to work, but I guess the way classes are
>>>>> loaded in JBI can make this just a bit harder -- some of the Spring
>>>>> AOP bits are being loaded from the JBI container classloader so we
>>>>> might have to add things there.  Just a few informational questions
>>>>> before we start digging into this:
>>>>> - what version of servicemix are you using and which version of the
>>>>> servicemix-camel component?
>>>>> - could you make sure that you're using the same version of Camel in
>>>>> your own pom.xml (e.g. when defining extra components etc)?
>>>>> - can you send us the complete stack trace that you're seeing?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Gert Vanthienen
>>>>> ------------------------
>>>>> Open Source SOA: http://fusesource.com
>>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>>
>>>>>
>>>>>
>>>>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>>>>
>>>>>> 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
>>>>>>
>>>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>>>
>>>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>>>       xsi:schemaLocation="
>>>>>>       http://www.springframework.org/schema/beans
>>>>>>      
>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>>>       http://activemq.apache.org/camel/schema/spring
>>>>>>       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
>>>>>>
>>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>>>
>>>>>>
>>>>>>       <context:annotation-config />
>>>>>>
>>>>>>        <aop:aspectj-autoproxy/>
>>>>>>
>>>>>>
>>>>>>
>>>>>>  <camelContext id="camel"
>>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>>>           <package>org.camel.su</package>
>>>>>>  </camelContext>
>>>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>>>
>>>>>> </beans>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 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,
>>>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>>>
>>>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>>>       xsi:schemaLocation="
>>>>>>       http://www.springframework.org/schema/beans
>>>>>>      
>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>>>       http://activemq.apache.org/camel/schema/spring
>>>>>>       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
>>>>>>
>>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>>>
>>>>>>
>>>>>>       <context:annotation-config />
>>>>>>
>>>>>>        <aop:aspectj-autoproxy/>
>>>>>>
>>>>>>
>>>>>>
>>>>>>  <camelContext id="camel"
>>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>>> <routeBuilder ref="someRouterBuilder"/>
>>>>>>  </camelContext>
>>>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>>>> </beans>
>>>>>>
>>>>>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> -----
>>>>> ---
>>>>> Gert Vanthienen
>>>>> http://gertvanthienen.blogspot.com
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24308838.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>> -----
>>> ---
>>> Gert Vanthienen
>>> http://gertvanthienen.blogspot.com
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24314123.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24325728.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Service mix + camel + spring aop aspects

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

For the plugin, you can use the latest version available (4.1).

The components also no longer carry the same version number as the
container, because they are now being shared between containers (e.g.
servicemix-camel 2009.01 is being used in ServiceMix 3.3.1 and 4.0.0).
 ServiceMix 3.3.1 comes with servicemix-camel 2009.01 and uses Camel
1.6.0.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/7/2 akshay_ajmani <ak...@gmail.com>:
>
> Also if I change the service mix version to 3.3.1, I get the following error
> [INFO] Unable to find resource
> 'org.apache.servicemix:servicemix-camel:pom:3.3.1' in repository apache
> (http://people.apache.org/repo/m2-ibiblio-rsync-repository)
>
>
> Gert Vanthienen wrote:
>>
>> L.S.,
>>
>> With this configuration, you're using jar files from three different
>> Camel versions together: ServiceMix 3.2.3 comes with Camel 1.4.0 and I
>> see references to 1.6.0 and 2.0-M2 in your pom.xml file.  If you want
>> to use Camel 1.6.0, I would strongly recommend you to upgrade to
>> Servicemix 3.3.1 which ships with support for Camel 1.6.0.  The only
>> way to use Camel 2.0-SNAPSHOT/Mx in ServiceMix at the moment is by
>> building the servicemix-camel component locally yourself (cfr.
>> https://issues.apache.org/activemq/browse/SMXCOMP-563)
>>
>> Aligning on one single version of Camel will probably get rid of most
>> of the Exceptions you're seeing...
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>
>>> Hi,
>>>   I will tell u the complete procedure that I followed.
>>> 1)Created the various service units and assemblies corresponding to the
>>> example:
>>> http://cwiki.apache.org/SM/order-file-processing.html
>>>
>>> 2) In order to try spring aspects , I did all possible steps required for
>>> it
>>> i.e defining the pointcuts etc.
>>>  My camel-context.xml looked like the one pasted in the previous.
>>>
>>> 3) After deploying it in service mix, I got exception ..RefelectionUtils
>>> .
>>> isNotEqualMethod not defined.
>>>
>>> I changed the camel version in the pom.xml to avoid this error. The
>>> relevant
>>> portion of  pom.xml currently is like this:
>>>
>>>  <plugin>
>>>        <groupId>org.apache.camel</groupId>
>>>        <artifactId>camel-maven-plugin</artifactId>
>>>        <version>1.6.0</version>
>>>      </plugin>
>>>  <dependency>
>>>      <groupId>org.apache.servicemix</groupId>
>>>      <artifactId>servicemix-camel</artifactId>
>>>      <version>${servicemix-version}</version>
>>>    </dependency>
>>>    <dependency>
>>>      <groupId>org.apache.servicemix</groupId>
>>>      <artifactId>servicemix-core</artifactId>
>>>      <version>${servicemix-version}</version>
>>>      <scope>provided</scope>
>>>    </dependency>
>>>
>>> <dependency>
>>>        <groupId>org.apache.camel</groupId>
>>>        <artifactId>camel-spring</artifactId>
>>>        <version>2.0-M2</version>
>>>    </dependency>
>>>  </dependencies>
>>>
>>>  <properties>
>>>    <servicemix-version>3.2.3</servicemix-version>
>>>    <!--  <camel-version>1.4.0</camel-version>-->
>>>                <camel-version>1.6.0.0-fuse</camel-version>
>>>  </properties>
>>>
>>> 4) After doing this , the aspect was not being called.I think the
>>> pointcut
>>> expression i.e the method which the aspect was defined, its class was not
>>> being loaded by spring framework.
>>>
>>> 5)So I tried to create an aspect on the route builder class.I changed my
>>> camel-context.xml to the following:
>>>
>>> <?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:camel="http://camel.apache.org/schema/spring"
>>>       xsi:schemaLocation="
>>>          http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>          http://camel.apache.org/schema/spring
>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>>          http://www.springframework.org/schema/aop
>>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>>           http://camel.apache.org/schema/spring/camel-spring.xsd
>>>       http://www.springframework.org/schema/context
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>>            http://www.springframework.org/schema/aop
>>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>>       http://www.springframework.org/schema/context
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>>           ">
>>>
>>>       <context:annotation-config />
>>>
>>>        <aop:aspectj-autoproxy/>
>>>
>>> <camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
>>>    <routeBuilder ref="myBuilder" />
>>>  </camelContext>
>>>
>>>  <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>> </beans>
>>>
>>>
>>> I changed my point cut expression so that my advice gets called before
>>> the
>>> routebuilder configure method.
>>>
>>> But now I am getting an exception
>>> unexpected element (uri:"http://camel.apache.org/schema/spring",
>>> local:"camelContext").It is expecting all uris having activemq.
>>>
>>> I have attached my camel-su pom.xml for your reference
>>>
>>> http://www.nabble.com/file/p24308838/pom.xml pom.xml
>>>
>>>
>>> Gert Vanthienen wrote:
>>>>
>>>> L.S.,
>>>>
>>>> We should be able to get this to work, but I guess the way classes are
>>>> loaded in JBI can make this just a bit harder -- some of the Spring
>>>> AOP bits are being loaded from the JBI container classloader so we
>>>> might have to add things there.  Just a few informational questions
>>>> before we start digging into this:
>>>> - what version of servicemix are you using and which version of the
>>>> servicemix-camel component?
>>>> - could you make sure that you're using the same version of Camel in
>>>> your own pom.xml (e.g. when defining extra components etc)?
>>>> - can you send us the complete stack trace that you're seeing?
>>>>
>>>> Regards,
>>>>
>>>> Gert Vanthienen
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>
>>>>
>>>>
>>>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>>>
>>>>> 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
>>>>>
>>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>>
>>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>>       xsi:schemaLocation="
>>>>>       http://www.springframework.org/schema/beans
>>>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>>       http://activemq.apache.org/camel/schema/spring
>>>>>       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
>>>>>
>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>>
>>>>>
>>>>>       <context:annotation-config />
>>>>>
>>>>>        <aop:aspectj-autoproxy/>
>>>>>
>>>>>
>>>>>
>>>>>  <camelContext id="camel"
>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>>           <package>org.camel.su</package>
>>>>>  </camelContext>
>>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>>
>>>>> </beans>
>>>>>
>>>>>
>>>>>
>>>>> 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,
>>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>>
>>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>>       xsi:schemaLocation="
>>>>>       http://www.springframework.org/schema/beans
>>>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>>       http://activemq.apache.org/camel/schema/spring
>>>>>       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
>>>>>
>>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>>
>>>>>
>>>>>       <context:annotation-config />
>>>>>
>>>>>        <aop:aspectj-autoproxy/>
>>>>>
>>>>>
>>>>>
>>>>>  <camelContext id="camel"
>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>> <routeBuilder ref="someRouterBuilder"/>
>>>>>  </camelContext>
>>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>>> </beans>
>>>>>
>>>>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>> -----
>>>> ---
>>>> Gert Vanthienen
>>>> http://gertvanthienen.blogspot.com
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24308838.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>>
>
> --
> View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24314123.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Service mix + camel + spring aop aspects

Posted by akshay_ajmani <ak...@gmail.com>.
Also if I change the service mix version to 3.3.1, I get the following error
[INFO] Unable to find resource
'org.apache.servicemix:servicemix-camel:pom:3.3.1' in repository apache
(http://people.apache.org/repo/m2-ibiblio-rsync-repository)


Gert Vanthienen wrote:
> 
> L.S.,
> 
> With this configuration, you're using jar files from three different
> Camel versions together: ServiceMix 3.2.3 comes with Camel 1.4.0 and I
> see references to 1.6.0 and 2.0-M2 in your pom.xml file.  If you want
> to use Camel 1.6.0, I would strongly recommend you to upgrade to
> Servicemix 3.3.1 which ships with support for Camel 1.6.0.  The only
> way to use Camel 2.0-SNAPSHOT/Mx in ServiceMix at the moment is by
> building the servicemix-camel component locally yourself (cfr.
> https://issues.apache.org/activemq/browse/SMXCOMP-563)
> 
> Aligning on one single version of Camel will probably get rid of most
> of the Exceptions you're seeing...
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>
>> Hi,
>>   I will tell u the complete procedure that I followed.
>> 1)Created the various service units and assemblies corresponding to the
>> example:
>> http://cwiki.apache.org/SM/order-file-processing.html
>>
>> 2) In order to try spring aspects , I did all possible steps required for
>> it
>> i.e defining the pointcuts etc.
>>  My camel-context.xml looked like the one pasted in the previous.
>>
>> 3) After deploying it in service mix, I got exception ..RefelectionUtils
>> .
>> isNotEqualMethod not defined.
>>
>> I changed the camel version in the pom.xml to avoid this error. The
>> relevant
>> portion of  pom.xml currently is like this:
>>
>>  <plugin>
>>        <groupId>org.apache.camel</groupId>
>>        <artifactId>camel-maven-plugin</artifactId>
>>        <version>1.6.0</version>
>>      </plugin>
>>  <dependency>
>>      <groupId>org.apache.servicemix</groupId>
>>      <artifactId>servicemix-camel</artifactId>
>>      <version>${servicemix-version}</version>
>>    </dependency>
>>    <dependency>
>>      <groupId>org.apache.servicemix</groupId>
>>      <artifactId>servicemix-core</artifactId>
>>      <version>${servicemix-version}</version>
>>      <scope>provided</scope>
>>    </dependency>
>>
>> <dependency>
>>        <groupId>org.apache.camel</groupId>
>>        <artifactId>camel-spring</artifactId>
>>        <version>2.0-M2</version>
>>    </dependency>
>>  </dependencies>
>>
>>  <properties>
>>    <servicemix-version>3.2.3</servicemix-version>
>>    <!--  <camel-version>1.4.0</camel-version>-->
>>                <camel-version>1.6.0.0-fuse</camel-version>
>>  </properties>
>>
>> 4) After doing this , the aspect was not being called.I think the
>> pointcut
>> expression i.e the method which the aspect was defined, its class was not
>> being loaded by spring framework.
>>
>> 5)So I tried to create an aspect on the route builder class.I changed my
>> camel-context.xml to the following:
>>
>> <?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:camel="http://camel.apache.org/schema/spring"
>>       xsi:schemaLocation="
>>          http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>          http://camel.apache.org/schema/spring
>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>          http://www.springframework.org/schema/aop
>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>           http://camel.apache.org/schema/spring/camel-spring.xsd
>>       http://www.springframework.org/schema/context
>>      
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>            http://www.springframework.org/schema/aop
>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>       http://www.springframework.org/schema/context
>>      
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>           ">
>>
>>       <context:annotation-config />
>>
>>        <aop:aspectj-autoproxy/>
>>
>> <camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
>>    <routeBuilder ref="myBuilder" />
>>  </camelContext>
>>
>>  <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>> </beans>
>>
>>
>> I changed my point cut expression so that my advice gets called before
>> the
>> routebuilder configure method.
>>
>> But now I am getting an exception
>> unexpected element (uri:"http://camel.apache.org/schema/spring",
>> local:"camelContext").It is expecting all uris having activemq.
>>
>> I have attached my camel-su pom.xml for your reference
>>
>> http://www.nabble.com/file/p24308838/pom.xml pom.xml
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> L.S.,
>>>
>>> We should be able to get this to work, but I guess the way classes are
>>> loaded in JBI can make this just a bit harder -- some of the Spring
>>> AOP bits are being loaded from the JBI container classloader so we
>>> might have to add things there.  Just a few informational questions
>>> before we start digging into this:
>>> - what version of servicemix are you using and which version of the
>>> servicemix-camel component?
>>> - could you make sure that you're using the same version of Camel in
>>> your own pom.xml (e.g. when defining extra components etc)?
>>> - can you send us the complete stack trace that you're seeing?
>>>
>>> Regards,
>>>
>>> Gert Vanthienen
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> Blog: http://gertvanthienen.blogspot.com/
>>>
>>>
>>>
>>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>>
>>>> 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
>>>>
>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>
>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>       xsi:schemaLocation="
>>>>       http://www.springframework.org/schema/beans
>>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>       http://activemq.apache.org/camel/schema/spring
>>>>       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
>>>>
>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>
>>>>
>>>>       <context:annotation-config />
>>>>
>>>>        <aop:aspectj-autoproxy/>
>>>>
>>>>
>>>>
>>>>  <camelContext id="camel"
>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>           <package>org.camel.su</package>
>>>>  </camelContext>
>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>
>>>> </beans>
>>>>
>>>>
>>>>
>>>> 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,
>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>
>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>       xsi:schemaLocation="
>>>>       http://www.springframework.org/schema/beans
>>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>       http://activemq.apache.org/camel/schema/spring
>>>>       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
>>>>
>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>
>>>>
>>>>       <context:annotation-config />
>>>>
>>>>        <aop:aspectj-autoproxy/>
>>>>
>>>>
>>>>
>>>>  <camelContext id="camel"
>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>> <routeBuilder ref="someRouterBuilder"/>
>>>>  </camelContext>
>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>> </beans>
>>>>
>>>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>> -----
>>> ---
>>> Gert Vanthienen
>>> http://gertvanthienen.blogspot.com
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24308838.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24314123.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Service mix + camel + spring aop aspects

Posted by akshay_ajmani <ak...@gmail.com>.
Ok I will maintain a uniformity.

<plugin>
        <groupId>org.apache.servicemix.tooling</groupId>
        <artifactId>jbi-maven-plugin</artifactId>
        <version>${servicemix-version}</version>
        <extensions>true</extensions>
      </plugin>

If I change service mix version to 3.3.1 , I get an error for the
jbi-maven-plugin because this version does not exist here
http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/servicemix/tooling/jbi-maven-plugin.

what version should i use for this.Does it matter?.

Gert Vanthienen wrote:
> 
> L.S.,
> 
> With this configuration, you're using jar files from three different
> Camel versions together: ServiceMix 3.2.3 comes with Camel 1.4.0 and I
> see references to 1.6.0 and 2.0-M2 in your pom.xml file.  If you want
> to use Camel 1.6.0, I would strongly recommend you to upgrade to
> Servicemix 3.3.1 which ships with support for Camel 1.6.0.  The only
> way to use Camel 2.0-SNAPSHOT/Mx in ServiceMix at the moment is by
> building the servicemix-camel component locally yourself (cfr.
> https://issues.apache.org/activemq/browse/SMXCOMP-563)
> 
> Aligning on one single version of Camel will probably get rid of most
> of the Exceptions you're seeing...
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>
>> Hi,
>>   I will tell u the complete procedure that I followed.
>> 1)Created the various service units and assemblies corresponding to the
>> example:
>> http://cwiki.apache.org/SM/order-file-processing.html
>>
>> 2) In order to try spring aspects , I did all possible steps required for
>> it
>> i.e defining the pointcuts etc.
>>  My camel-context.xml looked like the one pasted in the previous.
>>
>> 3) After deploying it in service mix, I got exception ..RefelectionUtils
>> .
>> isNotEqualMethod not defined.
>>
>> I changed the camel version in the pom.xml to avoid this error. The
>> relevant
>> portion of  pom.xml currently is like this:
>>
>>  <plugin>
>>        <groupId>org.apache.camel</groupId>
>>        <artifactId>camel-maven-plugin</artifactId>
>>        <version>1.6.0</version>
>>      </plugin>
>>  <dependency>
>>      <groupId>org.apache.servicemix</groupId>
>>      <artifactId>servicemix-camel</artifactId>
>>      <version>${servicemix-version}</version>
>>    </dependency>
>>    <dependency>
>>      <groupId>org.apache.servicemix</groupId>
>>      <artifactId>servicemix-core</artifactId>
>>      <version>${servicemix-version}</version>
>>      <scope>provided</scope>
>>    </dependency>
>>
>> <dependency>
>>        <groupId>org.apache.camel</groupId>
>>        <artifactId>camel-spring</artifactId>
>>        <version>2.0-M2</version>
>>    </dependency>
>>  </dependencies>
>>
>>  <properties>
>>    <servicemix-version>3.2.3</servicemix-version>
>>    <!--  <camel-version>1.4.0</camel-version>-->
>>                <camel-version>1.6.0.0-fuse</camel-version>
>>  </properties>
>>
>> 4) After doing this , the aspect was not being called.I think the
>> pointcut
>> expression i.e the method which the aspect was defined, its class was not
>> being loaded by spring framework.
>>
>> 5)So I tried to create an aspect on the route builder class.I changed my
>> camel-context.xml to the following:
>>
>> <?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:camel="http://camel.apache.org/schema/spring"
>>       xsi:schemaLocation="
>>          http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>          http://camel.apache.org/schema/spring
>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>          http://www.springframework.org/schema/aop
>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>           http://camel.apache.org/schema/spring/camel-spring.xsd
>>       http://www.springframework.org/schema/context
>>      
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>            http://www.springframework.org/schema/aop
>>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>>       http://www.springframework.org/schema/context
>>      
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>>           ">
>>
>>       <context:annotation-config />
>>
>>        <aop:aspectj-autoproxy/>
>>
>> <camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
>>    <routeBuilder ref="myBuilder" />
>>  </camelContext>
>>
>>  <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>> </beans>
>>
>>
>> I changed my point cut expression so that my advice gets called before
>> the
>> routebuilder configure method.
>>
>> But now I am getting an exception
>> unexpected element (uri:"http://camel.apache.org/schema/spring",
>> local:"camelContext").It is expecting all uris having activemq.
>>
>> I have attached my camel-su pom.xml for your reference
>>
>> http://www.nabble.com/file/p24308838/pom.xml pom.xml
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> L.S.,
>>>
>>> We should be able to get this to work, but I guess the way classes are
>>> loaded in JBI can make this just a bit harder -- some of the Spring
>>> AOP bits are being loaded from the JBI container classloader so we
>>> might have to add things there.  Just a few informational questions
>>> before we start digging into this:
>>> - what version of servicemix are you using and which version of the
>>> servicemix-camel component?
>>> - could you make sure that you're using the same version of Camel in
>>> your own pom.xml (e.g. when defining extra components etc)?
>>> - can you send us the complete stack trace that you're seeing?
>>>
>>> Regards,
>>>
>>> Gert Vanthienen
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> Blog: http://gertvanthienen.blogspot.com/
>>>
>>>
>>>
>>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>>
>>>> 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
>>>>
>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>
>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>       xsi:schemaLocation="
>>>>       http://www.springframework.org/schema/beans
>>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>       http://activemq.apache.org/camel/schema/spring
>>>>       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
>>>>
>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>
>>>>
>>>>       <context:annotation-config />
>>>>
>>>>        <aop:aspectj-autoproxy/>
>>>>
>>>>
>>>>
>>>>  <camelContext id="camel"
>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>           <package>org.camel.su</package>
>>>>  </camelContext>
>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>
>>>> </beans>
>>>>
>>>>
>>>>
>>>> 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,
>>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>>
>>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>>       xsi:schemaLocation="
>>>>       http://www.springframework.org/schema/beans
>>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>>       http://activemq.apache.org/camel/schema/spring
>>>>       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
>>>>
>>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>>
>>>>
>>>>       <context:annotation-config />
>>>>
>>>>        <aop:aspectj-autoproxy/>
>>>>
>>>>
>>>>
>>>>  <camelContext id="camel"
>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>> <routeBuilder ref="someRouterBuilder"/>
>>>>  </camelContext>
>>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>>>> </beans>
>>>>
>>>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>> -----
>>> ---
>>> Gert Vanthienen
>>> http://gertvanthienen.blogspot.com
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24308838.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24314025.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Service mix + camel + spring aop aspects

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

With this configuration, you're using jar files from three different
Camel versions together: ServiceMix 3.2.3 comes with Camel 1.4.0 and I
see references to 1.6.0 and 2.0-M2 in your pom.xml file.  If you want
to use Camel 1.6.0, I would strongly recommend you to upgrade to
Servicemix 3.3.1 which ships with support for Camel 1.6.0.  The only
way to use Camel 2.0-SNAPSHOT/Mx in ServiceMix at the moment is by
building the servicemix-camel component locally yourself (cfr.
https://issues.apache.org/activemq/browse/SMXCOMP-563)

Aligning on one single version of Camel will probably get rid of most
of the Exceptions you're seeing...

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/7/2 akshay_ajmani <ak...@gmail.com>:
>
> Hi,
>   I will tell u the complete procedure that I followed.
> 1)Created the various service units and assemblies corresponding to the
> example:
> http://cwiki.apache.org/SM/order-file-processing.html
>
> 2) In order to try spring aspects , I did all possible steps required for it
> i.e defining the pointcuts etc.
>  My camel-context.xml looked like the one pasted in the previous.
>
> 3) After deploying it in service mix, I got exception ..RefelectionUtils .
> isNotEqualMethod not defined.
>
> I changed the camel version in the pom.xml to avoid this error. The relevant
> portion of  pom.xml currently is like this:
>
>  <plugin>
>        <groupId>org.apache.camel</groupId>
>        <artifactId>camel-maven-plugin</artifactId>
>        <version>1.6.0</version>
>      </plugin>
>  <dependency>
>      <groupId>org.apache.servicemix</groupId>
>      <artifactId>servicemix-camel</artifactId>
>      <version>${servicemix-version}</version>
>    </dependency>
>    <dependency>
>      <groupId>org.apache.servicemix</groupId>
>      <artifactId>servicemix-core</artifactId>
>      <version>${servicemix-version}</version>
>      <scope>provided</scope>
>    </dependency>
>
> <dependency>
>        <groupId>org.apache.camel</groupId>
>        <artifactId>camel-spring</artifactId>
>        <version>2.0-M2</version>
>    </dependency>
>  </dependencies>
>
>  <properties>
>    <servicemix-version>3.2.3</servicemix-version>
>    <!--  <camel-version>1.4.0</camel-version>-->
>                <camel-version>1.6.0.0-fuse</camel-version>
>  </properties>
>
> 4) After doing this , the aspect was not being called.I think the pointcut
> expression i.e the method which the aspect was defined, its class was not
> being loaded by spring framework.
>
> 5)So I tried to create an aspect on the route builder class.I changed my
> camel-context.xml to the following:
>
> <?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:camel="http://camel.apache.org/schema/spring"
>       xsi:schemaLocation="
>          http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>          http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
>          http://www.springframework.org/schema/aop
>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>           http://camel.apache.org/schema/spring/camel-spring.xsd
>       http://www.springframework.org/schema/context
>       http://www.springframework.org/schema/context/spring-context-2.5.xsd
>            http://www.springframework.org/schema/aop
>       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>       http://www.springframework.org/schema/context
>       http://www.springframework.org/schema/context/spring-context-2.5.xsd
>           ">
>
>       <context:annotation-config />
>
>        <aop:aspectj-autoproxy/>
>
> <camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
>    <routeBuilder ref="myBuilder" />
>  </camelContext>
>
>  <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
> </beans>
>
>
> I changed my point cut expression so that my advice gets called before the
> routebuilder configure method.
>
> But now I am getting an exception
> unexpected element (uri:"http://camel.apache.org/schema/spring",
> local:"camelContext").It is expecting all uris having activemq.
>
> I have attached my camel-su pom.xml for your reference
>
> http://www.nabble.com/file/p24308838/pom.xml pom.xml
>
>
> Gert Vanthienen wrote:
>>
>> L.S.,
>>
>> We should be able to get this to work, but I guess the way classes are
>> loaded in JBI can make this just a bit harder -- some of the Spring
>> AOP bits are being loaded from the JBI container classloader so we
>> might have to add things there.  Just a few informational questions
>> before we start digging into this:
>> - what version of servicemix are you using and which version of the
>> servicemix-camel component?
>> - could you make sure that you're using the same version of Camel in
>> your own pom.xml (e.g. when defining extra components etc)?
>> - can you send us the complete stack trace that you're seeing?
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>>
>>> 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
>>>
>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>
>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>       xsi:schemaLocation="
>>>       http://www.springframework.org/schema/beans
>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>       http://activemq.apache.org/camel/schema/spring
>>>       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
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>
>>>
>>>       <context:annotation-config />
>>>
>>>        <aop:aspectj-autoproxy/>
>>>
>>>
>>>
>>>  <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>           <package>org.camel.su</package>
>>>  </camelContext>
>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>
>>> </beans>
>>>
>>>
>>>
>>> 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,
>>> <?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:aop="http://www.springframework.org/schema/aop"
>>>
>>>  xmlns:context="http://www.springframework.org/schema/context"
>>>       xsi:schemaLocation="
>>>       http://www.springframework.org/schema/beans
>>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>       http://activemq.apache.org/camel/schema/spring
>>>       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
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>>
>>>
>>>       <context:annotation-config />
>>>
>>>        <aop:aspectj-autoproxy/>
>>>
>>>
>>>
>>>  <camelContext id="camel"
>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>> <routeBuilder ref="someRouterBuilder"/>
>>>  </camelContext>
>>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>>> </beans>
>>>
>>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>>
>
> --
> View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24308838.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Service mix + camel + spring aop aspects

Posted by akshay_ajmani <ak...@gmail.com>.
Hi,
   I will tell u the complete procedure that I followed.
1)Created the various service units and assemblies corresponding to the
example:
http://cwiki.apache.org/SM/order-file-processing.html 

2) In order to try spring aspects , I did all possible steps required for it
i.e defining the pointcuts etc.
 My camel-context.xml looked like the one pasted in the previous.

3) After deploying it in service mix, I got exception ..RefelectionUtils .
isNotEqualMethod not defined.

I changed the camel version in the pom.xml to avoid this error. The relevant
portion of  pom.xml currently is like this:

 <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>1.6.0</version>
      </plugin>
 <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-camel</artifactId>
      <version>${servicemix-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-core</artifactId>
      <version>${servicemix-version}</version>
      <scope>provided</scope>
    </dependency>

<dependency>
    	<groupId>org.apache.camel</groupId>
    	<artifactId>camel-spring</artifactId>
    	<version>2.0-M2</version>
    </dependency>
  </dependencies>

  <properties>
    <servicemix-version>3.2.3</servicemix-version>
    <!--  <camel-version>1.4.0</camel-version>-->
    		<camel-version>1.6.0.0-fuse</camel-version>
  </properties>

4) After doing this , the aspect was not being called.I think the pointcut
expression i.e the method which the aspect was defined, its class was not
being loaded by spring framework.

5)So I tried to create an aspect on the route builder class.I changed my
camel-context.xml to the following:

<?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:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
          http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	   http://camel.apache.org/schema/spring/camel-spring.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-2.5.xsd
	    http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-2.5.xsd
	   ">
        
       <context:annotation-config />

	<aop:aspectj-autoproxy/>
 
<camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
    <routeBuilder ref="myBuilder" />    
  </camelContext>
  
  <bean id="myBuilder" class="org.camel.su.MyRouteBuilder"/>
 <bean id="firstAspect" class="org.aspect.FirstAspect"/>
</beans>


I changed my point cut expression so that my advice gets called before the
routebuilder configure method.

But now I am getting an exception 
unexpected element (uri:"http://camel.apache.org/schema/spring",
local:"camelContext").It is expecting all uris having activemq.

I have attached my camel-su pom.xml for your reference

http://www.nabble.com/file/p24308838/pom.xml pom.xml 


Gert Vanthienen wrote:
> 
> L.S.,
> 
> We should be able to get this to work, but I guess the way classes are
> loaded in JBI can make this just a bit harder -- some of the Spring
> AOP bits are being loaded from the JBI container classloader so we
> might have to add things there.  Just a few informational questions
> before we start digging into this:
> - what version of servicemix are you using and which version of the
> servicemix-camel component?
> - could you make sure that you're using the same version of Camel in
> your own pom.xml (e.g. when defining extra components etc)?
> - can you send us the complete stack trace that you're seeing?
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/7/2 akshay_ajmani <ak...@gmail.com>:
>>
>> 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
>>
>> <?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:aop="http://www.springframework.org/schema/aop"
>>              
>>  xmlns:context="http://www.springframework.org/schema/context"
>>       xsi:schemaLocation="
>>       http://www.springframework.org/schema/beans
>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>       http://activemq.apache.org/camel/schema/spring
>>       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
>>
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>
>>
>>       <context:annotation-config />
>>
>>        <aop:aspectj-autoproxy/>
>>
>>
>>
>>  <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>           <package>org.camel.su</package>
>>  </camelContext>
>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>
>> </beans>
>>
>>
>>
>> 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,
>> <?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:aop="http://www.springframework.org/schema/aop"
>>              
>>  xmlns:context="http://www.springframework.org/schema/context"
>>       xsi:schemaLocation="
>>       http://www.springframework.org/schema/beans
>>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>       http://activemq.apache.org/camel/schema/spring
>>       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
>>
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>>
>>
>>       <context:annotation-config />
>>
>>        <aop:aspectj-autoproxy/>
>>
>>
>>
>>  <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> <routeBuilder ref="someRouterBuilder"/>
>>  </camelContext>
>>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
>> </beans>
>>
>> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://www.nabble.com/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24308838.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Service mix + camel + spring aop aspects

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

We should be able to get this to work, but I guess the way classes are
loaded in JBI can make this just a bit harder -- some of the Spring
AOP bits are being loaded from the JBI container classloader so we
might have to add things there.  Just a few informational questions
before we start digging into this:
- what version of servicemix are you using and which version of the
servicemix-camel component?
- could you make sure that you're using the same version of Camel in
your own pom.xml (e.g. when defining extra components etc)?
- can you send us the complete stack trace that you're seeing?

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/7/2 akshay_ajmani <ak...@gmail.com>:
>
> 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
>
> <?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:aop="http://www.springframework.org/schema/aop"
>                xmlns:context="http://www.springframework.org/schema/context"
>       xsi:schemaLocation="
>       http://www.springframework.org/schema/beans
>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>       http://activemq.apache.org/camel/schema/spring
>       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
>
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>
>
>       <context:annotation-config />
>
>        <aop:aspectj-autoproxy/>
>
>
>
>  <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
>           <package>org.camel.su</package>
>  </camelContext>
>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>
> </beans>
>
>
>
> 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,
> <?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:aop="http://www.springframework.org/schema/aop"
>                xmlns:context="http://www.springframework.org/schema/context"
>       xsi:schemaLocation="
>       http://www.springframework.org/schema/beans
>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>       http://activemq.apache.org/camel/schema/spring
>       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
>
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>
>
>       <context:annotation-config />
>
>        <aop:aspectj-autoproxy/>
>
>
>
>  <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <routeBuilder ref="someRouterBuilder"/>
>  </camelContext>
>  <bean id="firstAspect" class="org.aspect.FirstAspect"/>
>  <bean id="someRouterBuilder" class="org.camel.su.MyRouteBuilder"/>
> </beans>
>
> 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/Service-mix-%2B-camel-%2B-spring-aop-aspects-tp24307006p24307006.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>