Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

null pointer exception

951645Jul 28 2012 — edited Aug 27 2012
hi everybody

i want to make a durable subscriber jms aplication and i have make a test program to see if all is fine
but when i publish the event i get a nullpointerexception i don' t understand why ?

public class TestAgendaDurable extends junit.framework.TestCase{


private SynchronousQueue<RendezVous> queue1,queue2,queue3;

public void test_souscripteur_durable(){
Souscription s1=null,s2=null,s3=null;
PriseDeRDV priseDeRDV=null;
queue1 = new SynchronousQueue<RendezVous>();
try{

priseDeRDV = new PriseDeRDV("agenda_tests");
RendezVous r1 = new RendezVous(new Date(40000L),"test");
if (priseDeRDV != null && r1 != null)
{
priseDeRDV.publier(r1); <========================= here i get a nullpointerexception
}

// System.out.println("envoi !!!" + r1);

// s1 = new SouscriptionDurable("agenda_tests","durable3"){
// public void onMessage(Message message){
// try{
// RendezVous rdv = (RendezVous)((ObjectMessage)message).getObject();
// System.out.println("recu !!!" + rdv);
// queue1.put(rdv);
// }catch(Exception e) {
// }
// }
// };

// RendezVous r = queue1.poll(2L, TimeUnit.SECONDS);
// assertNotNull(" le rendezVous n'est pas reçu, en moins de 2 sec ?",r);
// System.out.println("recu !!!" + r);
// assertTrue(" le rendezVous n'est pas le bon ?",r.equals(r1));
}catch(Exception e){
fail("exception inattendue : " + e.getClass().getName()); <=========== the line which provoke the exception i can' t remove
}finally{
try{s1.close();}catch(Exception e){}
try{priseDeRDV.close();}catch(Exception e){}

Edited by: migacti on 28 juil. 2012 08:22

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 24 2012
Added on Jul 28 2012
11 comments
5,012 views