Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 使用wlp for java springboot应用程序在eclipse中使用IBM MQ设置侦听器_Spring Boot_Ibm Mq_Websphere Liberty_Spring Jms_Server.xml - Fatal编程技术网

Spring boot 使用wlp for java springboot应用程序在eclipse中使用IBM MQ设置侦听器

Spring boot 使用wlp for java springboot应用程序在eclipse中使用IBM MQ设置侦听器,spring-boot,ibm-mq,websphere-liberty,spring-jms,server.xml,Spring Boot,Ibm Mq,Websphere Liberty,Spring Jms,Server.xml,使用wlp for java springboot应用程序在eclipse中使用IBM MQ设置侦听器 您好,我正在尝试在eclipse的本地应用程序中使用wlp设置侦听器, 代码如下: pom.xml <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jms</artifactId> <

使用wlp for java springboot应用程序在eclipse中使用IBM MQ设置侦听器

您好,我正在尝试在eclipse的本地应用程序中使用wlp设置侦听器, 代码如下:

pom.xml

   <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>4.3.10.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>javax.jms</groupId>
        <artifactId>javax.jms-api</artifactId>
        <version>2.0</version>
    </dependency>
现在,我尝试按照ibm的指导原则在wlp中设置server.xml,如下所示:

<server description="new server">
    <!-- Enable features -->
    <featureManager>
        <feature>javaee-7.0</feature>
        <feature>jndi-1.0</feature>
        <feature>jaxws-2.2</feature>
        <feature>localConnector-1.0</feature>
        <feature>transportSecurity-1.0</feature>
        <feature>servlet-3.1</feature>
        <feature>mdb-3.2</feature>
        <feature>wmqJmsClient-2.0</feature>
        <feature>jsp-2.3</feature>
    </featureManager>

    <!-- Define an Administrator and non-Administrator -->
    <basicRegistry id="basic">
        <user name="admin" password="adminpwd" />
        <user name="nonadmin" password="nonadminpwd" />
    </basicRegistry>

    <!-- Assign 'admin' to Administrator -->
    <administrator-role>
        <user>admin</user>
    </administrator-role>
    <keyStore id="defaultKeyStore" password="Liberty" />


    <httpEndpoint host="*" httpPort="9081" httpsPort="9444"
        id="defaultHttpEndpoint" />



    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true" />
    <applicationMonitor updateTrigger="mbean" />

    <enterpriseApplication
        id="mqtest-ear"
        location="mqtest-ear.ear"
        name="mqtest-ear" />


    <variable name="wmqJmsClient.rar.location"
        value="path\to\wlp\wmq\wmq.jmsra.rar" />

    <jmsQueueConnectionFactory
        jndiName="jms/ConnectionFactory">
        <properties.wmqJms transportType="CLIENT"
            hostName="<test.correcthostname>" port="<test.correctportname>"
            channel="<test.correctchannelname>" queueManager="<test.correctqmgrname>" useSSL="true"
            headerCompression="SYSTEM" messageCompression="RLE"
            sslCipherSuite="SSL_RSA_WITH_AES_256_CBC_SHA256"
            targetClientMatching="true" />
        <connectionManager></connectionManager>
    </jmsQueueConnectionFactory>


    <jmsQueue id="JMSQueue" jndiName="jms/InQueue">
        <properties.wmqJms baseQueueName="test.queue"
            baseQueueManagerName="<test.correctqmgrname>" receiveConversion="CLIENT_MSG"
            putAsyncAllowed="DESTINATION" targetClient="MQ"
            readAheadAllowed="ENABLED" />
    </jmsQueue>


<!--    <resourceAdapter
        location="${wmqJmsClient.rar.location}" id="resourceAdapter">
    </resourceAdapter> -->

    <keyStore id="keyAndTrustStore" password="password"
        location="path\to\keyandtruststore"
        type="PKCS12">
    </keyStore>
<!-- Enable features -->
<featureManager>
    <feature>webProfile-8.0</feature>
    <feature>localConnector-1.0</feature>
    <feature>jndi-1.0</feature>
    <feature>jaxws-2.2</feature>
    <feature>transportSecurity-1.0</feature>
    <feature>wmqJmsClient-2.0</feature>
    <feature>jsp-2.3</feature>
    <feature>servlet-4.0</feature>
    <feature>jms-2.0</feature>
    <feature>javaee-8.0</feature>
</featureManager>

<!-- Define an Administrator and non-Administrator -->
<basicRegistry id="basic">
    <user name="admin" password="adminpwd"/>
    <user name="nonadmin" password="nonadminpwd"/>
</basicRegistry>
<!-- Assign 'admin' to Administrator -->
<administrator-role>
    <user>admin</user>
</administrator-role>

<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<applicationMonitor updateTrigger="mbean"/>

<variable name="wmqJmsClient.rar.location" value="path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer\wmq\wmq.jmsra.rar"/>

