Hi Ashwin,

Well i added the start as follows:

public void configure() throws Exception {      
      getContext().start();
      
      getContext().addInterceptStrategy(new MyFromEndpointInterceptor()); 
      from("jbi:service:http://oxp/oXpInternalService";)
        .process(new OXpServicesAuthenticationProcessor());
}

& i validated that i added the camel-core jar (1.4.0-fuse) to my classpath.

Here is the dependency section in the pom.xml:

<dependencies>
                <dependency>
                        <groupId>org.apache.servicemix</groupId>
                        <artifactId>servicemix-camel</artifactId>
                        <version>${servicemix-version}</version>
                        <scope>provided</scope>
                </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>1.4.0</version>
      </dependency>
      <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>1.4.0</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>1.4.0</version>
      </dependency>
</dependencies>

& still i get the same exception. I googled it & found something related:
maybe you can check: 
https://issues.apache.org/activemq/browse/SM-1327

Here is my classpath - Maybe you can spot somehing:

<classpath>
  <classpathentry kind="src" path="src/main/java"/>
  <classpathentry kind="src" path="src/main/resources"
excluding="**/*.java"/>
  <classpathentry kind="output" path="target/classes"/>
  <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="var"
path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/activemq/activeio-core/3.1.0.0-fuse/activeio-core-3.1.0.0-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/activemq/activemq-core/5.0.0.18-fuse/activemq-core-5.0.0.18-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/axis/axis-ant/1.4/axis-ant-1.4.jar"/>
  <classpathentry kind="var"
path="M2_REPO/bouncycastle/bcprov-jdk14/136/bcprov-jdk14-136.jar"/>
  <classpathentry kind="var"
path="M2_REPO/bouncycastle/bcprov-jdk15/132/bcprov-jdk15-132.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/camel/camel-core/1.4.1.0-fuse/camel-core-1.4.1.0-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/camel/camel-spring/1.4.1.0-fuse/camel-spring-1.4.1.0-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar"/>
  <classpathentry kind="var"
path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/commons-dbcp/commons-dbcp/1.2/commons-dbcp-1.2.jar"/>
  <classpathentry kind="var"
path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/commons-pool/commons-pool/1.2/commons-pool-1.2.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-activation_1.0.2_spec/1.2/geronimo-activation_1.0.2_spec-1.2.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/components/geronimo-connector/2.0.1/geronimo-connector-2.0.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/modules/geronimo-connector/2.0.1/geronimo-connector-2.0.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.1/geronimo-j2ee-connector_1.5_spec-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-j2ee-jacc_1.0_spec/1.1/geronimo-j2ee-jacc_1.0_spec-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-j2ee-management_1.0_spec/1.1/geronimo-j2ee-management_1.0_spec-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1/geronimo-jms_1.1_spec-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-jta_1.0.1B_spec/1.1/geronimo-jta_1.0.1B_spec-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo-jta_1.1_spec-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/specs/geronimo-qname_1.1_spec/1.1/geronimo-qname_1.1_spec-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/components/geronimo-transaction/2.0.1/geronimo-transaction-2.0.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/geronimo/modules/geronimo-transaction/2.0.1/geronimo-transaction-2.0.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/objectweb/howl/howl/1.0.1-1/howl-1.0.1-1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.6/jaxb-impl-2.1.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/jaxen/jaxen/1.1-beta-9/jaxen-1.1-beta-9.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/jencks/jencks/2.1/jencks-2.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
  <classpathentry kind="var" path="M2_REPO/mx4j/mx4j/3.0.1/mx4j-3.0.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/mx4j/mx4j-remote/3.0.1/mx4j-remote-3.0.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/opensaml/opensaml/1.1/opensaml-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/opensaml/opensaml/1.1/opensaml-1.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/regexp/regexp/1.3/regexp-1.3.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-camel/3.3.1.5-fuse/servicemix-camel-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-common/3.3.1.5-fuse/servicemix-common-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-core/3.3.1.5-fuse/servicemix-core-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-jbi/3.3.1.5-fuse/servicemix-jbi-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-services/3.3.1.5-fuse/servicemix-services-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-shared/3.3.1.5-fuse/servicemix-shared-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-soap/3.3.1.5-fuse/servicemix-soap-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/servicemix/servicemix-soap2/3.3.1.5-fuse/servicemix-soap2-3.3.1.5-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-aop/2.5.5/spring-aop-2.5.5.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-beans/2.0.6/spring-beans-2.0.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-context/2.0.6/spring-context-2.0.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-core/2.5.5/spring-core-2.5.5.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-dao/2.0.6/spring-dao-2.0.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-jms/2.0.6/spring-jms-2.0.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-jmx/2.0.6/spring-jmx-2.0.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-remoting/2.0.6/spring-remoting-2.0.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/springframework/spring-support/2.0.6/spring-support-2.0.6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar"/>
  <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/woden/woden/1.0.0M6/woden-1.0.0M6.jar"/>
  <classpathentry kind="var"
path="M2_REPO/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/ws/security/wss4j/1.5.4/wss4j-1.5.4.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/codehaus/woodstox/wstx-asl/3.2.2/wstx-asl-3.2.2.jar"/>
  <classpathentry kind="var"
