org.springframework.beans.factory.BeanCreationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Background: I have a Xfire project which I'm porting to CXF. Using the Document-First approach and using XMLBeans. We have one xsd that imports other xsd's for each "domain". Every "domain" xsd contains requests and responses which imports datatypes from underlaying schemas with different namespaces. This works with JAXB (And Xfire with XMLBeans), but not with CXF and XMLBeans. I have simplified a test project. The structure is like this; PublishedFacade.xsd -- imports sum.xsd | ---- sum.xsd -- contains request and responses. Imports types.xsd. | ---- types.xsd -- contains complextypes and simpletypes for XMLObject validation PublishedFacade.xsd: -------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://cxftest.com/webservicetest/ws/test" xmlns:tns="http://cxftest.com/webservicetest/ws/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" elementFormDefault="qualified"> <xsd:import namespace="http://cxftest.com/webservicetest/ws/test/sum" schemaLocation="sum/sum.xsd"/> </xsd:schema> -------------------------------------------------------------------------- sum.xsd: -------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://cxftest.com/webservicetest/ws/test/sum" xmlns:tns="http://cxftest.com/webservicetest/ws/test/sum" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:types ="http://cxftest.com/webservicetest/ws/test/sum/types" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" elementFormDefault="qualified"> <xsd:import namespace="http://cxftest.com/webservicetest/ws/test/sum/types" schemaLocation="types/types.xsd"/> <xsd:element name="testServiceRequest" type="types:TestServiceRequest" /> <xsd:element name="testServiceResponse" type="types:TestServiceResponse" /> </xsd:schema> -------------------------------------------------------------------------- types.xsd: -------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://cxftest.com/webservicetest/ws/test/sum/types" xmlns:tns="http://cxftest.com/webservicetest/ws/test/sum/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" elementFormDefault="qualified"> <xsd:complexType name="TestServiceRequest"> <xsd:sequence> <xsd:element name="number1" type="xsd:int" minOccurs="0" nillable="true" /> <xsd:element name="number2" type="tns:nummer2" minOccurs="1" nillable="false" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TestServiceResponse"> <xsd:sequence> <xsd:element name="sum" type="xsd:int" minOccurs="1" nillable="false" /> </xsd:sequence> </xsd:complexType> <xsd:simpleType name="nummer2"> <xsd:restriction base="xsd:int"> <xsd:minInclusive value="1"/> <xsd:maxInclusive value="20"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> -------------------------------------------------------------------------- Generate xmlbeans objects with xmlbeans-maven-plugin. When deploying; I get this stack; ---------------------------------------------------------- 13:05:32,193 [] ERROR [org.springframework.web.context.ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testservice': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.RuntimeException: Failed to find schema for: sum/sum.xsd at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1175) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused by: javax.xml.ws.WebServiceException: java.lang.RuntimeException: Failed to find schema for: sum/sum.xsd at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:268) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:202) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:397) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1242) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1208) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) ... 25 more Caused by: java.lang.RuntimeException: Failed to find schema for: sum/sum.xsd at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:148) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.mapClass(XmlBeansSchemaInitializer.java:200) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.begin(XmlBeansSchemaInitializer.java:170) at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:97) at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74) at org.apache.cxf.xmlbeans.XmlBeansDataBinding.initialize(XmlBeansDataBinding.java:102) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:371) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:525) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:422) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:190) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:164) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:117) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:339) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:252) ... 34 more Caused by: java.lang.RuntimeException: Failed to find schema for: types/types.xsd at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:148) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:135) ... 49 more Caused by: java.lang.IllegalArgumentException: InputStream cannot be null at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:94) at org.apache.cxf.helpers.XMLUtils.parse(XMLUtils.java:136) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:129) ... 50 more ---------------------------------------------------------- There were a similar error using xs:include (https://issues.apache.org/jira/browse/CXF-1700), but I can't use include as the wsdl will be different when the namespaces changes. My wsdl's should not change. Project that "explains" the issue has been attatched.
    via by Knut Ivar Skogland,
  • JasperReports and OpenReports | Brian Burridge
    via by Unknown author,
  • cxf-user - Problem with SamlHeaderIn
    via by Unknown author,
  • Error on start client
    via GitHub by Pilad
    ,
  • file not found exception in jar
    via Stack Overflow by swarup7m
    ,
  • Parent directory in Java
    via Stack Overflow by GabrielAtan
    ,
  • java.net.UnknownHostException: url
    via Stack Overflow by Rache
    ,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testservice': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.RuntimeException: Failed to find schema for: sum/sum.xsd at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1175) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused by: javax.xml.ws.WebServiceException: java.lang.RuntimeException: Failed to find schema for: sum/sum.xsd at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:268) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:202) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:397) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1242) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1208) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) ... 25 more Caused by: java.lang.RuntimeException: Failed to find schema for: sum/sum.xsd at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:148) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.mapClass(XmlBeansSchemaInitializer.java:200) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.begin(XmlBeansSchemaInitializer.java:170) at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:97) at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74) at org.apache.cxf.xmlbeans.XmlBeansDataBinding.initialize(XmlBeansDataBinding.java:102) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:371) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:525) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:422) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:190) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:164) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:117) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:339) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:252) ... 34 more Caused by: java.lang.RuntimeException: Failed to find schema for: types/types.xsd at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:148) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:135) ... 49 more Caused by: java.lang.IllegalArgumentException: InputStream cannot be null at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:94) at org.apache.cxf.helpers.XMLUtils.parse(XMLUtils.java:136) at org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:129) ... 50 more

    Users with the same issue

    Unknown visitor1 times, last one,
    Christopher
    2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    bayukresno
    1 times, last one,
    1 more bugmates