Bug 780361 - (SOA-2770) java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedTypes (security_saml QS deployed in CXF)
java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.ref...
Status: CLOSED NEXTRELEASE
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: JBossESB, Security, Examples (Show other bugs)
5.1.0.ER6
Unspecified Unspecified
urgent Severity urgent
: ---
: 5.1.0.ER8
Assigned To: Kevin Conner
http://jira.jboss.org/jira/browse/SOA...
: Regression, TestBlocker
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-13 12:12 EST by Martin Vecera
Modified: 2011-03-07 21:30 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
production config., CXF installed
Last Closed: 2011-03-07 21:30:48 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
security_saml.zip (4.76 KB, application/zip)
2011-01-14 14:35 EST, Kevin Conner
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker SOA-2770 None Closed java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedTypes (security_saml QS d... 2012-03-16 10:01:11 EDT

  None (edit)
Description Martin Vecera 2011-01-13 12:12:16 EST
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 12:21:53 EST
Affects Testing: Removed: [Regression] Added: [Regression, Blocks Testing]
Comment 2 Kevin Conner 2011-01-14 05:32:49 EST
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 06:14:55 EST
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 06:33:31 EST
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 08:45:55 EST
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 09:19:24 EST
Will add a workaround for this specific deployment.
Comment 7 Martin Vecera 2011-01-14 11:11:54 EST
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 11:22:27 EST
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 14:32:28 EST
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 14:35:12 EST
Update to quickstart to fix picketlink-sts.war
Comment 11 Kevin Conner 2011-01-14 14:35:12 EST
Attachment: Added: security_saml.zip
Comment 12 Kevin Conner 2011-01-14 14:38:04 EST
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 14:43:05 EST
Link: Added: This issue depends JBESB-3560
Comment 14 Kevin Conner 2011-01-14 14:45:03 EST
Updated in ESB codebase, will be in next merge.
Comment 15 Martin Vecera 2011-01-27 09:55:05 EST
Verified with 5.1.0 ER8
Comment 16 Darrin Mison 2011-02-17 02:45:14 EST
Release Notes Docs Status: Added: Not Required
Comment 17 David Le Sage 2011-03-07 21:24:55 EST
Temporarily reopening to update release note info.
Comment 18 David Le Sage 2011-03-07 21:30:23 EST
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.

Note You need to log in before you can comment on or make changes to this bug.