<jmsQueueConnectionFactory jndiName="jms/ConnectionFactory" id="QueueConnectionFactory ">
    <properties.wmqJms channel="channelName" headerCompression="NONE" hostName="host name" messageCompression="RLE" port="1414" queueManager="qmgrName" sslCipherSuite="TLS_RSA_WITH_AES_256_CBC_SHA256" targetClientMatching="true" transportType="CLIENT" temporaryModel="SYSTEM.DEFAULT.MODEL.QUEUE" pollingInterval="5s" rescanInterval="5s"/>
    <connectionManager connectionTimeout="180s" maxPoolSize="20" minPoolSize="1" reapTime="180s" agedTimeout="0" maxIdleTime="30m"/>
</jmsQueueConnectionFactory>


<jmsQueue id="JMSQueue" jndiName="jms/testInQueue">
    <properties.wmqJms putAsyncAllowed="DISABLED" readAheadAllowed="ENABLED" receiveConversion="CLIENT_MSG" targetClient="JMS" baseQueueName="queueName" baseQueueManagerName="qmgrName" failIfQuiesce="true" persistence="APP"/>
</jmsQueue>


<!-- <wmqJmsClient nativeLibraryPath="C:\Users\n78724\CRAS\resource adapter\lib"/> -->

<resourceAdapter id="resourceAdapter"
    location="${wmqJmsClient.rar.location}">
    <customize></customize>
</resourceAdapter>

<ssl id="keyAndTrustStore" keyStoreRef="defaultKeyStore" sslProtocol="TLSv1.2" trustStoreRef="defaultTrustStore"/>
<keyStore id="defaultKeyStore" location="path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer\resources\security\keyandtruststore.jks" password="secret"/>
<keyStore id="defaultTrustStore" location="path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer\resources\security\keyandtruststore.jks" password="secret"/>


<enterpriseApplication id="Test-ear" location="Test-ear.ear" name="Test-ear"/>

如何使侦听器工作

