You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "colin.chi" <ib...@hotmail.com> on 2010/01/04 05:02:37 UTC

About Custom Intercepter

I have writed a cxf InIntercepter which extends AbstractPhaseInterceptor
class, and export in cxfInIntercepter.jar. And put this jar file into
C:\apache-servicemix-3.3.1\lib\optional
=======================================
public class CxfBCConsumerLogCollecter extends
AbstractPhaseInterceptor<Message> {

    public CxfBCConsumerLogCollecter() {
		super(Phase.RECEIVE);
    }

    public void handleMessage(Message message) {
        //business code
    }
}
=======================================

Then I uesed it like this:>
=======================================
<cxfbc:consumer wsdl="classpath:service.wsdl"
                        targetEndpoint="endpoint"
                        targetService="tns:wireTap">
    <cxfbc:inInterceptors>
        <ref bean="logCollecter" />
    </cxfbc:inInterceptors>
</cxfbc:consumer>

<bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter" />
=======================================

After build this maven project, I deployed in servicemix, and in servicemix
console there is error log like this:
=======================================
2010-01-04 11:32:29,765 [Timer-2] ERROR
org.apache.servicemix.cxfbc.CxfBcComponent -
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Bean class [com.test.CxfBCConsumerLogCollecter] no
t found
Offending resource: file
[C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa\version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml]
Bean 'logCollecter'; nested exception is java.lang.ClassNotFoundException:
com.test.CxfBCConsumerLogCo
llecter in classloader com.test.CxfBCConsumerLogCollecter
=======================================


why java.lang.ClassNotFoundException, what can I do for the package
cxfInIntercepter.jar? 
-- 
View this message in context: http://old.nabble.com/About-Custom-Intercepter-tp27008095p27008095.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: About Custom Intercepter

Posted by "colin.chi" <ib...@hotmail.com>.
Hi Freeman,

Thanks very much, I have resolved this problem.

:handshake:

