IBM Support

java.lang.NoClassDefFoundError when generating the WSDL after fixpack or WSAS version upgrade

Troubleshooting


Problem

After upgrading the fixpack version in WSAS7, WSAS8, and WSAS 8.5, you will get an error similar to the following when the WSDL is generated: WASWSDLGenera E WSWS7054E: The Web Services Description Language (WSDL) file could not be generated for the com.wwwwww.xxxxx.yyyyyyy.zzzzzzz Web service implementation class because of the following error: java.lang.NoClassDefFoundError: com.aaaaaa.bbbbbb.ccccccc.dddddd.eeeeeee 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.wwwwww.xxxxx.yyyyyyy.zzzzzzz Web service implementation class because of the following error: java.lang.NoClassDefFoundError: com.aaaaaa.bbbbbb.ccccccc.dddddd.eeeeeee at com.ibm.ws.websvcs.wsdl.WASWSDLGenerator.generateWsdl(WASWSDLGenerator.java:238) at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.generateWSDL(EndpointDescriptionImpl.java:2084) at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.(EndpointDescriptionImpl.java:434) at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.(ServiceDescriptionImpl.java:401) at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.(ServiceDescriptionImpl.java:297) at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescriptionFromDBCMap(DescriptionFactoryImpl.java:273) at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescriptionFromDBCMap(DescriptionFactory.java:524) ... Caused by: java.lang.NoClassDefFoundError: com.aaaaaa.bbbbbb.ccccccc.dddddd.eeeeeee ... Caused by: java.lang.ClassNotFoundException: com.aaaaaa.bbbbbb.ccccccc.dddddd.eeeeeee at java.net.URLClassLoader.findClass(URLClassLoader.java:434) at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:703) at java.lang.ClassLoader.loadClass(ClassLoader.java:682) at java.lang.ClassLoader.loadClass(ClassLoader.java:665) ... 32 more

Symptom

Applications that were previously able to generate the wsdl successfully in lower fixpack levels and WSAS versions are now getting a java.lang.NoClassDefFoundError.

Cause

The difference in behavior is due to a change introduced with JDK APAR IV34135.

Prior to the change, reflective methods such as getDeclaredConstructors() did not necessarily verify the receiver class (i.e. the class on which getDeclaredConstructors() is called). After the change, the implementation of the following methods was changed to verify/prepare the class first:

getConstructor()
getConstructors()
getDeclaredConstructors()
getDeclaredConstructor()
getDeclaredField()
getDeclaredFields()
getDeclaredMethod()
getDeclaredMethods()
getField()
getFields()
getMethod()
getMethods()

When the receiver class is verified, it may result in additional classes being loaded - i.e. classes referenced by the implementation of the receiver class.

The changes were introduced to ensure continued compliance with JCK standards and are in line with behavior of the reference language implementation.

The fix was included in SDK level:

7.0.0 SR4
6.0.1 SR5
6.0.0 SR13


Link to APAR IV34135 is below:

"IV34135: OBJECTCOLLECTEDEXCEPTION WHEN RUNNING GREENFOOT APPLICATION"
http://www.ibm.com/support/docview.wss?uid=swg1IV34135

Environment

WSAS 7.0.0.29 and higher fixpack versions
WSAS 8.0.0.6 and higher fixpack versions
WSAS 8.5.0.2 and higher fixpack versions
WSAS 8.5.5.0 and higher fixpack versions

Diagnosing The Problem

The SystemOut.log file will contain the errors above after server startup.

Resolving The Problem

There are 3 options to resolve the issue:

1. The best practice is to include the WSDL file with the application under the WEB-INF folder. Also, the application would need to be modified to access the WSDL from this location. This can be done by using the @WebService.wsdlLocation attribute. More information about this can be found at the link below:

WebSphere Application Server (WSAS) Information Center, "Exposing methods in SEI-based JAX-WS Web services"
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-nd-dist&topic=twbs_devjaxws_exposewebmethod


The link states:
'Provide a reference to a WSDL file in the @WebService.wsdlLocation attribute. By specifying a pre-defined WSDL file, performance is improved. Additionally, any discrepancies between the WSDL file and the annotations are reported to you by the runtime environment.'


2. Set the application server JVM custom property: com.ibm.websphere.webservices.WSDL_Generation_Extra_ClassPath

This property should be used to specify the fully qualified location of the missing classes that are mentioned in the error. You can only specify the fully qualified paths to multiple Java archives (JAR) and separate them using a semicolon (;). If WSAS is on AIX, Linux, or Unix, you would want to use a colon (:) instead of a semicolon.

Example
eg: D:\libs\WSBean1.jar;D:\libs\WSBean2.jar


To set the property:
a. Click Servers > Server Types, and either WebSphere application servers > 'server_name' or WebSphere proxy servers > 'server_name'. Then, under Server Infrastructure, click Java and process management > Process definition > Java virtual machine > Custom properties.
b. Create a new property using com.ibm.websphere.webservices.WSDL_Generation_Extra_ClassPath as the name and the fully qualified location as the value.
c. Save the new configuration and restart the server.


This property must be set on all application servers where you see this error. More information on this property can be found at the following link:

WebSphere Application Server (WSAS) Information Center, "Java virtual machine custom properties"
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-dist&topic=xrun_jvm


3. Remove any reference to the class from the application.

[{"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":"8.5.5.1;8.5.5;8.5.0.2;8.0.0.8;8.0.0.7;8.0.0.6;7.0.0.31;7.0.0.29","Edition":"Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21667356