600分,关于Sun Application Server的jms访问! 其实我的需求很简单,就是怎么通过jms client远程访问sun message queue? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 一般需要put进Context.INITIAL_CONTEXT_FACTORY和Context.PROVIDER_URL属性就可以了你上面列举的几个Context.INITIAL_CONTEXT_FACTORY类名,你先要确定你的lib库中是否有这个类.还有Context.PROVIDER_URL里面端口也需要确定那个端口是否打开.具体Sun Application Server用那个类,先要确定你的JMS server是用那个产品的.是Sun Application Server自带的? 楼上的兄弟,我测试了不行啊!倒是下面这样写是可以的: String host = "10.167.16.201"; //server machine IP String port = "3700"; //port System.setProperty("org.omg.CORBA.ORBInitialHost", host); System.setProperty("org.omg.CORBA.ORBInitialPort", port); ctx = new InitialContext();哪位高手能不能详细的讲解一下它们的区别? Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory"); prop.put(Context.PROVIDER_URL,"iiop://localhost:7676"); JndiTemplate jndi = new JndiTemplate(prop); QueueConnectionFactory fabrika = (QueueConnectionFactory) jndi.lookup("qcf"); 哦,理论上是应该可以的,因为我以前用这种方式连过Jboss自带的jms,也连过IBM的MQ.帮楼主顶! To c366oem(zoey) :我用的就是Sun Application Server自带的message queue,但我是在Sun Application Server中配置的ConnectionFactory等。本来我是单独安装了sun message queue,但它的example都是本地测试的,我不知道怎么远程测试(远程测试需要jndi server),所以就干脆用Sun Application Server自带的sun message queue to c366oem(zoey) :你上面的写的localhost,而且RefFSContextFactory是文件系统的,好象还需要指定一个目录。如果在另外一台机器运行jms client,肯定是不行了。 各位高手,请教2个问题:1:远程的jms client怎么通过SSL进行访问sun message queue?2:大家一般都是怎么集群的? com.sun.messaging.QueueConnectionFactory 类的方法setProperty("imqAddressList","10.0.65.11:7676,10.0.65.11:7777");1、这个是直接通过com.sun.messaging.QueueConnectionFactory 创建连接--这个很简单2、也可以采用 com.sun.jndi.fscontext.RefFSContextFactory 文件系统环境工厂来配置一个连接到messagequeue 的环境。然后通过Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory"); prop.put(Context.PROVIDER_URL,"file:///c:/mytest"); 再用jndi 来获取messagequeue Server上面的 QueueConnectionFactory对象然后通过QueueConnectionFactory 对象来创建连接如何初始化一个绑定的对象文件上下文环境系统呢?可以通过sun messagequeue 自带的可执行文件,可以生成这个文件系统环境上下文c:/mytest 单个 setProperty("imqAddressList","10.0.65.11:7676"); 其实,你的这些问题,我相信在这里的文档都能告诉你:http://docs.sun.com/app/docs/prod/s1msgqu?l=zh#hic Sun产品系列命名太怪了,好多版本,而且一个产品又包含若干个产品。 csrcom(泥鳅)兄,你好!你说的用com.sun.jndi.fscontext.RefFSContextFactory 文件系统环境工厂来配置一个连接到messagequeue 的环境,再用jndi 来获取messagequeue Server上面的 QueueConnectionFactory对象。请教,这种方式能远程通过jndi来获取QueueConnectionFactory吗? 首先你要在server端 创建一个 QueueConnectionFactory (用imqobjmgr 工具,只要安装了message queue 就有了)。相关这方面的demo: MessageQueue安装路径下面\demo\imqobjmgr csrcom(泥鳅)兄:我是用imqadmin进行了配置,参考http://docs.sun.com/source/819-3561/quick-start.html做的,在本机测试是可以的,但远程就不行。正如上面你写的prop.put(Context.PROVIDER_URL,"file:///c:/mytest"); 这个PROVIDER_URL都指向本地的文件系统,怎么可能支持远程jms client? csrcom(泥鳅)兄:本来我是单独的只安装了sun message queue,但好象要远程的发消息的话,必须要再安装一个jndi server(如:openldap之类的)。是这样的吗?难道sun message queue本身没有jndi服务吗?难道不支持远程发消息吗?我不知道怎么做,请csrcom(泥鳅)兄不吝指教,谢谢! 所以我干脆就用Sun Application Server,因为Sun Application Server自带了sun message queue,而且我目前就是通过以下方式来远程发消息的: String host = "10.167.16.201"; //server machine IP String port = "3700"; //port System.setProperty("org.omg.CORBA.ORBInitialHost", host); System.setProperty("org.omg.CORBA.ORBInitialPort", port); ctx = new InitialContext();不知道csrcom(泥鳅)兄是怎么做的? 1.使用JNDI查询 我们以在SUN Java System Application Server 8.1中添加工厂对象为例,将QueueConnectionFactory 对象绑定到jndi tree,并在属性编辑列表中添加属性“AddressList”,其值为 “mq://localhost:7676/, mq://localhost:7686/”. 2.直接实例化工厂对象 import com.sun.messaging.*;myQConnFactory = new com.sun.messaging.QueueConnectionFactory();myQConnFactory.setProperty(ConnectionConfiguration.imqAddressList, "localhost:7676,localhost:7686");myQConnFactory.setProperty(ConnectionConfiguration.imqAddressListBehavior, "RANDOM"); 编译运行时,将imqlibjms.jar, imqlibimq.jar 加入到classpath。 csrcom(泥鳅)兄:请继续到下面的链接指导吧,先谢谢了! http://community.csdn.net/Expert/topic/4854/4854621.xml?temp=.1131555本贴就快要揭贴了,各位高手继续指导啊! web前端 primefaces applet如何调用EJB? jsf 的初级问题 求教 WEBWORK中 如何实现 action中set方法的替代 JBuilder + Bea Weblogic 对于用EJB的企业级程序的开发,用Appache tomcat作为服务器能否胜任 B/S的企业级应用需要保存很多图片,用什么方式保存比较好? JAVA 怎么实现邮件加密 开放OA源码! struts2 生成验证码刷新总是出现警告 webwork2如何取得系统或浏览器的语言信息? 请高手帮我看下数据库哪里出了问题,在线等 ... ... (本人没分了请不要见怪)
你上面列举的几个Context.INITIAL_CONTEXT_FACTORY类名,你先要确定你的lib库中是否有这个类.还有Context.PROVIDER_URL里面端口也需要确定那个端口是否打开.具体Sun Application Server用那个类,先要确定你的JMS server是用那个产品的.是Sun Application Server自带的?
String host = "10.167.16.201"; //server machine IP
String port = "3700"; //port
System.setProperty("org.omg.CORBA.ORBInitialHost", host);
System.setProperty("org.omg.CORBA.ORBInitialPort", port);
ctx = new InitialContext();哪位高手能不能详细的讲解一下它们的区别?
prop.put(Context.PROVIDER_URL,"iiop://localhost:7676"); JndiTemplate jndi = new JndiTemplate(prop);
QueueConnectionFactory fabrika = (QueueConnectionFactory) jndi.lookup("qcf");
帮楼主顶!
本来我是单独安装了sun message queue,但它的example都是本地测试的,我不知道怎么远程测试(远程测试需要jndi server),所以就干脆用Sun Application Server自带的sun message queue
setProperty("imqAddressList","10.0.65.11:7676,10.0.65.11:7777");1、这个是直接通过com.sun.messaging.QueueConnectionFactory 创建连接--这个很简单2、也可以采用 com.sun.jndi.fscontext.RefFSContextFactory 文件系统环境工厂来配置一个连接到messagequeue 的环境。然后通过Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
prop.put(Context.PROVIDER_URL,"file:///c:/mytest"); 再用jndi 来获取messagequeue Server上面的 QueueConnectionFactory对象然后通过QueueConnectionFactory 对象来创建连接如何初始化一个绑定的对象文件上下文环境系统呢?
可以通过sun messagequeue 自带的可执行文件,可以生成这个文件系统环境上下文
c:/mytest
http://docs.sun.com/app/docs/prod/s1msgqu?l=zh#hic
我是用imqadmin进行了配置,参考http://docs.sun.com/source/819-3561/quick-start.html做的,在本机测试是可以的,但远程就不行。正如上面你写的prop.put(Context.PROVIDER_URL,"file:///c:/mytest"); 这个PROVIDER_URL都指向本地的文件系统,怎么可能支持远程jms client?
String port = "3700"; //port
System.setProperty("org.omg.CORBA.ORBInitialHost", host);
System.setProperty("org.omg.CORBA.ORBInitialPort", port);
ctx = new InitialContext();不知道csrcom(泥鳅)兄是怎么做的?
我们以在SUN Java System Application Server 8.1中添加工厂对象为例,将QueueConnectionFactory 对象绑定到jndi tree,并在属性编辑列表中添加属性“AddressList”,其值为 “mq://localhost:7676/, mq://localhost:7686/”.
2.直接实例化工厂对象
import com.sun.messaging.*;
myQConnFactory = new com.sun.messaging.QueueConnectionFactory();
myQConnFactory.setProperty(ConnectionConfiguration.imqAddressList, "localhost:7676,localhost:7686");
myQConnFactory.setProperty(ConnectionConfiguration.imqAddressListBehavior, "RANDOM");
编译运行时,将imqlibjms.jar, imqlibimq.jar 加入到classpath。