1 Reply Latest reply on Nov 18, 2008 9:01 AM by janstey

    java.io.FileNotFoundException

    mamta.mehta

      Hi

      I am using Fuse Mediation Router and wrote a sample example as mentioned in getting started for users from eclipse ID.

      I have configured all the steps mention in the documentation.

      But when i run the MyRouteBuilder.java i am getting the following error

       

       

      Nov 13, 2008 5:30:50 PM org.apache.camel.util.MainSupport doStart

      INFO: Apache Camel 1.5.0.0-fuse starting

      Nov 13, 2008 5:30:50 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh

      INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@8f4fb3: display name ; startup date ; root of context hierarchy

      Nov 13, 2008 5:30:50 PM org.apache.camel.util.MainSupport run

      SEVERE: Failed: org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern ; nested exception is java.io.FileNotFoundException: class path resource cannot be resolved to URL because it does not exist

      org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern ; nested exception is java.io.FileNotFoundException: class path resource cannot be resolved to URL because it does not exist

           at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:190)

           at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

           at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)

           at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)

           at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)

           at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)

           at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)

           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)

           at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)

           at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:189)

           at org.apache.camel.spring.Main.doStart(Main.java:152)

           at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)

           at org.apache.camel.util.MainSupport.run(MainSupport.java:121)

           at org.apache.camel.util.MainSupport.run(MainSupport.java:310)

           at org.apache.camel.spring.Main.main(Main.java:72)

           at tutorial.MyRouteBuilder.main(MyRouteBuilder.java:37)

      Caused by: java.io.FileNotFoundException: class path resource cannot be resolved to URL because it does not exist

           at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:163)

           at org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatternResolver.java:406)

           at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:338)

           at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:276)

           at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1018)

           at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:177)

           ... 16 more

       

       

      Please look into it and response as early as possible.

      Thank you in advance

       

      Regards,

      Mamta.

        • 1. Re: java.io.FileNotFoundException
          janstey

          Mamta,

           

          Please ensure that you have a Camel context file (Spring beans file) in the following location in your maven based project.

           

          src/main/resources/META-INF/spring/camel-context.xml

           

          If you are using the Java DSL only, you can configure your Spring XML as (where the  element is your RouteBuilder's package name:

           

          <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.5.xsd
                 http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
          
            <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
              <package>org.myproject.newjavarouter</package>
            </camelContext>
          </beans>
          

           

          Alternatively, you don't have to use the Spring XML file at all and create the CamelContext in Java. See http://svn.apache.org/repos/asf/activemq/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java for an example of this.

           

          Cheers,

          Jon