Ben*_*son 5 java jboss jndi jms java-ee
我需要在没有J2EE容器开销的情况下运行JNDI提供程序.我试图按照本文中的说明进行操作,该文章(第3页)描述了我想要做的事情.不幸的是,这些方向失败了 我不得不将jboss-common.jar添加到我的类路径中.一旦我这样做,我得到一个堆栈跟踪:
$ java org.jnp.server.Main
0 [main] DEBUG
org.jboss.naming.Naming - Creating
NamingServer stub, theServer=null,rmiPort=0,clientSocketFactory=null,serverSocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076[bindAddress=null]
Exception in thread "main"
java.lang.NullPointerException
at org.jnp.server.Main.getNamingInstance(Main.java:301)
at org.jnp.server.Main.initJnpInvoker(Main.java:354)
at org.jnp.server.Main.start(Main.java:316)
at org.jnp.server.Main.main(Main.java:104)
Run Code Online (Sandbox Code Playgroud)
我希望能够做到这一点,但我也会对其他轻量级独立JNDI提供商开放.所有这一切都是为了让ActiveMQ工作,如果有人可以建议另一个轻量级的JMS提供程序在vm之外运行良好,客户端就没有一个完整的应用程序服务器也可以工作.
Apache ActiveMQ已经附带了一个集成的轻量级JNDI提供程序.请参阅这些使用说明.
基本上你只需将jndi.properties文件添加到类路径中就可以了.
java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
# use the following property to configure the default connector
java.naming.provider.url = failover:tcp://localhost:61616
# use the following property to specify the JNDI name the connection factory
# should appear as.
#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.MyQueue = example.MyQueue
# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.MyTopic = example.MyTopic
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8131 次 |
最近记录: |