cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandy Perez (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CXF-4452) NullPointerException when trying to customize the package name for a service definition without customizing the class name.
Date Wed, 01 Aug 2012 21:54:03 GMT
Sandy Perez created CXF-4452:
--------------------------------

             Summary: NullPointerException when trying to customize the package name for a
service definition without customizing the class name.
                 Key: CXF-4452
                 URL: https://issues.apache.org/jira/browse/CXF-4452
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.6.1
         Environment: JDK v1.7
Maven v3.0.4
cxf-codegen-plugin v2.6.1
            Reporter: Sandy Perez
            Priority: Minor


Hello

When I try to use jax-ws customization to customize the package name without customizing the
class name, for example using the following XML code 

<bindings wsdlLocation="myService.wsdl" xmlns="http://java.sun.com/xml/ns/jaxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
	<bindings node="wsdl:definitions/wsdl:service[@name='MyService_V1']">
		<package name="com.acme.myservice.v1.wsdl"/>
	</bindings>
</bindings>

I get the following exception:

[WARNING] WSDLToJava Error: java.lang.NullPointerException
[WARNING] 
[WARNING] org.apache.cxf.tools.common.ToolException: java.lang.NullPointerException
[WARNING] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:294)
[WARNING] 	at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
[WARNING] 	at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
[WARNING] 	at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
[WARNING] 	at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
[WARNING] Caused by: java.lang.NullPointerException
[WARNING] 	at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ServiceProcessor.processService(ServiceProcessor.java:207)
[WARNING] 	at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ServiceProcessor.process(ServiceProcessor.java:100)
[WARNING] 	at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor.wsdlDefinitionToJavaModel(WSDLToJavaProcessor.java:91)
[WARNING] 	at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor.process(WSDLToJavaProcessor.java:60)
[WARNING] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:253)
[WARNING] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:139)
[WARNING] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:286)
[WARNING] 	... 4 more

The problem is in the class named ‘org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.
ServiceProcessor’ in line 207:

if (serviceBinding2.getJaxwsClass().getComments() != null) {
	…
}

If you don’t customize the class name, serviceBinding2.getJaxwsClass() will returns null
so calling getComments() results in a NullPointerException .

A possible quick solution could be to change the condition as follows:

if (serviceBinding2.getJaxwsClass() != null && serviceBinding2.getJaxwsClass().getComments()
!= null) {
	…
}

On the other hand, a possible workaround is to customize the class name. For example, the
following XML code will work fine.

<bindings wsdlLocation="myService.wsdl" xmlns="http://java.sun.com/xml/ns/jaxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
	<bindings node="wsdl:definitions/wsdl:service[@name='MyService_V1']">
		<package name="com.acme.myservice.v1.wsdl"/>
		<class name="MyServiceV1" />
	</bindings>
</bindings>

Best regards,
 ----
Sandy Pérez González
Indaba Consultores S.L.
http://www.indaba.es/

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message