Thank you for the reply.

I folllowed FAQ given at
http://camel.apache.org/how-do-i-import-routes-from-other-xml-files.html

Here is the route that I want to import:

<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.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
    ">
         
     <routeContext id="Testroute"
xmlns="http://camel.apache.org/schema/spring";>
            <route>
               <from uri="file:camel/input"/>
               <choice>
                   <when>
                       <language language="simple">${header.CamelFileName}
regex '^.*xml$'</language>
                       <to uri="file:camel/xmlFolder"/>
                   </when>
                   <when>
                       <language language="simple">${header.CamelFileName}
regex '^.*(csv|csl)$'</language>
                       <to uri="file:camel/cvsFolder"/>
                   </when>
                   <otherwise>
                       <to uri="file:camel/others"/>
                       <stop/>
                   </otherwise>
               </choice>
      </route>
    </routeContext>
    
</beans>  

and here is the XML file where I want to import the above route:

<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.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
 ">

 
 
<import resource="Testroute.xml"/>

<camelContext xmlns="http://camel.apache.org/schema/spring";>

 <routeContextRef ref="Testroute"/>
</camelContext>
</beans>

I am getting following error: (please tell me what is going wrong)
  


karaf@root> Exception in thread "SpringOsgiExtenderThread-21"
java.lang.IllegalStateException: BeanFactory not initialized or already
closed - call 'r
efresh' before accessing beans via the ApplicationContext
        at
org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicatio
nContextExecutor.java:345)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.fail(DependencyWaiterApplication
ContextExecutor.java:401)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplica
tionContextExecutor.java:287)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicat
ionContextExecutor.java:175)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.
java:175)
        at
org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718)
        at java.lang.Thread.run(Thread.java:662)

--
View this message in context: 
http://camel.465427.n5.nabble.com/separate-files-are-the-Spring-DSL-tp4903855p4905181.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to