x和远程独立客户端

x和远程独立客户端

本文介绍了Glassfish V3.x和远程独立客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

连接到 ActiveMQ 作为独立客户端绝对没有问题。你只需要添加 activemq-all-5.4.1.jar ,然后你就可以...

  ... 
prop.put(Context.SECURITY_AUTHENTICATION,system);
prop.put(Context.SECURITY_CREDENTIALS,manager);
prop.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.activemq.jndi.ActiveMQInitialContextFactory);
prop.put(Context.PROVIDER_URL,tcp:// localhost:61616);
prop.put(connectionFactoryNames,TopicCF);
prop.put(topic.topic1,topic1);

InitialContext ctx = new InitialContext(prop);
...

现在您要连接到 Glassfish V3.x ,并且为了连接而获得正确的库和类似乎是不可能的。尽管在Glassfish V2.x中仍然有可能,但我还没有成功获得与Glassfish相同的上述代码!

  ... 
属性properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,com.sun.appserv.naming.S1ASCtxFactory);
properties.put(Context.PROVIDER_URL,iiop:// localhost:3700);
InitialContext context = new InitialContext(properties)
...

没有人对此有一个答案?不,我不想部署企业应用程序客户端只是为了从Glassfish队列读取数据。这里有类似的线程,但没有任何向导。



感谢您的任何提示

解决方案

连接Glassfish V3时,不需要为InitialContext构造函数提供任何属性。你可以简单地使用no-arg构造函数。要指定服务器名称和端口,请设置 -Dorg.omg.CORBA.ORBInitialHost -Dorg.omg.CORBA.ORBInitialPort

至于这些库,您需要包含的仅仅是gf-client.jar文件。它可以在$ GLASSFISH_HOME / lib中找到。这个jar文件将自动包含所需的其他库。



有关更多信息,请参阅。尽管该文档解决了在独立客户端使用EJB,但同样的解决方案适用于使用JMS。


it is absolutely no problem to connect to a ActiveMQ as standalone client. The only thing you need is to add the activemq-all-5.4.1.jar and there you go...

...
prop.put(Context.SECURITY_AUTHENTICATION , "system");
prop.put(Context.SECURITY_CREDENTIALS,"manager");
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
prop.put(Context.PROVIDER_URL,"tcp://localhost:61616");
prop.put("connectionFactoryNames", "TopicCF");
prop.put("topic.topic1", "topic1");

InitialContext ctx = new InitialContext(prop);
...

Now you want to connect to Glassfish V3.x and it seems impossible to get the right libraries and classes in order to connect. While it still was possible in Glassfish V2.x I did not succeed yet to get the equivalent of above code running for Glassfish !

...
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.appserv.naming.S1ASCtxFactory");
properties.put(Context.PROVIDER_URL, "iiop://localhost:3700");
InitialContext context = new InitialContext(properties)
...

Does anyone have an answer on this ? No, I dont want to deploy an enterprise app-client just to read from a Glassfish queue. There are similar threads here, but none guides anywhere.

Thanks for any tips

Sven

解决方案

When connecting to Glassfish V3, there is no need to supply any properties to the InitialContext constructor. You can simply use the no-arg constructor. To specify the server name and port, set the -Dorg.omg.CORBA.ORBInitialHost and -Dorg.omg.CORBA.ORBInitialPort properties on the JVM, respectively.

As for the libraries, all you should need to include is the gf-client.jar file. It can be found at $GLASSFISH_HOME/lib. This jar file will automatically include whatever other libraries are needed.

For more information, please see http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB. Although that document addresses using EJBs in a stand-alone client, the same solutions apply to using JMS.

这篇关于Glassfish V3.x和远程独立客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 18:48