Freeman Fang wrote:
> 
> Hi,
> I don't use windows box but I believe this error comes from your incorrect
> windows file uri in <location> element.
> 
> You should use something like
> <location>file:///C:/apache-servicemix-3.3.1/lib/app/Log4ServiceMix.jar</location>
> 
> Freeman
> 
> 
> 
> colin.chi wrote:
>> 
>> Hi Freeman,
>> 
>> I have done this follow as your suggestion.
>> ========================================
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>>        xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>>        xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
>>        xsi:schemaLocation="http://servicemix.apache.org/cxfbc/1.0
>> http://servicemix.apache.org/schema/servicemix-cxfbc-3.2.3.xsd
>>        http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>> 
>> <classpath>
>>    
>> <location>C:\apache-servicemix-3.3.1/lib/app/Log4ServiceMix.jar</location>
>>    
>> <location>C:\apache-servicemix-3.3.1/lib/app/CommonComponent.jar</location>
>>    
>> <location>C:\apache-servicemix-3.3.1/lib/app/LogControl.jar</location>
>> </classpath>
>> 
>> <cxfbc:consumer wsdl="classpath:service.wsdl"
>>                   targetEndpoint="endpoint"
>>                   targetService="tns:wireTap">
>>     <cxfbc:inInterceptors>
>>         <ref bean="logCollecter" />
>>     </cxfbc:inInterceptors>
>>   </cxfbc:consumer>
>> 
>> <bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter"/>
>> </beans>
>> ========================================
>> 
>> And also I got error log in command console:
>> ========================================
>> 2010-01-04 15:20:53,609 [Timer-2] ERROR
>> org.apache.servicemix.cxfbc.CxfBcComponent -
>> org.springframework.beans.factory.BeanDefinitionStoreException:
>> Unexpected exception parsing XML document from file
>> [C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa\version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml];
>> nested exception is java.lang.IllegalArgumentException
>> 2010-01-04 15:20:53,609 [Timer-2] ERROR
>> org.apache.xbean.spring.context.FileSystemXmlApplicationContext -
>> Exception thrown from ApplicationListener handling ContextClosedEvent
>> java.lang.IllegalStateException: ApplicationEventMulticaster not
>> initialized - call 'refresh' before multicasting events via the context:
>> org.apache.xbean.spring.context.FileSystemXmlApplicationContext@54c9a3:
>> display name
>> [org.apache.xbean.spring.context.FileSystemXmlApplicationContext@54c9a3];
>> startup date [Mon Jan 04 15:20:53 CST 2010]; root of context hierarchy
>>         at
>> org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:287)
>>         at
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
>>         at
>> org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:819)
>> ========================================
>> 
>> so please tell me how to resolve?
>> 
>> Thanks and regards,
>> 
>> 
>> Freeman Fang wrote:
>>> 
>>> Hi,
>>> 
>>> Generally we add jar dependency to su's pom.xml, so that your su  
>>> package will have this jar.
>>> Also you can add classpath element to your xbean.xml to reference the  
>>> external jars, some thing like
>>> <classpath>
>>>        <location>your_smx_home/lib/optional/cxfInIntercepter.jar</ 
>>> location>
>>> </classpath>
>>> 
>>> You may need take a look at [1] to get more details
>>> [1]http://servicemix.apache.org/classloaders.html
>>> 
>>> Freeman
>>> 
>>> On 2010-1-4, at 下午12:02, colin.chi wrote:
>>> 
>>>>
>>>> I have writed a cxf InIntercepter which extends  
>>>> AbstractPhaseInterceptor
>>>> class, and export in cxfInIntercepter.jar. And put this jar file into
>>>> C:\apache-servicemix-3.3.1\lib\optional
>>>> =======================================
>>>> public class CxfBCConsumerLogCollecter extends
>>>> AbstractPhaseInterceptor<Message> {
>>>>
>>>>    public CxfBCConsumerLogCollecter() {
>>>> 		super(Phase.RECEIVE);
>>>>    }
>>>>
>>>>    public void handleMessage(Message message) {
>>>>        //business code
>>>>    }
>>>> }
>>>> =======================================
>>>>
>>>> Then I uesed it like this:>
>>>> =======================================
>>>> <cxfbc:consumer wsdl="classpath:service.wsdl"
>>>>                        targetEndpoint="endpoint"
>>>>                        targetService="tns:wireTap">
>>>>    <cxfbc:inInterceptors>
>>>>        <ref bean="logCollecter" />
>>>>    </cxfbc:inInterceptors>
>>>> </cxfbc:consumer>
>>>>
>>>> <bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter" />
>>>> =======================================
>>>>
>>>> After build this maven project, I deployed in servicemix, and in  
>>>> servicemix
>>>> console there is error log like this:
>>>> =======================================
>>>> 2010-01-04 11:32:29,765 [Timer-2] ERROR
>>>> org.apache.servicemix.cxfbc.CxfBcComponent -
>>>> org 
>>>> .springframework.beans.factory.parsing.BeanDefinitionParsingException:
>>>> Configuration problem: Bean class  
>>>> [com.test.CxfBCConsumerLogCollecter] no
>>>> t found
>>>> Offending resource: file
>>>> [C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa 
>>>> \version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml]
>>>> Bean 'logCollecter'; nested exception is  
>>>> java.lang.ClassNotFoundException:
>>>> com.test.CxfBCConsumerLogCo
>>>> llecter in classloader com.test.CxfBCConsumerLogCollecter
>>>> =======================================
>>>>
>>>>
>>>> why java.lang.ClassNotFoundException, what can I do for the package
>>>> cxfInIntercepter.jar?
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/About-Custom-Intercepter-tp27008095p27008095.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>> 
>>> 
>>> -- 
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/About-Custom-Intercepter-tp27008095p27022496.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: About Custom Intercepter

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
I don't use windows box but I believe this error comes from your incorrect
windows file uri in <location> element.

