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

Apache's JIRA Issue Tracker | Knut Ivar Skogland | 8 years ago
  1. 0

    [CXF-2083] XMLBeans - XmlBeansSchemaInitializer can't handle xs:import - ASF JIRA

    apache.org | 11 months ago
    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
  2. 0

    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.

    Apache's JIRA Issue Tracker | 8 years ago | Knut Ivar Skogland
    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
  3. 0

    JasperReports and OpenReports | Brian Burridge

    brianburridge.com | 1 week ago
    java.lang.IllegalArgumentException: InputStream cannot be null
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    cxf-user - Problem with SamlHeaderIn

    nabble.com | 11 months ago
    javax.ws.rs.NotAuthorizedException: java.lang.IllegalArgumentException: InputStream cannot be null
  6. 0

    Error on start client

    GitHub | 2 years ago | Pilad
    java.lang.IllegalArgumentException: InputStream cannot be null
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    InputStream cannot be null

    at javax.xml.parsers.DocumentBuilder.parse()
  2. Java RT
    DocumentBuilder.parse
    1. javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:94)
    1 frame
  3. Apache CXF Core
    XMLUtils.parse
    1. org.apache.cxf.helpers.XMLUtils.parse(XMLUtils.java:136)
    1 frame
  4. Apache CXF Runtime XmlBeans DataBinding
    XmlBeansSchemaInitializer.begin
    1. org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:129)
    2. org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.getSchema(XmlBeansSchemaInitializer.java:135)
    3. org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.mapClass(XmlBeansSchemaInitializer.java:200)
    4. org.apache.cxf.xmlbeans.XmlBeansSchemaInitializer.begin(XmlBeansSchemaInitializer.java:170)
    4 frames
  5. Apache CXF Core
    ServiceModelVisitor.walk
    1. org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:97)
    2. org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74)
    2 frames
  6. Apache CXF Runtime XmlBeans DataBinding
    XmlBeansDataBinding.initialize
    1. org.apache.cxf.xmlbeans.XmlBeansDataBinding.initialize(XmlBeansDataBinding.java:102)
    1 frame
  7. Apache CXF Core
    ReflectionServiceFactoryBean.buildServiceFromClass
    1. org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:371)
    1 frame
  8. Apache CXF Runtime JAX-WS Frontend
    JaxWsServiceFactoryBean.buildServiceFromClass
    1. org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:525)
    1 frame
  9. Apache CXF Core
    ReflectionServiceFactoryBean.create
    1. org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:422)
    2. org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:190)
    2 frames
  10. Apache CXF Runtime JAX-WS Frontend
    JaxWsServiceFactoryBean.create
    1. org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:164)
    1 frame
  11. Apache CXF Runtime Simple Frontend
    ServerFactoryBean.create
    1. org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
    2. org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:117)
    2 frames
  12. Apache CXF Runtime JAX-WS Frontend
    EndpointImpl.publish
    1. org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168)
    2. org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:339)
    3. org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:252)
    4. org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:202)
    5. org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:397)
    5 frames
  13. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:585)
    4 frames
  14. Spring Beans
    DefaultListableBeanFactory.preInstantiateSingletons
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1242)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1208)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
    5. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
    6. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
    7. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
    8. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
    9. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
    9 frames
  15. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    1 frame
  16. Spring
    ContextLoaderListener.contextInitialized
    1. org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
    2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
    3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
    3 frames
  17. Glassfish Core
    Catalina.start
    1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
    2. org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
    3. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    4. org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
    5. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    6. org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    7. org.apache.catalina.core.StandardService.start(StandardService.java:448)
    8. org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
    9. org.apache.catalina.startup.Catalina.start(Catalina.java:552)
    9 frames
  18. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:585)
    4 frames
  19. Glassfish Core
    Bootstrap.main
    1. org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
    2. org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
    2 frames