Issue 783 in google-guice: java.lang.ClassCastException: sun.proxy.$Proxy9 cannot be cast to se.example.EnvRequirement

21 views
Skip to first unread message

google...@googlecode.com

unread,
Nov 28, 2013, 5:55:05 AM11/28/13
to google-g...@googlegroups.com
Status: New
Owner: ----

New issue 783 by mikaelpe...@gmail.com: java.lang.ClassCastException:
sun.proxy.$Proxy9 cannot be cast to se.example.EnvRequirement
http://code.google.com/p/google-guice/issues/detail?id=783

Description of the issue:

I am not sure if it is a Guice issue but since I, for some reason, could
not post
in google-guice group ( maybe because I attached a zip file).

Maybe someone could help med shed some light on this issue?

br,

//mike


Steps to reproduce:
1. Run the NewTest ( testng testcase).
2.
3.


java.lang.ClassCastException: sun.proxy.$Proxy9 cannot be cast to
se.example.EnvRequirement
at se.example.MyHandler.handleEnvironment(MyHandler.java:32)
at se.example.MyHandler.check(MyHandler.java:21)
at se.example.MyListener.beforeInvocation(MyListener.java:34)
at
org.testng.internal.invokers.InvokedMethodListenerInvoker$InvokeBeforeInvocationWithoutContextStrategy.callMethod(InvokedMethodListenerInvoker.java:84)
at
org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:62)
at org.testng.internal.Invoker.runInvokedMethodListeners(Invoker.java:619)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:540)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:277)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)


Attachments:
proxy_problem.zip 10.8 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

google...@googlecode.com

unread,
Nov 28, 2013, 7:25:37 AM11/28/13
to google-g...@googlegroups.com
Updates:
Status: Invalid

Comment #1 on issue 783 by mccu...@gmail.com: java.lang.ClassCastException:
sun.proxy.$Proxy9 cannot be cast to se.example.EnvRequirement
http://code.google.com/p/google-guice/issues/detail?id=783

In MyHandler.java you're casting TrxRequirement to EnvRequirement, but
TrxRequirement does not extend EnvRequirement - it is only annotated by it,
so I don't see how this cast could ever succeed. The method being called
(replaceId) then casts it back into TrxRequirement, so this temporary cast
to EnvRequirement appears to have no use.
Reply all
Reply to author
Forward
0 new messages