手动安装 Worklight 服务器并声明 Worklight 运行时 (WL 6.2)

Posted

技术标签:

【中文标题】手动安装 Worklight 服务器并声明 Worklight 运行时 (WL 6.2)【英文标题】:Installing Worklight server and declaring Worklight runtimes manually (WL 6.2) 【发布时间】:2015-01-19 12:10:01 【问题描述】:

我正在尝试使用 db2 数据库在 WebSphere Liberty Profile 中手动安装 IBM Worklight 6.2。我已经让 appcenter 和 worklight 服务器正常运行。但是当我尝试声明我的服务器运行时(我已经上传了 war 文件并在 server.xml 文件中声明了它),日志显示以下消息:

2015-01-19T12:39:43.32+0100 [App/0]   ERR [ERROR   ] FWLST0003E: ========= Failed starting project /worklight [project worklight]
2015-01-19T12:39:43.32+0100 [App/0]   ERR Error creating bean with name 'txManager' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/core.xml]: Cannot resolve reference to bean 'brokerSessionFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerSessionFactory' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'rssBrokerDS' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rssBrokerDS' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'worklight-direct' while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'worklight-direct' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: FWLSE0206E: The project /worklight failed to initialize, because the project database schema for data source jdbc:db2://75.126.155.153:50000/SQLDB is from version N/A, which is not supported by the server from version 6.2.0.00.20140613-0730. Use the Worklight ant tasks to upgrade the project database schema. [project worklight]
2015-01-19T12:39:43.40+0100 [App/0]   ERR [ERROR   ] Error creating bean with name 'txManager' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/core.xml]: Cannot resolve reference to bean 'brokerSessionFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerSessionFactory' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'rssBrokerDS' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rssBrokerDS' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'worklight-direct' while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'worklight-direct' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: FWLSE0206E: The project /worklight failed to initialize, because the project database schema for data source jdbc:db2://75.126.155.153:50000/SQLDB is from version N/A, which is not supported by the server from version 6.2.0.00.20140613-0730. Use the Worklight ant tasks to upgrade the project database schema. [project worklight]
2015-01-19T12:39:43.40+0100 [App/0]   ERR Error creating bean with name 'txManager' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/core.xml]: Cannot resolve reference to bean 'brokerSessionFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerSessionFactory' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'rssBrokerDS' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rssBrokerDS' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'worklight-direct' while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'worklight-direct' defined in URL [wsjar:file:/home/vcap/app/.liberty/usr/shared/resources/worklight/lib/worklight-jee-library.jar!/conf/spring-server-core.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: FWLSE0206E: The project /worklight failed to initialize, because the project database schema for data source jdbc:db2://75.126.155.153:50000/SQLDB is from version N/A, which is not supported by the server from version 6.2.0.00.20140613-0730. Use the Worklight ant tasks to upgrade the project database schema. [project worklight]

这是我的 server.xml 文件:

<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>jsp-2.2</feature>
        <!-- Begin of features added by IBM Worklight installer. -->
        <feature>ssl-1.0</feature>
        <feature>servlet-3.0</feature>
        <feature>jdbc-4.0</feature>
        <feature>appSecurity-1.0</feature>
        <feature>restConnector-1.0</feature>
        <feature>jndi-1.0</feature>
        <!-- End of features added by IBM Worklight installer. -->
    </featureManager>

    <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443" >

        <tcpOptions soReuseAddr="true"/>
    </httpEndpoint>

    <!-- Begin of configuration added by IBM Worklight installer. -->

    <!-- Declare the IBM Application Center Console application. -->
    <application id="appcenterconsole" name="appcenterconsole" location="appcenterconsole.war" type="war">
        <application-bnd>
            <security-role name="appcenteradmin">
                <group name="appcentergroup"/>
            </security-role>
        </application-bnd>
    </application>

    <!-- Declare the IBM Application Center Services application. -->
    <application id="applicationcenter" name="applicationcenter" location="applicationcenter.war" type="war">
        <application-bnd>
            <security-role name="appcenteradmin">
                <group name="appcentergroup"/>
            </security-role>
        </application-bnd>
        <classloader delegation="parentLast">
            <commonLibrary>
                <fileset dir="$wlp.install.dir/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.8.jar"/>
            </commonLibrary>
        </classloader>
    </application>

    <!-- Declare the user registry for the IBM Application Center. -->
    <basicRegistry id="applicationcenter-registry" realm="ApplicationCenter">
        <!--    Worklight user.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
        -->
        <user name="WorklightRESTUser" password="EKminBt6fHnE"/>

        <!-- The users defined here are members of group "appcentergroup",
             thus have role "appcenteradmin", and can therefore perform
             administrative tasks through the IBM Application Center Console. -->
        <user name="appcenteradmin" password="admin"/>
        <user name="demo" password="demo"/>

        <group name="appcentergroup">
            <member name="appcenteradmin"/>
            <member name="demo"/>
        </group>
    </basicRegistry>

    <!-- Declare the JNDI properties for the IBM Application Center. -->

    <!-- Define the AppCenter services endpoint in order for the AppCenter console to be able to invoke the REST service.
            You need to enable this property if the server is behind a reverse proxy
            or if the context root of the Application Center Services application is different from '/applicationcenter'. -->
    <!-- <jndiEntry jndiName="ibm.appcenter.services.endpoint" value='"http://proxyhost:proxyport/applicationcenter"'/> -->
    <!-- The directory with binaries of the 'aapt' program, from the android SDK's platform-tools package. -->
    <!--<jndiEntry jndiName="android.aapt.dir" value='"*******/android-sdk"'/>-->
    <jndiEntry jndiName="android.aapt.dir" value="C******/android-sdk"/>
    <!-- The protocol of the application resources URI. This property is optional. It is only needed if the protocol of the external and internal URI are different. -->
    <!-- <jndiEntry jndiName="ibm.appcenter.proxy.protocol" value='"http"'/> -->
    <!-- The hostname of the application resources URI. -->
    <!-- <jndiEntry jndiName="ibm.appcenter.proxy.host" value='"proxyhost"'/> -->
    <!-- The port of the application resources URI. This property is optional. -->
    <!-- <jndiEntry jndiName="ibm.appcenter.proxy.port" value="proxyport"/> -->

    <!-- Declare the jar files for DB2 access through JDBC. -->
    <library id="DB2Lib">
        <fileset dir="$shared.resource.dir/db2" includes="*.jar"/>
    </library>

    <!-- Declare the IBM Application Center database. -->
    <dataSource jndiName="jdbc/AppCenterDS" transactional="false">
        <jdbcDriver libraryRef="DB2Lib"/>
        <properties.db2.jcc databaseName='$Database.connection.db' serverName='$Database.connection.host' portNumber='$Database.connection.port' user='$Database.connection.username' password='$Database.connection.password'/>
    </dataSource>

    <!-- End of configuration added by IBM Worklight installer. -->

    <administrator-role>
        <!--    Worklight JMX User.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
        -->
        <user>WorklightRESTUser</user>


    </administrator-role>

<!--
    IBM Worklight requires SSL and declared the "defaultKeyStore" default keystore. 
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
    This configuration is the minimum one that you need to create an SSL configuration.
    With this configuration, the Liberty server creates the keystore and the certificate, 
    if it does not exist yet, during the SSL initialization.
    The created certificate is a self-signed certificate that is valid for 365 days.
    Do not use the certificates that the Liberty server created for production use.
    For more information see  http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.wlp.core.doc/ae/twlp_sec_ssl.html
