Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Information Provided
-
3.3.10, 3.4.5
-
None
-
None
-
Windows 10 + JDK8 + Tomcat 8.75
-
Unknown
Description
I am trying to set com.sun.xml.bind.treatEverythingNillable property to true as mentioned in document. But is throwing error.
https://cxf.apache.org/docs/jaxb.html
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <!-- <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" /> --> <jaxws:endpoint xmlns:tns="http://xmlns.chetan.com/oxp/service/v2" id="StudentService" implementor="com.chetan.webservices.cxf.StudentService" wsdlLocation="WEB-INF/wsdl/StudentService.wsdl" endpointName="tns:StudentService" serviceName="tns:StudentService" address="/v2/StudentService"> <jaxws:dataBinding> <bean class="org.apache.cxf.jaxb.JAXBDataBinding"> <property name="contextProperties"> <map> <entry> <key><value>com.sun.xml.bind.treatEverythingNillable</value></key> <value>true</value> </entry> </map> </property> </bean> </jaxws:dataBinding> </jaxws:endpoint> <bean id="DocumentBuilderFactory" class="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"> </bean> <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus"/> <cxf:bus> <cxf:properties> <entry key="org.apache.cxf.stax.maxChildElements" value="250000"/> <entry key="org.apache.cxf.stax.maxElementDepth" value="500"/> <!--<entry key="org.apache.cxf.stax.maxAttributeCount" value="500/>--> <!-- <entry key="org.apache.cxf.stax.maxAttributeSize" value="65536"/>--> <entry key="org.apache.cxf.stax.maxTextLength" value="1073741824"/> </cxf:properties> </cxf:bus> </beans>
INFO | Creating Service {http://xmlns.chetan.com/oxp/service/v2}StudentService from WSDL: WEB-INF/wsdl/StudentService.wsdl WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'StudentService': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException ERROR | Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'StudentService': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1619) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:673) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1881) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1748) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1685) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1615) ... 25 more Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:357) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:87) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:425) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:262) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) ... 34 more Caused by: javax.xml.bind.JAXBException: true is not a valid value for property "com.sun.xml.bind.treatEverythingNillable" at com.sun.xml.bind.v2.ContextFactory.getPropertyValue(ContextFactory.java:177) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:247) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:234) at javax.xml.bind.ContextFinder.find(ContextFinder.java:441) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:641) at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:345) at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:343) at java.security.AccessController.doPrivileged(Native Method) at org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:343) at org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:245) at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:496) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:355) ... 44 more Feb 13, 2022 1:33:11 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'StudentService': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1619) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:673) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1881) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1748) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1685) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1615) ... 25 more Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:357) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:87) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:425) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:262) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) ... 34 more Caused by: javax.xml.bind.JAXBException: true is not a valid value for property "com.sun.xml.bind.treatEverythingNillable" at com.sun.xml.bind.v2.ContextFactory.getPropertyValue(ContextFactory.java:177) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:247) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:234) at javax.xml.bind.ContextFinder.find(ContextFinder.java:441) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:641) at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:345) at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:343) at java.security.AccessController.doPrivileged(Native Method) at org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:343) at org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:245) at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:496) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:355) ... 44 more