Hi, Sergey
Here is the method signature:
@POST
@Transactional
@Path("/testPath")
Response createHelloWorld(TestDto testDto);
Here is the implementation:
@Override
public Response createHelloWorld(TestDto testDto)
{
if(true) { throw new RuntimeException("test createHelloWorld"); }
return Response.ok().build();
}
The stack looks as follows:
java.lang.ClassCastException: java.lang.Class cannot be cast to
javax.ws.rs.core.Response
at
endpoint.HelloWorldEndpointImpl$$EnhancerByCGLIB$$47ebfd41.createHelloWorld(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy167.createHelloWorld(Unknown Source)
at
endpoint.it.HelloWorldEndpointIT.testCreateHelloWorld(HelloWorldEndpointIT.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233)
at
org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at
org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:241)
at
org.codehaus.mojo.failsafe.IntegrationTestMojo.execute(IntegrationTestMojo.java:555)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Here is the list of cxf dependencies used:
C:\U\i\cw\L-6\o\project> mvn dependency:tree | grep -i cxf
[INFO] | | \- org.apache.cxf:cxf-bundle:jar:2.2.5:compile
[INFO] | +- org.apache.cxf:cxf-api:jar:2.2.5:compile
[INFO] | | \- org.apache.cxf:cxf-common-schemas:jar:2.2.5:compile
[INFO] | +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.2.5:compile
[INFO] | | +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.2.5:compile
[INFO] | | | +- org.apache.cxf:cxf-tools-common:jar:2.2.5:compile
[INFO] | | | \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.2.5:compile
[INFO] | | +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.2.5:compile
[INFO] | | +- org.apache.cxf:cxf-rt-ws-addr:jar:2.2.5:compile
[INFO] | +- org.apache.cxf:cxf-rt-transports-http:jar:2.2.5:compile
[INFO] | +- org.apache.cxf:cxf-rt-ws-security:jar:2.2.5:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.2.3:compile
[INFO] | +- org.apache.cxf:cxf-common-utilities:jar:2.2.3:compile
[INFO] | +- org.apache.cxf:cxf-rt-core:jar:2.2.3:compile
[INFO] | +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.2.3:compile
[INFO] | +- org.apache.cxf:cxf-rt-databinding-aegis:jar:2.2.3:compile
Also, let me mention that no jaxrs:providers are registered for jaxrs:server
Sergey Beryozkin-5 wrote:
>
> What is the signature of the method in "endpoint.HelloWorldEndpointImpl"
> which is being tested ?
> How does the stack trace look like and what CXF version you're using ?
> cheers, Sergey
>
--
View this message in context:
http://old.nabble.com/ClassCastException-prevents-thorough-endpoint-testing-tp28719118p28730939.html
Sent from the cxf-user mailing list archive at Nabble.com.