Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException JerseyWebTarget #50

Open
JKlasser opened this issue Jan 16, 2019 · 0 comments
Open

ClassCastException JerseyWebTarget #50

JKlasser opened this issue Jan 16, 2019 · 0 comments

Comments

@JKlasser
Copy link

Bug report / Enhancement

Please follow template provided below

Issue Overview

ClassCastException appears using Jersey included in Payara embedded and the Arquillian REST Extension. The Fix should be easy. In Line 28 of org.jboss.arquillian.extension.rest.client.RestEnricher

remove the cast and change to (maybe also the variable name)

WebTarget jerseyWebTarget = webTarget;

Expected Behaviour

No ClassCastException

Current Behaviour

ClassCastException

Steps To Reproduce
  1. Create a maven project with

     <dependency>
     	<groupId>fish.payara.extras</groupId>
     	<artifactId>payara-embedded-all</artifactId>
     	<version>5.182</version>
     	<scope>test</scope>
     </dependency>
     <dependency>
     	<groupId>org.jboss.arquillian.container</groupId>
     	<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
     	<version>1.0.2</version>
     	<scope>test</scope> 
     </dependency>
     <dependency>
     	<groupId>org.jboss.arquillian.extension</groupId>
     	<artifactId>arquillian-rest-client-impl-jersey</artifactId>
     	<version>1.0.0.Alpha4</version>
     	<scope>test</scope> 
     </dependency>
    
  2. Create an Arquillian test with @ArquillianResteasyResource

  3. Run Test

Additional Information
java.lang.ClassCastException: fish.payara.requesttracing.jaxrs.client.decorators.JaxrsWebTargetDecorator cannot be cast to org.glassfish.jersey.client.JerseyWebTarget at org.jboss.arquillian.extension.rest.client.RestEnricher.enrichByType(RestEnricher.java:28) at org.jboss.arquillian.extension.rest.client.BaseRestEnricher.resolve(BaseRestEnricher.java:74) at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.enrichArguments(LocalTestExecuter.java:83) at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105) at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:62) at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:50) ... $mvn --version Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00) Maven home: C:\maven\bin\.. Java version: 1.8.0_161, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_161\jre Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant