Bug 780361 (SOA-2770)

Summary: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedTypes (security_saml QS deployed in CXF)
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Martin Vecera <mvecera>
Component: JBossESB, Security, ExamplesAssignee: Kevin Conner <kevin.conner>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.1.0.ER6CC: kevin.conner, mvecera
Target Milestone: ---Keywords: Regression, TestBlocker
Target Release: 5.1.0.ER8   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-2770
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
production config., CXF installed
Last Closed: 2011-03-08 02:30:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
security_saml.zip none

Description Martin Vecera 2011-01-13 17:12:16 UTC
Workaround Description: Subclass webservice implementation and specify interfaces/annotations directly.  e.g. for PicketLinkSTS you would create the following and specify it as the servlet in web.xml

@WebServiceProvider(serviceName="PicketLinkSTS",
  portName="PicketLinkSTSPort",
  targetNamespace="urn:picketlink:identity-federation:sts",
  wsdlLocation="WEB-INF/wsdl/PicketLinkSTS.wsdl")
@ServiceMode(value=Service.Mode.PAYLOAD)
public class PicketLinkSTS extends
    org.picketlink.identity.federation.core.wstrust.PicketLinkSTS implements Provider<Source>
{
}

project_key: SOA

There is an exception while deploying secuirty_saml QS with CXF enabled:
17:59:16,231 ERROR [[/picketlink-sts]] StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PicketLinkSTS': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
...

While trying to run the example, there is another exception being thrown:
17:59:45,470 ERROR [[/picketlink-sts]] StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PicketLinkSTS': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
              ...
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'WEB-INF/wsdl/PicketLinkSTS.wsdl'.: java.io.FileNotFoundException: /qa/home/mvecera/work/soa/510ER6.cxf/jboss-as/bin/WEB-INF/wsdl/PicketLinkSTS.wsdl
	at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2111)
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2303)
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2335)
	at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:232)
	at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
	at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
	... 53 more
Caused by: java.io.FileNotFoundException: /qa/home/mvecera/work/soa/510ER6.cxf/jboss-as/bin/WEB-INF/wsdl/PicketLinkSTS.wsdl
	at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnection.java:105)
	at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:112)
	at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
	at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2101)
	... 58 more

It seems like CXF is trying to locate the WSDL file in a wrong place. The same problem is in our integration test suite making this test unable to verify correct SAML operation.

Comment 1 Martin Vecera 2011-01-13 17:21:53 UTC
Affects Testing: Removed: [Regression] Added: [Regression, Blocks Testing]


Comment 2 Kevin Conner 2011-01-14 10:32:49 UTC
On which machine?  How is it being deployed?

I have just started ER6 and seen a different error

java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperationsForProvider(JaxWsServiceFactoryBean.java:264)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:256)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:424)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:278)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:178)


Comment 3 Martin Vecera 2011-01-14 11:14:55 UTC
Yes, this is the first exception during deployment. Ignore this and try running the example with ant runtest and the other shows up.

Comment 4 Kevin Conner 2011-01-14 11:33:31 UTC
I suspect that the first exception (ClassCastException) is the issue and the second (FileNotFoundException) a consequence of the first failure to parse the WSDL.

Sounds like an issue with CXF integration though, will do some investigation.

Comment 5 Kevin Conner 2011-01-14 13:45:55 UTC
The CXF codebase assumes that the service class (PicketLinkSTS) implements a parameterized interface, presumably javax.xml.ws.Provider.  Unfortunately PicketLinkSTS does not implement this directly, rather it is referenced indirectly through SecurityTokenService.


Comment 6 Kevin Conner 2011-01-14 14:19:24 UTC
Will add a workaround for this specific deployment.

Comment 7 Martin Vecera 2011-01-14 16:11:54 UTC
Please send me that workaround when you have it. I need to fix our tests as well and it would be great to have it before another build. Thanks.

Comment 8 Kevin Conner 2011-01-14 16:22:27 UTC
It looks like these may be separate issues with the CXF integration

working around the first one leads to the following on the console

- java.lang.ClassNotFoundException: org.jboss.soa.esb.picketlink.PicketLinkSTS

This would suggest that this code is not using the context classloader associated with the war to locate the class/resource.  Will investigate further.


Comment 9 Kevin Conner 2011-01-14 19:32:28 UTC
Turned out to be a typo in the build.xml, class was found on deployment but not when runtest was executed subsequently.

Comment 10 Kevin Conner 2011-01-14 19:35:12 UTC
Update to quickstart to fix picketlink-sts.war

Comment 11 Kevin Conner 2011-01-14 19:35:12 UTC
Attachment: Added: security_saml.zip


Comment 12 Kevin Conner 2011-01-14 19:38:04 UTC
Workaround Description: Added: Subclass webservice implementation and specify interfaces/annotations directly.  e.g. for PicketLinkSTS you would create the following and specify it as the servlet in web.xml

@WebServiceProvider(serviceName="PicketLinkSTS",
  portName="PicketLinkSTSPort",
  targetNamespace="urn:picketlink:identity-federation:sts",
  wsdlLocation="WEB-INF/wsdl/PicketLinkSTS.wsdl")
@ServiceMode(value=Service.Mode.PAYLOAD)
public class PicketLinkSTS extends
    org.picketlink.identity.federation.core.wstrust.PicketLinkSTS implements Provider<Source>
{
}



Comment 13 Kevin Conner 2011-01-14 19:43:05 UTC
Link: Added: This issue depends JBESB-3560


Comment 14 Kevin Conner 2011-01-14 19:45:03 UTC
Updated in ESB codebase, will be in next merge.

Comment 15 Martin Vecera 2011-01-27 14:55:05 UTC
Verified with 5.1.0 ER8

Comment 16 Dana Mison 2011-02-17 07:45:14 UTC
Release Notes Docs Status: Added: Not Required


Comment 17 David Le Sage 2011-03-08 02:24:55 UTC
Temporarily reopening to update release note info.

Comment 18 David Le Sage 2011-03-08 02:30:23 UTC
Release Notes Docs Status: Removed: Not Required Added: Documented as Resolved Issue
Writer: Added: dlesage
Release Notes Text: Added: https://issues.jboss.org/browse/SOA-2770

A java.lang.ClassCastException occurred if the user deployed the security_saml quick start with CXF enabled. This was caused by an error in a build file which lead to the class being found on deployment but not on the subsequent run test.  To fix this problem, the picketlink-sts.war file has been updated in the quick start. As a result, the exception no longer occurs.