Jboss7.x 如7.1.1所示:JNDI查找JMS连接factroy不工作
我正在尝试使用Jboss为JMS编写一个示例程序。我通过以下链接了解了如何使用Jboss for JMS 我在查找ConnectionFactory时遇到异常,即“iniCtx.lookup(“ConnectionFactory”)” 原因是Jboss命名服务没有运行(netstat-an没有显示端口1099的任何结果)。 我没有为命名服务配置任何特定设置。我让它使用默认端口1099 我是否缺少任何配置?请帮助我运行Jboss命名服务 规格: Jboss:AS 7.1.1最终版 JRE:1.6Jboss7.x 如7.1.1所示:JNDI查找JMS连接factroy不工作,jboss7.x,jndi,jms-topic,Jboss7.x,Jndi,Jms Topic,我正在尝试使用Jboss为JMS编写一个示例程序。我通过以下链接了解了如何使用Jboss for JMS 我在查找ConnectionFactory时遇到异常,即“iniCtx.lookup(“ConnectionFactory”)” 原因是Jboss命名服务没有运行(netstat-an没有显示端口1099的任何结果)。 我没有为命名服务配置任何特定设置。我让它使用默认端口1099 我是否缺少任何配置?请帮助我运行Jboss命名服务 规格: Jboss:AS 7.1.1最终版 JRE:1.6
操作系统:Windows 7似乎将Jboss版本与手动版本混合在一起。AS7不使用jnp,jndi端口为4447 因此,在standalone-full.xml中进行以下设置
<security-enabled>false</security-enabled>
...
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
</jms-destinations>
<security-enabled>false</security-enabled>
...
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
</jms-destinations>
Connection connection = null;
InitialContext initialContext = null;
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "remote://localhost:4447");
props.put(Context.SECURITY_PRINCIPAL, "appuser");
props.put(Context.SECURITY_CREDENTIALS, "password");
try {
// Step 1. Create an initial context to perform the JNDI lookup.
initialContext = new InitialContext(props);
// Step 2. Perfom a lookup on the queue
Queue queue = (Queue)initialContext.lookup("jms/queue/test");
// Step 3. Perform a lookup on the Connection Factory
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("jms/RemoteConnectionFactory");
// Step 4.Create a JMS Connection
connection = cf.createConnection();