Home > WebLogic > java.lang.ClassCastException: Cannot cast weblogic.wsee.jaxws.framework.policy.WSDLParserExtension

java.lang.ClassCastException: Cannot cast weblogic.wsee.jaxws.framework.policy.WSDLParserExtension

I was working on to clone a web application running on Weblogic 12.1.1. Objective was to create a new DEV instance for already a working UAT instance.

I installed the Weblogic 12.1.1 on Oracle Linux 5.11 and installation completed successfully including the domain configuration.

Later on when I started deploying the application (WAR file), I got an error in the Weblogic log despite application deployment showing ‘success’. Below is the error I got in the log.

Caused By: com.sun.xml.ws.server.ServerRtException: exception during WSDL parsing: file:/u01/fmw/oracle/product/12/user_projects/domains/mydomain/servers/ManagedServer_1/tmp/_WL_user/vertex-remote-services/hkmfe6/war/WEB-INF/wsdl/VertexIncSystemUserPreferenceService_6_0.wsdl
        at com.sun.xml.ws.server.EndpointFactory.getWSDLPort(EndpointFactory.java:532)
        at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:175)
        at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
        at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253)
        at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)
        Truncated. see log file for complete stacktrace
Caused By: com.sun.xml.ws.util.ServiceConfigurationError: com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension: Provider weblogic.wsee.jaxws.framework.policy.WSDLParserExtension is specified in jar:file:/u01/fmw/oracle/product/12/oracle_common/modules/com.oracle.webservices.wls.wls-ws-metainf-services-impl_12.1.3.jar!/META-INF/services/com.sun.xml.ws.api.wsdl.parser.WSDLParserExtensionbut could not be instantiated: <strong>java.lang.ClassCastException: Cannot cast weblogic.wsee.jaxws.framework.policy.WSDLParserExtension</strong> to com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension
        at com.sun.xml.ws.util.ServiceFinder.fail(ServiceFinder.java:233)
        at com.sun.xml.ws.util.ServiceFinder.access$300(ServiceFinder.java:141)
        at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:379)
        at com.sun.xml.ws.util.ServiceFinder.toArray(ServiceFinder.java:225)
        at com.sun.xml.ws.server.EndpointFactory.getWSDLPort(EndpointFactory.java:510)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassCastException: Cannot cast weblogic.wsee.jaxws.framework.policy.WSDLParserExtension to com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension

To troubleshoot, first tried to see what is defined under “container description” inside ‘weblogic.xml’ file of the application. This file is located in WEB-INF directory of the WAR file and it is already set to TRUE


Now after further investigation and going through some other forums, I was clear with the error that it is due to the conflict of application related classes with that of system classes (Weblogic owned libraries of class)
I looked into the list of all Weblogic(system) classes. Location of the file is $MW_HOME/wlserver_12.1/server/lib/weblogic.jar.
Extracted the weblogic.jar into a temp location (jar -xvf weblogic.jar) and once the jar file is extracted, related system class files are located in /META-INF/services and prepared the list of all the class files.

Extracted the application WAR file and traversed to the location of class files (in my case it is – /temp/vertex-remote-services/WEB-INF/lib)
created a small shell script – idea was to look for each class files which are present in weblogic.jar (System class files) see find if it is there in application WAR file as well.

#! /usr/bin/ksh
_jarfile="jarlist.txt" ### Contains the list of system class files obtained above
while read _list;do
for i in *.jar; do jar -tvf "$i" | grep -Hsi ""${_list}"" && echo "$i"; done
done < $_jarfile

Whatever files found in both the places, corresponding class file is removed from weblogic.jar. This will avoid the conflict and hence the error.
Go to weblogic.jar location ($MW_HOME/wlserver_12.1/server/lib/weblogic.jar) and run below command

$ zip -d weblogic.jar META-INF/services/com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension
deleting: META-INF/services/com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension

This way removed all the conflicting class file from the system CLASS libraries. Stopped and started the managed server and deployed the application. This completed successfully and all the “ClassCastException” were gone.

P.s- I was getting similar errors even with WebLogic 12.1.3 and did the same for 12.1.3 as well to get rid of all the errors.

-Happy learning

Categories: WebLogic Tags:
  1. mohit
    December 11, 2017 at 1:17 am

    Hello Anand.
    This looks like a nice idea, and it works. However, I am worried if this voids the warranty of weblogic server as in this case we are modifying jars provided by them.

    Can you suggest if we can still do the same in case weblogic is under support?

    • February 23, 2018 at 4:59 pm

      Sorry for being late and not sure if you still needed my opinion but I don’t see any reason of not doing it. Mine is also under Oracle warranty and still everything Ok.
      Hence in my opinion, there is nothing wrong. Keep the backup of the modified jar file.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: