hi all,
i have prob in running client prog. i hve written a message driven bean which is deployed sucessfully on server(Websphere).
when running client prog i get the foll error msg:
Getting InitialContext...
about to retrieve initial context.
url provided..{java.naming.provider.url=iiop:127.0.0.1:9090}
Wsn class found..
initial context has been created.javax.naming.InitialContext@4fb549
Looking up for connection factory..
Unable to lookup jndi name..javax.naming.NamingException: Failed to initialize t
he ORB [Root exception is java.lang.reflect.InvocationTargetException]
Excep..java.lang.NullPointerException
my client prog is:
package beans.message;
import javax.jms.*;
import javax.naming.*;
import java.util.Properties;
public class SampleMsgClient
{
public static void main(
String args[])
{
InitialContext ctx=null;
TopicConnectionFactory conFactory=null;
TopicConnection con=null;
Topic topic=null;
TopicSession session=null;
TopicPublisher publisher=null;
TextMessage txtMsg=null;
Properties p = null;
final int NUM_MSGS=3;
try
{
System.out.println("Getting InitialContext...");
ctx= getInitialContext();
System.out.println("initial context has been created."+ctx);
p=new Properties();
System.out.println("Looking up for connection factory..");
conFactory=(TopicConnectionFactory) ctx.lookup("jms/MyConnectionFactory");
System.out.println("Lookup sucessfull for Topic Connection Factory..");
topic=(Topic) ctx.lookup("jms/MyTopicname");
System.out.println("Lookup for Topic jndi successfull..");
}catch(NamingException exe)
{
System.out.println("Unable to lookup jndi name.."+exe);
}catch(Exception mExe)
{
System.out.println("Exception in main.."+mExe);
}
try
{
con= conFactory.createTopicConnection();
con.start();
System.out.println("Topic Connection started....");
session=con.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
publisher= session.createPublisher(topic);
txtMsg = session.createTextMessage();
System.out.println("Created Text Message....");
//tm.setText("this is a sample
test message"
for(int i=0;i<NUM_MSGS;i++)
{
txtMsg.setText("This is message...." + (i+1));
System.out.println("Sending message....." + txtMsg.getText());
}//for
publisher.publish(txtMsg);
System.out.println("Publishing Message....");
}catch(Exception exe)
{
System.out.println("Excep.."+exe);
}
finally
{
try
{
if(con!=null)
{
con.close();
}
}catch(JMSException jExe)
{
System.out.println("Unable to close connection.....");
}
}
}//main
public static InitialContext getInitialContext() throws NamingException
{
Properties p = new Properties();
try
{
System.out.println("about to retrieve initial context.");
p.put(Context.PROVIDER_URL, "iiop:127.0.0.1:9090");
System.out.println("url provided.."+p);
p.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
System.out.println("Wsn class found..");
return new InitialContext(p);
}
catch (Exception e)
{
System.out.println("Exception in getInitialContext.."+e);
e.printStackTrace();
return null;
}
}
}//class
plz help.
thanks