[
https://issues.apache.org/jira/browse/CXF-2476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766439#action_12766439
]
Christian Schneider commented on CXF-2476:
------------------------------------------
Thanks for the pointer. I have added a check to the setter but this helps only
when the property is set to "". If it is left out completely the setter is not
called at all. So in this case the NullpointerException still appears. Is there
any method that is or can be called after all properties are set?
> NullpointerException when ServiceClass is not set on client
> -----------------------------------------------------------
>
> Key: CXF-2476
> URL: https://issues.apache.org/jira/browse/CXF-2476
> Project: CXF
> Issue Type: Bug
> Components: JAX-WS Runtime
> Affects Versions: 2.2.4
> Reporter: Christian Schneider
> Assignee: Christian Schneider
>
> When the serviceClass property is set to an empty string or not defined in a
> client definition a NullpointerException is thrown:
> <jaxws:client id="customerService"
> serviceName="customer:CustomerServiceService"
> endpointName="customer:CustomerServiceEndpoint"
> address="http://localhost:9090/CustomerServicePort"
> serviceClass="">
> </jaxws:client>
> The issue can be easily reproduced by deleting the setting the serviceClass
> like above in the WSDL first example and starting the
> CustomerServiceSpringClient.
> I think we should throw a meaningfull Exception that says that serviceClass
> has to be set to the fully qualified name of the service interface. The
> question is only: Where is the right place to put this?
> The exception is attached below:
> --------------------------------------------------------
> Exception in thread "main"
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'tester' defined in class path resource
> [client-applicationContext.xml]: Cannot resolve reference to bean
> 'customerService' while setting bean property 'customerService'; nested
> exception is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'customerService': FactoryBean threw exception on
> object creation; nested exception is java.lang.NullPointerException
> at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
> at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
> 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:221)
> 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:729)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
> at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
> at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
> at
> com.example.customerservice.client.CustomerServiceSpringClient.main(CustomerServiceSpringClient.java:33)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'customerService': FactoryBean threw exception on
> object creation; nested exception is java.lang.NullPointerException
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:127)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116)
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:98)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1285)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:217)
> 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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
> ... 18 more
> Caused by: java.lang.NullPointerException
> at
> org.apache.cxf.jaxws.support.JaxWsImplementorInfo.getWSInterfaceName(JaxWsImplementorInfo.java:231)
> at
> org.apache.cxf.jaxws.support.JaxWsImplementorInfo.initialize(JaxWsImplementorInfo.java:270)
> at
> org.apache.cxf.jaxws.support.JaxWsImplementorInfo.<init>(JaxWsImplementorInfo.java:57)
> at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.setServiceClass(JaxWsServiceFactoryBean.java:173)
> at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.initializeServiceFactory(AbstractWSDLBasedEndpointFactory.java:227)
> at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:99)
> at
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52)
> at
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
> at
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:115)
> at
> org.apache.cxf.jaxws.spring.JaxWsProxyFactoryBeanDefinitionParser$JAXWSSpringClientProxyFactoryBean.getObject(JaxWsProxyFactoryBeanDefinitionParser.java:74)
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:121)
> ... 26 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.