开发者

Glassfish V3.x and remote standalone client

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.ActiveMQI开发者_JS百科nitialContextFactory");
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


This is the complete list of client jars for glassfish 3 :

auto-depends.jar
deployment-common.jar
glassfish-corba-internal-api.jar    
internal-api.jar
management-api.jar
bean-validator.jar
dol.jar
glassfish-corba-newtimer.jar        
javax.ejb.jar
orb-connector.jar
common-util.jar
ejb-container.jar
glassfish-corba-omgapi.jar      
javax.jms.jar
orb-iiop.jar
config-api.jar
ejb.security.jar
glassfish-corba-orb.jar
javax.resource.jar
security.jar
config-types.jar
glassfish-api.jar
glassfish-corba-orbgeneric.jar      
javax.servlet.jar
ssl-impl.jar
config.jar
glassfish-corba-asm.jar
glassfish-naming.jar
javax.transaction.jar
transaction-internal-api.jar
connectors-internal-api.jar     
glassfish-corba-codegen.jar     
gmbal.jar
jta.jar
container-common.jar
glassfish-corba-csiv2-idl.jar       
hk2-core.jar
kernel.jar


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.


You can go see the solution I found when encountering quite the same issue : With which maven dependencies can i create a standalone JMS client for Glassfish ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