Liberty : Intermediate context does not exist : jms/xyz

你离开我真会死。 提交于 2021-01-29 06:51:59

问题


I am working on migrating ear application to liberty. It is a web appliation that uses JMS with MQ messaging provider.

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>

Exception I get : NameNotFoundException: Intermediate context does not exist: jms/xyz

Can anyone please guide on what all parameters/Configurations I have to use in Server.xml for this to work.Kindly help.


回答1:


There are several issues with your server.xml:

  • duplicated jndi-1.0 feature
  • mixed wasJmsClient and wmqJmsClient - if you only use mq than remove was
  • 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

UPDATE based on comments
Check how you are using JMS classes.

Here is config and code I used for connecting to MQ:

server.xml fragment:

    <feature>jms-2.0</feature>

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!");
    }
    
}



回答2:


I am assuming you will use the resource adapter, so please start with reading Liberty and the IBM MQ resource adapter in the IBM documentation.

When you start configuring things like documented by IBM and it still does not work, please post the liberty config and the full exception you get, so we can help you again.



来源:https://stackoverflow.com/questions/63334072/liberty-intermediate-context-does-not-exist-jms-xyz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!