You should use something like
<location>file:///C:/apache-servicemix-3.3.1/lib/app/Log4ServiceMix.jar</location>

Freeman



colin.chi wrote:
> 
> Hi Freeman,
> 
> I have done this follow as your suggestion.
> ========================================
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>        xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://servicemix.apache.org/cxfbc/1.0
> http://servicemix.apache.org/schema/servicemix-cxfbc-3.2.3.xsd
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
> 
> <classpath>
>    
> <location>C:\apache-servicemix-3.3.1/lib/app/Log4ServiceMix.jar</location>
>    
> <location>C:\apache-servicemix-3.3.1/lib/app/CommonComponent.jar</location>
>     <location>C:\apache-servicemix-3.3.1/lib/app/LogControl.jar</location>
> </classpath>
> 
> <cxfbc:consumer wsdl="classpath:service.wsdl"
>                   targetEndpoint="endpoint"
>                   targetService="tns:wireTap">
>     <cxfbc:inInterceptors>
>         <ref bean="logCollecter" />
>     </cxfbc:inInterceptors>
>   </cxfbc:consumer>
> 
> <bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter"/>
> </beans>
> ========================================
> 
> And also I got error log in command console:
> ========================================
> 2010-01-04 15:20:53,609 [Timer-2] ERROR
> org.apache.servicemix.cxfbc.CxfBcComponent -
> org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected
> exception parsing XML document from file
> [C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa\version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml];
> nested exception is java.lang.IllegalArgumentException
> 2010-01-04 15:20:53,609 [Timer-2] ERROR
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext -
> Exception thrown from ApplicationListener handling ContextClosedEvent
> java.lang.IllegalStateException: ApplicationEventMulticaster not
> initialized - call 'refresh' before multicasting events via the context:
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext@54c9a3:
> display name
> [org.apache.xbean.spring.context.FileSystemXmlApplicationContext@54c9a3];
> startup date [Mon Jan 04 15:20:53 CST 2010]; root of context hierarchy
>         at
> org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:287)
>         at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
>         at
> org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:819)
> ========================================
> 
> so please tell me how to resolve?
> 
> Thanks and regards,
> 
> 
> Freeman Fang wrote:
>> 
>> Hi,
>> 
>> Generally we add jar dependency to su's pom.xml, so that your su  
>> package will have this jar.
>> Also you can add classpath element to your xbean.xml to reference the  
>> external jars, some thing like
>> <classpath>
>>        <location>your_smx_home/lib/optional/cxfInIntercepter.jar</ 
>> location>
>> </classpath>
>> 
>> You may need take a look at [1] to get more details
>> [1]http://servicemix.apache.org/classloaders.html
>> 
>> Freeman
>> 
>> On 2010-1-4, at 下午12:02, colin.chi wrote:
>> 
>>>
>>> I have writed a cxf InIntercepter which extends  
>>> AbstractPhaseInterceptor
>>> class, and export in cxfInIntercepter.jar. And put this jar file into
>>> C:\apache-servicemix-3.3.1\lib\optional
>>> =======================================
>>> public class CxfBCConsumerLogCollecter extends
>>> AbstractPhaseInterceptor<Message> {
>>>
>>>    public CxfBCConsumerLogCollecter() {
>>> 		super(Phase.RECEIVE);
>>>    }
>>>
>>>    public void handleMessage(Message message) {
>>>        //business code
>>>    }
>>> }
>>> =======================================
>>>
>>> Then I uesed it like this:>
>>> =======================================
>>> <cxfbc:consumer wsdl="classpath:service.wsdl"
>>>                        targetEndpoint="endpoint"
>>>                        targetService="tns:wireTap">
>>>    <cxfbc:inInterceptors>
>>>        <ref bean="logCollecter" />
>>>    </cxfbc:inInterceptors>
>>> </cxfbc:consumer>
>>>
>>> <bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter" />
>>> =======================================
>>>
>>> After build this maven project, I deployed in servicemix, and in  
>>> servicemix
>>> console there is error log like this:
>>> =======================================
>>> 2010-01-04 11:32:29,765 [Timer-2] ERROR
>>> org.apache.servicemix.cxfbc.CxfBcComponent -
>>> org 
>>> .springframework.beans.factory.parsing.BeanDefinitionParsingException:
>>> Configuration problem: Bean class  
>>> [com.test.CxfBCConsumerLogCollecter] no
>>> t found
>>> Offending resource: file
>>> [C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa 
>>> \version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml]
>>> Bean 'logCollecter'; nested exception is  
>>> java.lang.ClassNotFoundException:
>>> com.test.CxfBCConsumerLogCo
>>> llecter in classloader com.test.CxfBCConsumerLogCollecter
>>> =======================================
>>>
>>>
>>> why java.lang.ClassNotFoundException, what can I do for the package
>>> cxfInIntercepter.jar?
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/About-Custom-Intercepter-tp27008095p27008095.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>> 
>> 
>> -- 
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/About-Custom-Intercepter-tp27008095p27009743.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: About Custom Intercepter

