且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JBoss 7:JNDI查找

更新时间:2023-09-21 20:53:52

好,所以我自己找到了答案...

OK, so I found the answer myself ...

首先,您需要具有两个属性文件,即jndi.properties和jboss-ejb-client.properties.

First you need to have two properties files, jndi.properties plus jboss-ejb-client.properties.

jndi.properties:

jndi.properties:

#
# jndi.properties
#
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
java.naming.provider.url=remote://localhost:4447
java.naming.security.principal=remote
java.naming.security.credentials=remotepwd

jboss-ejb-client.properties:

jboss-ejb-client.properties:

#
# jboss-ejb-client.properties
#
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

将它们都放在类路径上,即使在代码中未指定属性的情况下,代码也可以像符咒一样运行.

Having both of them on the classpath will make the code run like a charm even without specifying the properties within the code.

令人困惑的是查找字符串的构造...

Still confusing is the construction of the lookup string ...