-->
    <keyStore id="defaultKeyStore" password="worklight"/>
    <!--    Worklight JNDI property for JMX connection.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
    -->
    <jndiEntry jndiName="ibm.worklight.admin.jmx.host" value="localhost"/>
    <!--    Worklight JNDI property for JMX connection.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
    -->
    <jndiEntry jndiName="ibm.worklight.admin.jmx.port" value="9443"/>
    <!--    Worklight JNDI property for JMX connection.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
    -->
    <jndiEntry jndiName="ibm.worklight.admin.jmx.user" value="WorklightRESTUser"/>
    <!--    Worklight JNDI property for JMX connection.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
    -->
    <jndiEntry jndiName="ibm.worklight.admin.jmx.pwd" value="EKminBt6fHnE"/>
    <!--    Worklight JNDI property for JMX connection.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
    -->
    <jndiEntry jndiName="ibm.worklight.topology.platform" value="Liberty"/>
    <!--    Worklight JNDI property for JMX connection.
        [Added by IBM Worklight <installWorklightAdmin> Ant task for context root '/wladmin'] 
    -->
    <jndiEntry jndiName="ibm.worklight.topology.clustermode" value="Standalone"/>

    <!-- Begin of configuration added by IBM Worklight <installWorklightAdmin> ant task for context root '/wladmin'. -->

    <!-- Declare the Worklight Administration Service application. -->
    <application id="wladmin" name="wladmin" location="worklightadmin.war" type="war">
        <application-bnd>
            <security-role name="worklightadmin">
                <user name="demo"/>

            </security-role>

            <security-role name="worklightdeployer">
            </security-role>

            <security-role name="worklightmonitor">
            </security-role>

            <security-role name="worklightoperator">
            </security-role>

        </application-bnd>

        <classloader delegation="parentLast">
            <commonLibrary>

                <fileset dir="$wlp.install.dir/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.8.jar"/>
            </commonLibrary>
        </classloader>
    </application>

    <!-- Declare web container custom properties for the Worklight Administration Service application. -->
    <webContainer invokeFlushAfterService="false" deferServletLoad="false"/>

    <!-- Declare the JNDI properties for the Worklight Administration Service. -->
    <jndiEntry jndiName="wladmin/ibm.worklight.admin.environmentid" value="WLBluemix"/>


    <!-- Declare the jar files for DB2 access through JDBC. -->
    <library id="wladmin/DB2Lib">
        <fileset dir="$shared.resource.dir/wladmin/db2" includes="db2jcc4.jar,db2jcc_license_cu.jar"/>
    </library>

    <!-- Declare the IBM Worklight Administration database. -->
    <dataSource jndiName="wladmin/jdbc/WorklightAdminDS" transactional="false">
        <jdbcDriver libraryRef="wladmin/DB2Lib"/>
        <properties.db2.jcc databaseName='$Database.connection.db' serverName='$Database.connection.host' portNumber='$Database.connection.port' user='$Database.connection.username' password='$Database.connection.password' currentSchema='$Database.connection.username'/>
    </dataSource>

    <!-- Declare the Worklight Administration Console application. -->
    <application id="worklightconsole" name="worklightconsole" location="worklightconsole.war" type="war">
        <application-bnd>
            <security-role name="worklightadmin">
                <user name="demo"/>

            </security-role>

            <security-role name="worklightdeployer">
            </security-role>

            <security-role name="worklightmonitor">
            </security-role>

            <security-role name="worklightoperator">
            </security-role>

        </application-bnd>

    </application>

    <!-- Declare web container custom properties for the Worklight Administration Console application. -->
    <webContainer invokeFlushAfterService="false" deferServletLoad="false"/>

    <!-- Declare the JNDI properties for the Worklight Administration Console. -->
    <jndiEntry jndiName="worklightconsole/ibm.worklight.admin.endpoint" value="*://*:*/wladmin"/>


    <!-- End of configuration added by IBM Worklight <installWorklightAdmin> ant task for context root '/wladmin'. -->


    <!-- Begin of configuration added by IBM Worklight <configureApplicationServer> ant task for context root '/worklight'. -->

    <!-- Declare the JNDI properties for the IBM Worklight project runtime. -->
    <jndiEntry jndiName="worklight/publicWorkLightProtocol" value="http"/>
    <jndiEntry jndiName="worklight/publicWorkLightPort" value="9080"/>
    <jndiEntry jndiName="worklight/ibm.worklight.admin.environmentid" value="WLServer"/>


    <!-- Declare the jar files for DB2 access through JDBC. -->
    <library id="worklight/DB2Lib">
        <fileset dir="$shared.resource.dir/worklight/db2" includes="db2jcc4.jar,db2jcc_license_cu.jar"/>
    </library>

    <!-- Declare the IBM Worklight Server database. -->
    <dataSource jndiName="worklight/jdbc/WorklightDS" transactional="false">
        <jdbcDriver libraryRef="worklight/DB2Lib"/>
        <properties.db2.jcc databaseName='$cloud.services.Worklight Database.connection.db' serverName='$cloud.services.Worklight Database.connection.host' portNumber='$cloud.services.Worklight Database.connection.port' user='$cloud.services.Worklight Database.connection.username' password='$cloud.services.Worklight Database.connection.password' currentSchema='$cloud.services.Worklight Database.connection.username'/>
    </dataSource>

    <!-- Declare the IBM Worklight Server reports database. -->
    <dataSource jndiName="worklight/jdbc/WorklightReportsDS" transactional="false">
        <jdbcDriver libraryRef="worklight/DB2Lib"/>
        <properties.db2.jcc databaseName='$Database.connection.db' serverName='$Database.connection.host' portNumber='$Database.connection.port' user='$Database.connection.username' password='$Database.connection.password' currentSchema='$Database.connection.username'/>
    </dataSource>

    <!-- End of configuration added by IBM Worklight <configureApplicationServer> ant task for context root '/worklight'. -->

    <!-- Declare the IBM Worklight project runtime application. -->
    <application id="worklight" name="worklight" location="WLserver.war" type="war">
        <classloader delegation="parentLast">
            <privateLibrary>
                <fileset dir="$shared.resource.dir/worklight/lib" includes="worklight-jee-library.jar"/>
            </privateLibrary>
        </classloader>
    </application>


</server>

【问题讨论】:

【参考方案1】:

您似乎没有为管理服务、运行时和报告数据库创建 DB2 表。

【讨论】:

我们已经使用知识中心的说明手动创建了 DB2 数据库和表。由于 Worklight 服务器已启动并正在运行并且数据源已明确定义,我们如何管理此错误?有什么方法可以检查在部署 .war 运行时时需要执行哪些 SQL 查询?定义新的运行时是否更新 DB2 数据库?谢谢

以上是关于手动安装 Worklight 服务器并声明 Worklight 运行时 (WL 6.2)的主要内容,如果未能解决你的问题,请参考以下文章

安装 IBM Worklight Server

IBM Worklight 6.0.0 - 对 iOS 不工作使用 WebViewOverlay 示例代码

IBM Worklight 6.0 - 无法访问 Worklight 服务器

Worklight Flight Ticket Sample App 的程序包名称是啥?

无法访问 Worklight 服务器应用中心

导入 Worklight 模块