Posted by "colin.chi" <ib...@hotmail.com>.
Hi Freeman,

I have done this follow as your suggestion.
========================================
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
       xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://servicemix.apache.org/cxfbc/1.0
http://servicemix.apache.org/schema/servicemix-cxfbc-3.2.3.xsd
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<classpath>
   
<location>C:\apache-servicemix-3.3.1/lib/app/Log4ServiceMix.jar</location>
   
<location>C:\apache-servicemix-3.3.1/lib/app/CommonComponent.jar</location>
    <location>C:\apache-servicemix-3.3.1/lib/app/LogControl.jar</location>
</classpath>

<cxfbc:consumer wsdl="classpath:service.wsdl"
                  targetEndpoint="endpoint"
                  targetService="tns:wireTap">
    <cxfbc:inInterceptors>
        <ref bean="logCollecter" />
    </cxfbc:inInterceptors>
  </cxfbc:consumer>

<bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter"/>
</beans>
========================================

And also I got error log in command console:
========================================
2010-01-04 15:20:53,609 [Timer-2] ERROR
org.apache.servicemix.cxfbc.CxfBcComponent -
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected
exception parsing XML document from file
[C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa\version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml];
nested exception is java.lang.IllegalArgumentException
2010-01-04 15:20:53,609 [Timer-2] ERROR
org.apache.xbean.spring.context.FileSystemXmlApplicationContext - Exception
thrown from ApplicationListener handling ContextClosedEvent
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized
- call 'refresh' before multicasting events via the context:
org.apache.xbean.spring.context.FileSystemXmlApplicationContext@54c9a3:
display name
[org.apache.xbean.spring.context.FileSystemXmlApplicationContext@54c9a3];
startup date [Mon Jan 04 15:20:53 CST 2010]; root of context hierarchy
        at
org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:287)
        at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
        at
org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:819)
========================================

so please tell me how to resolve?

Thanks and regards,