path="M2_REPO/xalan/xalan/2.7.0/xalan-2.7.0.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/xbean/xbean-classloader/3.1.0.2-fuse/xbean-classloader-3.1.0.2-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/xbean/xbean-kernel/3.1.0.2-fuse/xbean-kernel-3.1.0.2-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/xbean/xbean-server/3.1.0.2-fuse/xbean-server-3.1.0.2-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/xbean/xbean-spring/3.1.0.2-fuse/xbean-spring-3.1.0.2-fuse.jar"/>
  <classpathentry kind="var"
path="M2_REPO/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar"/>
  <classpathentry kind="var"
path="M2_REPO/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/ws/commons/schema/XmlSchema/1.3.2/XmlSchema-1.3.2.jar"/>
  <classpathentry kind="var"
path="M2_REPO/org/apache/santuario/xmlsec/1.4.0/xmlsec-1.4.0.jar"/>
  <classpathentry kind="var"
path="M2_REPO/xml-security/xmlsec/1.3.0/xmlsec-1.3.0.jar"/>
  <classpathentry kind="var"
path="M2_REPO/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar"/>
  <classpathentry kind="var"
path="M2_REPO/com/thoughtworks/xstream/xstream/1.3/xstream-1.3.jar"/>
</classpath>

Thanks in advance:


Ashwin Karpe wrote:
> 
> Hi Liav,
> 
> Have you add the code in the configure() method. The reason for this issue
> can be one of two things
>    - The Camel listener has not been setup. This means the code is called
> before context.start()
>    - The dependencies cannot be resolved (i.e the jar containing
> org/apache/camel/spi/InterceptStrategy) is not on your build path.
> 
> FUSE 3.3 has the same codebase as Servicemix and if you maven build the
> camel-core and link it in your POM, it should work.
> 
> Cheers,
> 
> Ashwin...
> 
> Liav Ezer wrote:
>> 
>> Hi Ashwin,
>> 
>> My processor works great - if i remove the
>> getContext().addInterceptStrategy(new MyFromEndpointInterceptor()); line
>> everything is smooth.
>> 
>> Can you think of a reason why i get this exception?
>> 
>> framework.beans.factory.BeanCreationException: Error creating bean with
>> name 'camelContext': Invocation of init method failed;
>> apache.camel.CamelContext.addInterceptStrategy(Lorg/apache/camel/spi/InterceptStrategy;)
>> 
>> Every other Camel component (such as processor or producerTemplate) was
>> fine untill i added the addInterceptStrategy API. 
>> (By the way, getContext() alone isn't crushing..)
>> 
>> Maybe it's related to the fact i use esb-fuse-3.3.1.3 & not pure
>> servicemix? (in regards to camel-core jar?!)
>> 
>> This is my camel-context file:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans";
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>        http://activemq.apache.org/camel/schema/spring
>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd";>
>>        <camelContext useJmx="true"
>> xmlns="http://activemq.apache.org/camel/schema/spring";>
>>          <package>com.liav.oxp.esb.poc</package>
>>        </camelContext>
>> </beans>
>> 
>> Thanks.
>> 
>> Ashwin Karpe wrote:
>>> 
>>> Hi Liav,
>>> 
>>> Have you checked the packages in the camel context block of the
>>> camel-context.xml in the resources directory to see if the Camel
>>> processor have been correctly defined.
>>> 
>>> Cheers,
>>> 
>>> Ashwin...
>>> 
>>> 
>>> Liav Ezer wrote:
>>>> 
>>>> Hi, 
>>>> 
>>>> I use servicemix-fuse 3.3.1.3 with Camel 1.4.
>>>> In my Camel Builder i try to add interceptor & it's causing me an
>>>> NoSuchMethodError. 
>>>> 
>>>> My configure method is:
>>>> 
>>>> public void configure() throws Exception { 
>>>> 
>>>>       getContext().addInterceptStrategy(new
>>>> MyFromEndpointInterceptor());       
>>>>       from("jbi:service:http://oxp/oXpInternalService";) 
>>>>       .process(new OXpServicesAuthenticationProcessor()); 
>>>> } 
>>>> 
>>>> This is the context i use (i println it)
>>>> org.apache.camel.spring.SpringCamelContext 
>>>> 
>>>> My exception is at deploy time:
>>>> 
>>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>>> bean with name 'camel:beanPostProcessor': Cannot resolve reference to
>>>> bean 'camel' while setting bean property 'camelContext'; nested
>>>> exception is org.springframework.beans.factory.BeanCreationException:
>>>> Error creating bean with name ' 
>>>> camel': Invocation of init method failed; nested exception is
>>>> java.lang.NoSuchMethodError:
>>>> org.apache.camel.CamelContext.addInterceptStrategy(Lorg/apache/camel/spi/InterceptStrategy;)
>>>>  
>>>> 
>>>> Thanks in advance, 
>>>> Liav. 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Why-getContext%28%29.addInterceptStrategy-is-throwing-an-exception--tp21551665s22882p21578333.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to