Re: Class Cast Exception

Mohamed Abdelaziz <[email protected]> Wed, 28 Sep 2005 10:04:10 -0700
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
Any reason for using a peerid for a pipeid?

myAdv.setPipeID(IDFactory.newPeerID(peerNet.getPeerGroupID()));


Mohamed


[email protected] wrote:
> Stack Trace as from within jUnit.
>
> java.lang.ClassCastException
> 	at
> net.jxta.impl.pipe.PipeServiceImpl.createOutputPipe(PipeServiceImpl.java
> :352)
> 	at
> net.jxta.impl.pipe.PipeServiceInterface.createOutputPipe(PipeServiceInte
> rface.java:237)
> 	at com.bt.bility.JxtaSender.run(JxtaSender.java:166)
> 	at com.bt.bility.JxtaSender.sendMessage(JxtaSender.java:142)
> 	at com.bt.bility.Lift.goingUp(Lift.java:132)
> 	at com.bt.bility.TestJxta.testJxta(TestJxta.java:80)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
> stRunner.java:478)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
> ner.java:344)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
> nner.java:196) 
>
>
> Martin Roberts
>
>
>
> -----Original Message-----
> From: Mohamed Abdelaziz [mailto:[email protected]] 
> Sent: 27 September 2005 17:51
> To: [email protected]
> Subject: Re: [JXTA user] Class Cast Exception
>
> Can provide the exception stack trace?
>
> Mohamed
>
>
>
> [email protected] wrote:
>   
>> 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(PipeAdvertisem
>> en
>> t.getAdvertisementType());
>> 	        	
>> myAdv.setPipeID(IDFactory.newPeerID(peerNet.getPeerGroupID()));
>> myAdv.setName(From.getClass().getName());
>> myAdv.setType(PipeService.UnicastType);
>> discovery.publish(myAdv,DiscoveryService.ADV,PeerGroup.DEFAULT_LIFETIM
>> E,
>> PeerGroup.DEFAULT_EXPIRATION);
>> discovery.remotePublish(myAdv,DiscoveryService.ADV,PeerGroup.DEFAULT_E
>> XP
>> 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
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected] For additional 
>> commands, e-mail: [email protected]
>>
>>   
>>