在was7.0上已经配置好了jms 的连接工厂和队列,我想用java进行连接.我在Contex ctx = new InitialContext(env);时一直报错.
其中env为Properties env = new Properties(); env.put(facxxx,""),总共放了三个值,这个应该没问题,有没有达人愿意贴一段样例代码参考一下,非常感谢.
------解决方案--------------------
IBM有自己的J9VM虚拟机
你java代码执行时候用的JDK肯定是SUN的,所以有问题
------解决方案--------------------
你是在客户端跑的还是在container下面跑的?
------解决方案--------------------
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(Context.PROVIDER_URL, "iiop://10.39.105.99:2809");
props.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
Context context = new InitialContext(props);
QueueConnectionFactory qcf = (QueueConnectionFactory)context.lookup("jms/qcf/CE.EE.Send.QCF");
Queue queue = (Queue)context.lookup("jms/q/CE.EE.Request.Q");
QueueConnection connection = qcf.createQueueConnection();
QueueSession session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);
TextMessage msg = session.createTextMessage();
msg.setText("hello , jason");
sender.send(msg);
session.close();
connection.close();
}
------解决方案--------------------
你用我给的例子试试看呢?我的是经过实践过的。
