急!!JMS 连接 Sam5620服务器问题,有知道的再送高分
折腾的生活 2010-01-08 11:26:53 我现在要实现对sam5620服务器得topic监听,请问怎么弄啊?
<bean id="connectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>SAMConnectionFactory</value>
</property>
</bean>
总是找不到工厂,原来的项目是在ejb中是通过mbean弄的,我现在要用spring怎么弄啊?
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
env.put("jnp.disableDiscovery", "true");
// env.put("jnp.timeout", "60000");
env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
jndiContext = new InitialContext(env);
topicConnectionFactory = getExternalFactory(jndiContext);
。。。
private TopicConnectionFactory getExternalFactory(Context aInContext)
throws NamingException {
try {
Context lInitialContext = (Context) aInContext.lookup(JMS_CONTEXT);
return (TopicConnectionFactory) lInitialContext
.lookup(CONNECTION_FACTORY);
} catch (NamingException e) {
System.out.println("JNDI API lookup failed: " + e.toString());
throw e;
}
}
请问这么弄在spring中怎么配置啊?