Freeman Fang wrote:
> 
> Hi,
> 
> Generally we add jar dependency to su's pom.xml, so that your su  
> package will have this jar.
> Also you can add classpath element to your xbean.xml to reference the  
> external jars, some thing like
> <classpath>
>        <location>your_smx_home/lib/optional/cxfInIntercepter.jar</ 
> location>
> </classpath>
> 
> You may need take a look at [1] to get more details
> [1]http://servicemix.apache.org/classloaders.html
> 
> Freeman
> 
> On 2010-1-4, at 下午12:02, colin.chi wrote:
> 
>>
>> I have writed a cxf InIntercepter which extends  
>> AbstractPhaseInterceptor
>> class, and export in cxfInIntercepter.jar. And put this jar file into
>> C:\apache-servicemix-3.3.1\lib\optional
>> =======================================
>> public class CxfBCConsumerLogCollecter extends
>> AbstractPhaseInterceptor<Message> {
>>
>>    public CxfBCConsumerLogCollecter() {
>> 		super(Phase.RECEIVE);
>>    }
>>
>>    public void handleMessage(Message message) {
>>        //business code
>>    }
>> }
>> =======================================
>>
>> Then I uesed it like this:>
>> =======================================
>> <cxfbc:consumer wsdl="classpath:service.wsdl"
>>                        targetEndpoint="endpoint"
>>                        targetService="tns:wireTap">
>>    <cxfbc:inInterceptors>
>>        <ref bean="logCollecter" />
>>    </cxfbc:inInterceptors>
>> </cxfbc:consumer>
>>
>> <bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter" />
>> =======================================
>>
>> After build this maven project, I deployed in servicemix, and in  
>> servicemix
>> console there is error log like this:
>> =======================================
>> 2010-01-04 11:32:29,765 [Timer-2] ERROR
>> org.apache.servicemix.cxfbc.CxfBcComponent -
>> org 
>> .springframework.beans.factory.parsing.BeanDefinitionParsingException:
>> Configuration problem: Bean class  
>> [com.test.CxfBCConsumerLogCollecter] no
>> t found
>> Offending resource: file
>> [C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa 
>> \version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml]
>> Bean 'logCollecter'; nested exception is  
>> java.lang.ClassNotFoundException:
>> com.test.CxfBCConsumerLogCo
>> llecter in classloader com.test.CxfBCConsumerLogCollecter
>> =======================================
>>
>>
>> why java.lang.ClassNotFoundException, what can I do for the package
>> cxfInIntercepter.jar?
>> -- 
>> View this message in context:
>> http://old.nabble.com/About-Custom-Intercepter-tp27008095p27008095.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
> 
> 
> -- 
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/About-Custom-Intercepter-tp27008095p27009589.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: About Custom Intercepter

Posted by "colin.chi" <ib...@hotmail.com>.
Hi Freeman,

I have found following in [1]http://servicemix.apache.org/classloaders.html.
========================================
<classpath>
  <location>${servicemix.home}/lib/ext/my.jar</location>
</classpath>
========================================

can I use ${servicemix.home}? or it needs other configuration in su
xbean.xml?


