Class Cast Exception

<[email protected]> Tue, 27 Sep 2005 13:22:24 +0100
Newsgroups gmane.comp.java.jxta.user
Message-ID <4E28CEA517A795438B120F62D182A8C972A23F@I2KM11-UKBR.domain1.systemhost.net>
I am getting a class cast exception generated when I create attempt to
create an Output Pipe.

The problem seems to be the actuall Advert I pass through to it.  If I
use the advert from the PipeExample.adv file the thing works fine.  But
if I use the following:

myAdv =
(PipeAdvertisementAdvertisementFactory.newAdvertisement(PipeAdvertisemen
t.getAdvertisementType());
	        	
myAdv.setPipeID(IDFactory.newPeerID(peerNet.getPeerGroupID()));
myAdv.setName(From.getClass().getName());
myAdv.setType(PipeService.UnicastType);
discovery.publish(myAdv,DiscoveryService.ADV,PeerGroup.DEFAULT_LIFETIME,
PeerGroup.DEFAULT_EXPIRATION);
discovery.remotePublish(myAdv,DiscoveryService.ADV,PeerGroup.DEFAULT_EXP
IRATION);

I get the exception.  It comes from inside the CreateOutputPipe call.  I
have printed out both Adverts and they appear in XML form to be the
same.  So I am completely puzzled as the type of myAdv is the same in
both cases.


Martin Roberts