自由:中间上下文不存在:jms/xyz [英] Liberty : Intermediate context does not exist : jms/xyz
问题描述
我正在努力将耳朵的应用程序迁移到自由中.这是一个Web应用程序,它结合使用JMS和MQ消息传递提供程序.
I am working on migrating ear application to liberty. It is a web appliation that uses JMS with MQ messaging provider.
例如,在我的stage.config.xml中,我们具有以下属性:
For example in my stage.config.xml, we have following properties:
MQQueue(0).CCSID
MQQueue(0).baseQueueName
MQQueue(0).jndiName
MQQueue(0).name
MQQueueConnectionFactory(0).CCSID
MQQueueConnectionFactory(0).channel
MQQueueConnectionFactory(0).connectionPool.ConnectionPool(0).maxConnections
MQQueueConnectionFactory(0).description
MQQueueConnectionFactory(0).host
MQQueueConnectionFactory(0).jndiName
MQQueueConnectionFactory(0).name
MQQueueConnectionFactory(0).port
MQQueueConnectionFactory(0).provider
MQQueueConnectionFactory(0).queueManager
MQQueueConnectionFactory(0).sessionPool.ConnectionPool(0).maxConnections
MQQueueConnectionFactory(0).transportType
<featureManager>
<feature>jsp-2.3</feature>
<feature>localConnector-1.0</feature>
<feature>jndi-1.0</feature>
<feature>jdbc-4.1</feature>
<feature>samlWeb-2.0</feature>
<feature>wasJmsClient-2.0</feature>
<feature>wasJmsClient-1.1</feature>
<feature>wmqJmsClient-1.1</feature>
<feature>jndi-1.0</feature>
<feature>jmsMdb-3.1</feature>
</featureManager>
<featureManager>
<exclude>jsf-2.2</exclude>
</featureManager>
<variable name="wmqJmsClient.rar.location"
value="${server.config.dir}/wmq/wmq.jmsra.rar"/>
<jmsQueue id="1533A.TRANSPORT.ASSIGNMENT.RESP" jndiName="jms/xyz/queue/transportAssignment/response"></jmsQueue>
<jmsQueue id="1533A.TRANSPORT.ASSIGNMENT.RQST" jndiName="jms/xyz/queue/transportAssignment/request"></jmsQueue>
<jmsQueueConnectionFactory jndiName="jms/xyz" id="xyz_qa_QCF">
<connectionManager maxPoolSize="10"/>
<properties.wmqJms providerVersion="unspecified" transportType="CLIENT" applicationName="xyz" channel="CLIENTS.xyz" hostName="host123.GOT.hst.NET" queueManager="xyz141Q" CCSID="1208"/>
</jmsQueueConnectionFactory>
我得到的异常:NameNotFoundException:中间上下文不存在:jms/xyz
Exception I get : NameNotFoundException: Intermediate context does not exist: jms/xyz
任何人都可以指导我在Server.xml中使用什么参数/配置才能正常工作.请帮忙.
Can anyone please guide on what all parameters/Configurations I have to use in Server.xml for this to work.Kindly help.
推荐答案
server.xml
有几个问题:
- 重复的
jndi-1.0
功能 - 混合了
wasJmsClient
和wmqJmsClient
-如果仅使用mq
而不是删除was
- wasJmsClient 的混合版本-如果还需要连接到内部队列,则仅使用一个 功能中的
-
< exclude>
-您在哪里找到了这样的结构,我认为它不受支持 - 最后,您一次将
jms \ xyz
用作QCF名称,一次将其用作上下文名称.这是不正确的.将您的QCF jndi名称更改为其他名称,例如jms \ xyz \ qcf
- duplicated
jndi-1.0
feature - mixed
wasJmsClient
andwmqJmsClient
- if you only usemq
than removewas
- mixed versions of
wasJmsClient
- use only one if you need to connect to internal queues also <exclude>
in features - where did you find such construct, I do not believe it is supported- finally you are using
jms\xyz
once as QCF name, and once as context name. It is incorrect. Change your QCF jndi name to something differnet e.g.jms\xyz\qcf
基于评论的更新
检查您如何使用JMS类.
UPDATE based on comments
Check how you are using JMS classes.
这是我用于连接到MQ的配置和代码:
Here is config and code I used for connecting to MQ:
server.xml
片段:
<feature>jms-2.0</feature>
用于发送消息的Java代码:
Java code to send message:
@ApplicationScoped
public class JMSHelper {
private static Logger logger = Logger.getLogger(JMSHelper.class.getName());
@Inject
@JMSConnectionFactory("jms/myapp/NotificationQueueConnectionFactory")
private JMSContext jmsContext;
@Resource(lookup = "jms/myapp/NotificationQueue")
private Queue queue;
@Transactional
void invokeJMS(Object json) throws JMSException, NamingException {
String contents = json.toString();
logger.info("Sending "+contents+" to "+queue.getQueueName());
jmsContext.createProducer().send(queue, contents);
logger.info("JMS Message sent successfully!");
}
}
这篇关于自由:中间上下文不存在:jms/xyz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!