无法将JCA CICS资源与IBM WebSphere Application Server Liberty Profile一起使用

时间:2017-02-14 10:32:32

标签: websphere-liberty

我正在尝试为现有的EAR应用程序设置WLP。 此设置适用于WAS 9传统。

问题是JCA CICS资源适配器调用。

server.xml:

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>javaee-7.0</feature>
    </featureManager>

    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint id="defaultHttpEndpoint"
                  host="*"
                  httpPort="9080"
                  httpsPort="9443" />

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

    <library id="sharedLibs">
        <fileset dir="/work/sharedlibs" includes="*.jar"/>
        <folder dir="/work" />
    </library>

    <resourceAdapter
            autoStart="true"
            id="eciResourceAdapter"
            location="/work/cicseci.rar">
    </resourceAdapter>

    <connectionFactory id="CTGDV06" jndiName="jca/CTGDV06" >
        <properties.eciResourceAdapter.javax.resource.cci.ConnectionFactory
                connectionUrl="tcp://*******"
                serverName="*******"
                userName="*******"
                portNumber="2006"
         />
    </connectionFactory>

    <application type="ear" id="app" location="app.ear" name="app">
        <classloader
                commonLibraryRef="sharedLibs"
                classProviderRef="eciResourceAdapter" />
    </application>
</server>

在ibm-web-bnd.xml中:

<resource-ref name="cicsjca" binding-name="jca/CTGDV06"></resource-ref>
web.xml中的

<resource-ref id="ResourceRef_Cics_Jca">
    <description>Acces CICS</description>
    <res-ref-name>cicsjca</res-ref-name>
    <res-type>javax.resource.cci.ConnectionFactory</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

启动正常,但访问JCA失败:

java.lang.Exception: Lookup for java:comp/env/cicsjca failed. Exception: javax.naming.NamingException: CWNEN1001E: The object referenced by the java:comp/env/cicsjca JNDI name could not be instantiated. If the reference name maps to a JNDI name in the deployment descriptor bindings for the application performing the JNDI lookup, make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context. 
[Root exception is com.ibm.wsspi.injectionengine.InjectionException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/cicsjca reference.  The exception message was: CWNEN1003E: The server was unable to find the jca/CTGDV06 binding with the javax.resource.cci.ConnectionFactory type for the java:comp/env/cicsjca reference.]

我不明白这个设置有什么问题,任何帮助都会被贬低!

1 个答案:

答案 0 :(得分:1)

正确的配置取决于资源适配器提供的连接工厂实现的数量。

如果资源适配器仅提供单个连接工厂(许多资源适配器通常都是这种情况),那么配置将是:

var date = new Date;
var nextWeekStart = date.getDate() - date.getDay() + 7;
var nextWeekFrom = new Date(date.setDate(nextWeekStart));
var nextWeekEnd = date.getDate() - date.getDay() + 6;
var nextWeekTo = new Date(date.setDate(nextWeekEnd));

console.log('nextWeekFrom: ' + nextWeekFrom.toString())
console.log('nextWeekTo  : ' + nextWeekTo.toString())

有关如何在Liberty中为JCA资源适配器指定配置的详细信息,请在知识中心找到here