You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ingo Adler <de...@synacon.ch> on 2010/06/04 00:52:00 UTC

strange ClassCastException in wicketstuff-push

Hi,

I'm trying to use wicketstuff-push in my project. I'm always getting a
ClassCastException in the wicketstuff-push sources, which I can't explain:

java.lang.ClassCastException:
org.mortbay.cometd.continuation.ContinuationBayeux cannot be cast to
org.cometd.Bayeux
     at
org.wicketstuff.push.cometd.CometdService.initBayeux(CometdService.java:172)
     at
org.wicketstuff.push.cometd.CometdService.getBayeux(CometdService.java:161)
     at
org.wicketstuff.push.cometd.CometdService.publish(CometdService.java:155)
     at org.xtoto.ui.comment.CommentPanel$3.onSubmit(CommentPanel.java:140)

My code is very similar to the example:

final ChannelEvent event = new ChannelEvent("chat");
event.addData("message", comment.getMessage());
getChannelService().publish(event); // -> Line 140 in CommentPanel

I'm using the trunk of wicketstuff. The org.wicketstuff.push code
compiled perfectly.

I tried different library versions - which didn't help.

Currently I'm using

cometd-api-1.1.1
cometd-client-6.1.22
cometd-server-6.1.22

jetty-6.1.22

wicket-1.4.7

When I change the code in push a little bit, from

_bayeux = (Bayeux) _application
	.getServletContext()
	.getAttribute(Bayeux.ATTRIBUTE); // -> line 172 in CometdService

to

ContinuationBayeux b = (ContinuationBayeux)_application
	.getServletContext()
	.getAttribute(Bayeux.ATTRIBUTE);

_bayeux = b;

I get a IncompatibleClassChangeError later in line:

serviceClient = _bayeux.newClient(BAYEUX_CLIENT_PREFIX);



Very strange...

Has anyone had this problem before? Any ideas?

Regards
Ingo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: strange ClassCastException in wicketstuff-push

Posted by Ingo Adler <de...@synacon.ch>.
Solved.

It was a class loading problem - IntelliJ in combination with Jetty.

WebAppContext context = new WebAppContext();
...
context.setParentLoaderPriority(true); // -> Solution

Ingo

On 04.06.2010 00:52, Ingo Adler wrote:
> Hi,
> 
> I'm trying to use wicketstuff-push in my project. I'm always getting a
> ClassCastException in the wicketstuff-push sources, which I can't explain:
> 
> java.lang.ClassCastException:
> org.mortbay.cometd.continuation.ContinuationBayeux cannot be cast to
> org.cometd.Bayeux
>      at
> org.wicketstuff.push.cometd.CometdService.initBayeux(CometdService.java:172)
>      at
> org.wicketstuff.push.cometd.CometdService.getBayeux(CometdService.java:161)
>      at
> org.wicketstuff.push.cometd.CometdService.publish(CometdService.java:155)
>      at org.xtoto.ui.comment.CommentPanel$3.onSubmit(CommentPanel.java:140)
> 
> My code is very similar to the example:
> 
> final ChannelEvent event = new ChannelEvent("chat");
> event.addData("message", comment.getMessage());
> getChannelService().publish(event); // -> Line 140 in CommentPanel
> 
> I'm using the trunk of wicketstuff. The org.wicketstuff.push code
> compiled perfectly.
> 
> I tried different library versions - which didn't help.
> 
> Currently I'm using
> 
> cometd-api-1.1.1
> cometd-client-6.1.22
> cometd-server-6.1.22
> 
> jetty-6.1.22
> 
> wicket-1.4.7
> 
> When I change the code in push a little bit, from
> 
> _bayeux = (Bayeux) _application
> 	.getServletContext()
> 	.getAttribute(Bayeux.ATTRIBUTE); // -> line 172 in CometdService
> 
> to
> 
> ContinuationBayeux b = (ContinuationBayeux)_application
> 	.getServletContext()
> 	.getAttribute(Bayeux.ATTRIBUTE);
> 
> _bayeux = b;
> 
> I get a IncompatibleClassChangeError later in line:
> 
> serviceClient = _bayeux.newClient(BAYEUX_CLIENT_PREFIX);
> 
> 
> 
> Very strange...
> 
> Has anyone had this problem before? Any ideas?
> 
> Regards
> Ingo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org