IBM Support

MapsId Annotation May Not Be Recognized When Generating WSDL File

Troubleshooting


Problem

When generating a WSDL file using wsgen, any MapsId Annotations contained in entity beans may not be recognized. This results in a compilation failure in wsgen, which then causes a WebServiceException in the server logs when trying to start the application.

Symptom

The following errors may be seen in the SystemOut.log when the application is starting:

[4/23/14 16:42:15:508 EDT] 00000008 WSModuleDescr E WSWS7027E: JAX-WS Service Descriptions could not be correctly built because of the following error: javax.xml.ws.WebServiceException: WSWS7054E: The Web Services Description Language (WSDL) file could not be generated for the com.company.business.Bean Web service implementation class because of the following error: java.lang.Exception: A WSDL Definition could not be generated for the implementation class: com.company.business.Bean
at com.ibm.ws.websvcs.wsdl.WASWSDLGenerator.generateWsdl(WASWSDLGenerator.java:230)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.generateWSDL(EndpointDescriptionImpl.java:1958)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:422)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>(ServiceDescriptionImpl.java:398)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>(ServiceDescriptionImpl.java:293)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescriptionFromDBCMap(DescriptionFactoryImpl.java:273)
at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescriptionFromDBCMap(DescriptionFactory.java:461)
at com.ibm.ws.websvcs.desc.WSModuleDescriptorImpl.buildJAXWSServices(WSModuleDescriptorImpl.java:1009)
.....

If the MapsId annotation is removed from the entity bean, the issue does not occur.

Cause

The MapsId class is packaged with the JPA feature pack. When wsgen is ran to generate the WSDL file, the jar containing the MapsId class is not located on wsgen's classpath.

Environment

WebSphere 7.0

OSGi Applications and Java Persistence API (JPA) 2.0 feature pack

Diagnosing The Problem

The following trace string will provide additional details about the WSDL compilation:
com.ibm.ws.webservices.*=all:org.apache.*=all:com.ibm.ws.websvcs.*=all:com.ibm.ws.metadata.*=all

The trace.log shows the following during application startup:

[4/23/14 16:42:15:423 EDT] 00000008 WASWSDLGenera 3 Output of wsgen: error: compilation failed, errors should have been reported

[4/23/14 16:42:15:423 EDT] 00000008 WASWSDLGenera 3 Other output of wsgen: C:\WebSphere\AppServer\profiles\JPAProfile\temp\wscache\pmrEAR\pmrEJB.jar\module\com\company\entity\Customer.java:16: cannot find symbol
symbol : class MapsId
location: class com.company.entity.Customer
@MapsId(value="assessmentId")
^
1 error

Resolving The Problem

The following JVM Custom Property can be added to the application server to ensure the jar holding the MapsId class is on wsgen's classpath:

Name: com.ibm.websphere.webservices.WSDL_Generation_Extra_ClassPath


Value: <WSAS_HOME>\feature_packs\jpa\plugins\javax.j2ee.persistence.jar

Where <WSAS_HOME> is the WebSphere installation directory.

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Web Services (for example: SOAP or UDDI or WSGW or WSIF)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21672040