Hi,

With the following spring DSL :

<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";
        xmlns:cxf="http://camel.apache.org/schema/cxfEndpoint";
        xsi:schemaLocation=" http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                http://camel.apache.org/schema/osgi
                http://camel.apache.org/schema/osgi/camel-osgi.xsd
                http://camel.apache.org/schema/spring
                http://camel.apache.org/schema/spring/camel-spring.xsd
                http://camel.apache.org/schema/cxfEndpoint
                http://camel.apache.org/schema/cxf/camel-cxf.xsd";>
                
        <!-- not required for camel-cxf camel-cxf-2.0-SNAPSHOT
    <import resource="classpath:META-INF/cxf/cxf.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
         -->
         
        <bean id="bindyDataformat"
                  
class="org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat">
             <constructor-arg type="java.lang.String"
value="org.apache.camel.example.reportincident.model" />
        </bean>
        
        <bean id="csv" 
class="org.apache.camel.example.reportincident.csv.CsvBean"
/>
        
        
        <bean id="reportIncidentEndpoint"
class="org.apache.camel.example.reportincident.service.ReportIncidentEndpointService"/>
        
        <bean id="OK"
class="org.apache.camel.example.reportincident.domain.OutputReportIncident">
                <property name="code" value="0"/>
        </bean>
        
    <!-- webservice endpoint -->           
    <cxf:cxfEndpoint id="reportIncident"
                     address="http://localhost:8080/camel-example/incident";
                     wsdlURL="wsdl/report_incident.wsdl"
                     serviceClass="#reportIncidentEndpoint"
                     endpointName="s:ReportIncidentPort"
                     serviceName="s:ReportIncidentService" 
                    
xmlns:s="http://reportincident.example.camel.apache.org";>
                     <!--  <cxf:properties>
                                        <entry key="dataFormat" 
value="PAYLOAD"/>
                     </cxf:properties>  -->
    </cxf:cxfEndpoint>
     

        
        <camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi";>
        
<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
                
                <!-- File route  -->
                <camel:route>
                        <camel:from
uri="file://d:/temp/data/?moveExpression=d:/temp/done/${file:name}" />
                        <camel:unmarshal ref="bindyDataformat" />
                        <camel:to uri="bean:csv" />
                </camel:route>
                
                <!-- CXF route -->
                <camel:route>
                        <camel:from     uri="cxf:bean:reportIncident" />
                    <camel:to uri="log:cxf" />
                        <camel:convertBodyTo
type="org.apache.camel.example.reportincident.domain.InputReportIncident" />
                        <camel:to uri="log:cxf" />
                        <camel:transform>
                            <camel:method bean="OK" method="code"/>
                        </camel:transform>
                </camel:route>
                 
                 
        </camelContext>
</beans>

spring generates the following error in SMX4:

s...@root:osgi> start 85
s...@root:osgi> Exception in thread "SpringOsgiExtenderThread-16"
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'reportIncide
Initialization of bean failed; nested exception is
java.lang.IllegalStateException: BeanFactory not initialized or already
closed - call 'refresh' before accessing b
via the ApplicationContext
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:68)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:343)
        at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:30
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplica
ontextExecutor.java:138)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or
already closed - call 'refresh' before accessing beans via the
ApplicationContext
        at
org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:153)
        at
org.springframework.context.support.AbstractApplicationContext.getBeanDefinitionNames(AbstractApplicationContext.java:929)
        at
org.apache.cxf.configuration.spring.ConfigurerImpl.initWildcardDefinitionMap(ConfigurerImpl.java:77)
        at
org.apache.cxf.configuration.spring.ConfigurerImpl.addApplicationContext(ConfigurerImpl.java:223)
        at
org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(BusWiringBeanFactoryPostProcessor.java:118)
        at
org.apache.camel.component.cxf.spring.CxfEndpointBeanDefinitionParser$CxfSpringEndpointBean.setApplicationContext(CxfEndpointBeanDefinitionParser.java:161
        at
org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:70)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactor
a:350)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        ... 16 more

Regards,

-----
Charles Moulliard
SOA Architect

My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: 
http://www.nabble.com/camel-cxf-on-SMX4-%3A-org.springframework.beans.factory.BeanCreationException-tp22333848p22333848.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to