Freeman Fang wrote:
> 
> Hi,
> 
> Generally we add jar dependency to su's pom.xml, so that your su  
> package will have this jar.
> Also you can add classpath element to your xbean.xml to reference the  
> external jars, some thing like
> <classpath>
>        <location>your_smx_home/lib/optional/cxfInIntercepter.jar</ 
> location>
> </classpath>
> 
> You may need take a look at [1] to get more details
> [1]http://servicemix.apache.org/classloaders.html
> 
> Freeman
> 
> On 2010-1-4, at 下午12:02, colin.chi wrote:
> 
>>
>> I have writed a cxf InIntercepter which extends  
>> AbstractPhaseInterceptor
>> class, and export in cxfInIntercepter.jar. And put this jar file into
>> C:\apache-servicemix-3.3.1\lib\optional
>> =======================================
>> public class CxfBCConsumerLogCollecter extends
>> AbstractPhaseInterceptor<Message> {
>>
>>    public CxfBCConsumerLogCollecter() {
>> 		super(Phase.RECEIVE);
>>    }
>>
>>    public void handleMessage(Message message) {
>>        //business code
>>    }
>> }
>> =======================================
>>
>> Then I uesed it like this:>
>> =======================================
>> <cxfbc:consumer wsdl="classpath:service.wsdl"
>>                        targetEndpoint="endpoint"
>>                        targetService="tns:wireTap">
>>    <cxfbc:inInterceptors>
>>        <ref bean="logCollecter" />
>>    </cxfbc:inInterceptors>
>> </cxfbc:consumer>
>>
>> <bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter" />
>> =======================================
>>
>> After build this maven project, I deployed in servicemix, and in  
>> servicemix
>> console there is error log like this:
>> =======================================
>> 2010-01-04 11:32:29,765 [Timer-2] ERROR
>> org.apache.servicemix.cxfbc.CxfBcComponent -
>> org 
>> .springframework.beans.factory.parsing.BeanDefinitionParsingException:
>> Configuration problem: Bean class  
>> [com.test.CxfBCConsumerLogCollecter] no
>> t found
>> Offending resource: file
>> [C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa 
>> \version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml]
>> Bean 'logCollecter'; nested exception is  
>> java.lang.ClassNotFoundException:
>> com.test.CxfBCConsumerLogCo
>> llecter in classloader com.test.CxfBCConsumerLogCollecter
>> =======================================
>>
>>
>> why java.lang.ClassNotFoundException, what can I do for the package
>> cxfInIntercepter.jar?
>> -- 
>> View this message in context:
>> http://old.nabble.com/About-Custom-Intercepter-tp27008095p27008095.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
> 
> 
> -- 
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/About-Custom-Intercepter-tp27008095p27008824.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: About Custom Intercepter

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Generally we add jar dependency to su's pom.xml, so that your su  
package will have this jar.
Also you can add classpath element to your xbean.xml to reference the  
external jars, some thing like
<classpath>
       <location>your_smx_home/lib/optional/cxfInIntercepter.jar</ 
location>
</classpath>

You may need take a look at [1] to get more details
[1]http://servicemix.apache.org/classloaders.html

Freeman

On 2010-1-4, at 下午12:02, colin.chi wrote:

>
> I have writed a cxf InIntercepter which extends  
> AbstractPhaseInterceptor
> class, and export in cxfInIntercepter.jar. And put this jar file into
> C:\apache-servicemix-3.3.1\lib\optional
> =======================================
> public class CxfBCConsumerLogCollecter extends
> AbstractPhaseInterceptor<Message> {
>
>    public CxfBCConsumerLogCollecter() {
> 		super(Phase.RECEIVE);
>    }
>
>    public void handleMessage(Message message) {
>        //business code
>    }
> }
> =======================================
>
> Then I uesed it like this:>
> =======================================
> <cxfbc:consumer wsdl="classpath:service.wsdl"
>                        targetEndpoint="endpoint"
>                        targetService="tns:wireTap">
>    <cxfbc:inInterceptors>
>        <ref bean="logCollecter" />
>    </cxfbc:inInterceptors>
> </cxfbc:consumer>
>
> <bean id="logCollecter" class="com.test.CxfBCConsumerLogCollecter" />
> =======================================
>
> After build this maven project, I deployed in servicemix, and in  
> servicemix
> console there is error log like this:
> =======================================
> 2010-01-04 11:32:29,765 [Timer-2] ERROR
> org.apache.servicemix.cxfbc.CxfBcComponent -
> org 
> .springframework.beans.factory.parsing.BeanDefinitionParsingException:
> Configuration problem: Bean class  
> [com.test.CxfBCConsumerLogCollecter] no
> t found
> Offending resource: file
> [C:\apache-servicemix-3.3.1\data\smx\service-assemblies\sa 
> \version_1\sus\servicemix-cxf-bc\cxf-bc-provider\xbean.xml]
> Bean 'logCollecter'; nested exception is  
> java.lang.ClassNotFoundException:
> com.test.CxfBCConsumerLogCo
> llecter in classloader com.test.CxfBCConsumerLogCollecter
> =======================================
>
>
> why java.lang.ClassNotFoundException, what can I do for the package
> cxfInIntercepter.jar?
> -- 
> View this message in context: http://old.nabble.com/About-Custom-Intercepter-tp27008095p27008095.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com