[jboss-remoting-issues] [JBoss JIRA] (JBREM-552) cannot init cause of ClassCastException
Ron Sigal (Commented) (JIRA)
jira-events at lists.jboss.org
Wed Nov 30 14:29:41 EST 2011
[ https://issues.jboss.org/browse/JBREM-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646842#comment-12646842 ]
Ron Sigal commented on JBREM-552:
---------------------------------
Hi Jens,
Your stacktrace doesn't seem to have anything to do with Remoting.
-Ron
> cannot init cause of ClassCastException
> ---------------------------------------
>
> Key: JBREM-552
> URL: https://issues.jboss.org/browse/JBREM-552
> Project: JBoss Remoting
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 2.0.0.Beta2 (Boon)
> Reporter: John Mazzitelli
> Assignee: Tom Elrod
> Priority: Minor
> Fix For: 2.0.0.CR1 (Boon)
>
>
> I'm in a catch clause within InvokerRegistry and I'm getting a weird exception thrown:
> java.lang.IllegalStateException: Can't overwrite cause
> at java.lang.Throwable.initCause(Throwable.java:320)
> at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:447)
> at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:324)
> at org.jboss.remoting.Client.connect(Client.java:385)
> at org.jboss.on.communications.command.client.JBossRemotingRemoteCommunicator.getRemotingClient(JBossRemotingRemoteCommunicator.java:470)
> at org.jboss.on.communications.command.client.JBossRemotingRemoteCommunicator.send(JBossRemotingRemoteCommunicator.java:430)
> at org.jboss.on.communications.command.client.AbstractCommandClient.invoke(AbstractCommandClient.java:167)
> at org.jboss.on.communications.command.client.ClientCommandSender.send(ClientCommandSender.java:820)
> at org.jboss.on.communications.command.client.ServerPollingThread.run(ServerPollingThread.java:102)
> Look at line 447 and you'll see it is trying to init the cause of a ClassNotFoundException. Running in a debugger, the newly constructed exception created on 446 has a null cause. Looking then at Throwable.initCause and you'll see a null cause causes this IllegalStateException to be thrown. The cause needs to be "this", not null (I don't know why, seems like it should also look for null, but whatever - that's the way the JDK is written).
> The fix is simple - use the constructor that takes a throwable as its second parameter. Not sure why initCause it being used, as opposed to this constructor.
> e.g.:
> new ClassNotFoundException("Can not invoke loadClientInvokerClass method on " + transportFactoryClass, e);
> (notice the ", e" parameter).
> There are three other instances where initCause is called on ClassNotFoundException that also need to be fixed. See the other catch clauses in here.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-remoting-issues
mailing list