经过大量尝试和故障排除,我找到了一个解决方案,在WebSphereLiberty server版本19.0.0.6中使用springboot和jms在本地设置ibm mq消息侦听器。 我使用以下步骤使侦听器工作:

  • 下载资源适配器9.0.0.8-IBM-MQ-Java-InstallRA.jar

  • 运行jar,将生成一个名为wmq的文件夹,其中包含required.rar文件

  • 将wmq文件夹放在wlp服务器内:path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer

  • 如果对ssl使用密钥库,请将trust和key store.jks或.p12文件放在wlp server path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer\resources\security中

  • 创建一个新文件名jvm.options,详细信息如下:

    -Dcom.ibm.mq.cfg.useIBMCipherMappings=false
    -Djavax.net.debug="all"
    -Djdk.tls.client.protocols="TLSv1.2"
    -Dhttps.protocols="TLSv1.2"
    -Djavax.net.ssl.trustStore="path\to\keyandtruststore.jks"
    -Djavax.net.ssl.trustStorePassword="secret"
    -Djavax.net.ssl.keyStore="path\to\keyandtruststore.jks"
    -Djavax.net.ssl.keyStorePassword="secret"
    
  • 将文件保存在以下位置:path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer

  • 现在在pom.xml中添加所需的依赖项 我使用的是spring boot版本2.1.4.release,以下是所需的重要依赖项:

    <dependency>
            <groupId>com.ibm.mq</groupId>
            <artifactId>mq-jms-spring-boot-starter</artifactId>
            <version>2.1.2</version>
    </dependency>
    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.1.4.RELEASE</version>
    </dependency>
    
    
    com.ibm.mq
    mqjmsspring启动程序
    2.1.2
    org.springframework.boot
    SpringBootStarterWeb
    2.1.4.1发布
    
  • 现在更改wlp server.xml,如下所示:

    <server description="new server">
        <!-- Enable features -->
        <featureManager>
            <feature>javaee-7.0</feature>
            <feature>jndi-1.0</feature>
            <feature>jaxws-2.2</feature>
            <feature>localConnector-1.0</feature>
            <feature>transportSecurity-1.0</feature>
            <feature>servlet-3.1</feature>
            <feature>mdb-3.2</feature>
            <feature>wmqJmsClient-2.0</feature>
            <feature>jsp-2.3</feature>
        </featureManager>
    
        <!-- Define an Administrator and non-Administrator -->
        <basicRegistry id="basic">
            <user name="admin" password="adminpwd" />
            <user name="nonadmin" password="nonadminpwd" />
        </basicRegistry>
    
        <!-- Assign 'admin' to Administrator -->
        <administrator-role>
            <user>admin</user>
        </administrator-role>
        <keyStore id="defaultKeyStore" password="Liberty" />
    
    
        <httpEndpoint host="*" httpPort="9081" httpsPort="9444"
            id="defaultHttpEndpoint" />
    
    
    
        <!-- Automatically expand WAR files and EAR files -->
        <applicationManager autoExpand="true" />
        <applicationMonitor updateTrigger="mbean" />
    
        <enterpriseApplication
            id="mqtest-ear"
            location="mqtest-ear.ear"
            name="mqtest-ear" />
    
    
        <variable name="wmqJmsClient.rar.location"
            value="path\to\wlp\wmq\wmq.jmsra.rar" />
    
        <jmsQueueConnectionFactory
            jndiName="jms/ConnectionFactory">
            <properties.wmqJms transportType="CLIENT"
                hostName="<test.correcthostname>" port="<test.correctportname>"
                channel="<test.correctchannelname>" queueManager="<test.correctqmgrname>" useSSL="true"
                headerCompression="SYSTEM" messageCompression="RLE"
                sslCipherSuite="SSL_RSA_WITH_AES_256_CBC_SHA256"
                targetClientMatching="true" />
            <connectionManager></connectionManager>
        </jmsQueueConnectionFactory>
    
    
        <jmsQueue id="JMSQueue" jndiName="jms/InQueue">
            <properties.wmqJms baseQueueName="test.queue"
                baseQueueManagerName="<test.correctqmgrname>" receiveConversion="CLIENT_MSG"
                putAsyncAllowed="DESTINATION" targetClient="MQ"
                readAheadAllowed="ENABLED" />
        </jmsQueue>
    
    
    <!--    <resourceAdapter
            location="${wmqJmsClient.rar.location}" id="resourceAdapter">
        </resourceAdapter> -->
    
        <keyStore id="keyAndTrustStore" password="password"
            location="path\to\keyandtruststore"
            type="PKCS12">
        </keyStore>
    
    <!-- Enable features -->
    <featureManager>
        <feature>webProfile-8.0</feature>
        <feature>localConnector-1.0</feature>
        <feature>jndi-1.0</feature>
        <feature>jaxws-2.2</feature>
        <feature>transportSecurity-1.0</feature>
        <feature>wmqJmsClient-2.0</feature>
        <feature>jsp-2.3</feature>
        <feature>servlet-4.0</feature>
        <feature>jms-2.0</feature>
        <feature>javaee-8.0</feature>
    </featureManager>
    
    <!-- Define an Administrator and non-Administrator -->
    <basicRegistry id="basic">
        <user name="admin" password="adminpwd"/>
        <user name="nonadmin" password="nonadminpwd"/>
    </basicRegistry>
    <!-- Assign 'admin' to Administrator -->
    <administrator-role>
        <user>admin</user>
    </administrator-role>
    
    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true"/>
    <applicationMonitor updateTrigger="mbean"/>
    
    <variable name="wmqJmsClient.rar.location" value="path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer\wmq\wmq.jmsra.rar"/>
    
    <jmsQueueConnectionFactory jndiName="jms/ConnectionFactory" id="QueueConnectionFactory ">
        <properties.wmqJms channel="channelName" headerCompression="NONE" hostName="host name" messageCompression="RLE" port="1414" queueManager="qmgrName" sslCipherSuite="TLS_RSA_WITH_AES_256_CBC_SHA256" targetClientMatching="true" transportType="CLIENT" temporaryModel="SYSTEM.DEFAULT.MODEL.QUEUE" pollingInterval="5s" rescanInterval="5s"/>
        <connectionManager connectionTimeout="180s" maxPoolSize="20" minPoolSize="1" reapTime="180s" agedTimeout="0" maxIdleTime="30m"/>
    </jmsQueueConnectionFactory>
    
    
    <jmsQueue id="JMSQueue" jndiName="jms/testInQueue">
        <properties.wmqJms putAsyncAllowed="DISABLED" readAheadAllowed="ENABLED" receiveConversion="CLIENT_MSG" targetClient="JMS" baseQueueName="queueName" baseQueueManagerName="qmgrName" failIfQuiesce="true" persistence="APP"/>
    </jmsQueue>
    
    
    <!-- <wmqJmsClient nativeLibraryPath="C:\Users\n78724\CRAS\resource adapter\lib"/> -->
    
    <resourceAdapter id="resourceAdapter"
        location="${wmqJmsClient.rar.location}">
        <customize></customize>
    </resourceAdapter>
    
    <ssl id="keyAndTrustStore" keyStoreRef="defaultKeyStore" sslProtocol="TLSv1.2" trustStoreRef="defaultTrustStore"/>
    <keyStore id="defaultKeyStore" location="path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer\resources\security\keyandtruststore.jks" password="secret"/>
    <keyStore id="defaultTrustStore" location="path\to\wlp-webProfile8-19.0.0.6\wlp\usr\servers\defaultServer\resources\security\keyandtruststore.jks" password="secret"/>
    
    
    <enterpriseApplication id="Test-ear" location="Test-ear.ear" name="Test-ear"/>
    

    
    webProfile-8.0
    localConnector-1.0
    jndi-1.0
    jaxws-2.2
    运输安全-1.0
    wmqJmsClient-2.0
    jsp-2.3
    servlet-4.0
    jms-2.0
    javaee-8.0
    管理
    

  • 启动服务器


  • 希望有帮助。

    是否应该
    destination=test.queue
    be
    destination=jms/InQueue
    ?不,根据jms规范,它应该是队列名称,而不是jndi名称您使用的liberty版本是什么?@JoshMc liberty version-17.0.0.4