由于数据库版本不适用而导致Worklight Server 6.1启动错误

时间:2014-07-24 09:53:21

标签: ant db2 websphere ibm-mobilefirst worklight-server

尝试启动worklight服务器时,我在systemout中收到错误:

The project /worklight failed to initialize, because the project database schema for data source jdbc:db2://localhost:50000/WRKLGHT is from version N/A, which is not supported by the server from version 6.1.0.00.20131126-0630. Use the Worklight ant tasks to upgrade the project database schema. [project worklight]

这表明运行ant任务来创建db2数据库。但是,这是我首先使用信息中心指南中的命令设置数据库的方法:

CREATE DATABASE WRKLGHT COLLATE USING SYSTEM PAGESIZE 32768
CONNECT TO WRKLGHT 
GRANT CONNECT ON DATABASE TO USER wluser
QUIT 

然后

db2 CONNECT TO WRKLGHT USER wluser USING wluserspassword
db2 SET CURRENT SCHEMA = 'WRKSCHM'
db2 -vf <worklight_install_dir>/WorklightServer/databases/create-worklight-db2.sql -t

这两个命令都成功完成。

这是一个新安装,而不是升级。我正在使用db2数据库(WRKLGT / WLREPORT)和WebSphere服务器安装。我在数据源自定义属性中设置了模式(当前模式值为WRKSCHM),

当我在WebSphere中测试数据源连接时,我获得了成功:

The test connection operation for data source Worklight Database on server dmgr at node FingertipServerCellManager01 was successful.

当我使用IBM数据工作室查看数据库时,我可以看到在属性中,数据库版本是8.1(这似乎没问题 - 它与我在另一个工作服务器上的版本相匹配)

database version shown in data studio

以下是创建数据库的脚本:

    --
-- Licensed Materials - Property of IBM
-- 5725-I43 (C) Copyright IBM Corp. 2011, 2013. All Rights Reserved.
-- US Government Users Restricted Rights - Use, duplication or
-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
--

-- This script creates the tables in the Worklight database,
-- when the database management system is DB2.

-- BEFORE executing this script, you have to have
-- - either an empty database for Worklight,
-- - or an empty schema for Worklight in an existing database.
-- For instructions how to create such a database manually, see the
-- IBM Worklight documentation, section
--   Deploying IBM Worklight projects
--   > Deploying IBM Worklight applications to test and production environments
--     > Deploying an IBM Worklight project
--       > Creating and configuring the databases
--         > Optional creation of databases before you use the Ant tasks
--           > Creating the DB2 databases
-- and section
--   Deploying IBM Worklight projects
--   > Deploying IBM Worklight applications to test and production environments
--     > Deploying an IBM Worklight project
--       > Creating and configuring the databases
--         > Creating and configuring the databases manually
--           > Configuring the DB2 databases manually
--             > Setting up your DB2 databases manually

-- To execute this script:
-- Log in to the database server.
-- First connect to the Worklight database.
-- Let's assume
--   the database name is "WRKLGHT"
--   and the schema name is "WRKSCHM".
-- db2 connect to WRKLGHT
-- db2 set current schema = 'WRKSCHM'
-- Then execute:
-- db2 -tvsf create-worklight-db2.sql


CREATE SEQUENCE ADAPTER_SYNC_DATA_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE APP_SYNC_DATA_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE APP_VERSION_ACCESS_DATA_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE GADGETS_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE LICENSETERMS_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE GADGET_APPLICATIONS_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE NOTIFICATION_DEVICE_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE NOTIFICATION_USER_SEQ START WITH 1 CACHE 50;
CREATE SEQUENCE USER_PREF_SEQ START WITH 1 CACHE 50;
CREATE TABLE ADAPTER_SYNC_DATA (ID BIGINT NOT NULL, deployable BLOB(1G), deployableHash VARCHAR(254) NOT NULL, deployableKey VARCHAR(254) NOT NULL, PRIMARY KEY (ID), CONSTRAINT UNQ_deployableKey UNIQUE (deployableKey));
CREATE TABLE APP_SYNC_DATA (ID BIGINT NOT NULL, appDeployableKey VARCHAR(254) NOT NULL, deployable BLOB(1G), deployableHash VARCHAR(254) NOT NULL, lastPersistentPropertyChange BIGINT NOT NULL, PRIMARY KEY (ID), CONSTRAINT UNQ_appDeployableKey UNIQUE (appDeployableKey));
CREATE TABLE APP_VERSION_ACCESS_DATA (ID BIGINT NOT NULL, ACTION VARCHAR(254) NOT NULL, CREATED_TIME TIMESTAMP NOT NULL, DOWNLOAD_LINK VARCHAR(254), ENV VARCHAR(254) NOT NULL, GADGET_NAME VARCHAR(254) NOT NULL, MESSAGE VARCHAR(254) NOT NULL, VERSION VARCHAR(254) NOT NULL, MULTILANGUAGE_MESSAGES CLOB(1M), PRIMARY KEY (ID), CONSTRAINT UNQ_GADGET_NAMENVVERSION UNIQUE (GADGET_NAME, ENV, VERSION));
CREATE TABLE AUTH_ASSOCIATED_IDENTITY (FROMLOGINMODULE VARCHAR(254) NOT NULL, FROMUSERID VARCHAR(254) NOT NULL, TOLOGINMODULE VARCHAR(254) NOT NULL, LASTACCESS BIGINT, TOIDENTITYSTR CLOB, TOUSERID VARCHAR(254), PRIMARY KEY (FROMLOGINMODULE, FROMUSERID, TOLOGINMODULE));
CREATE TABLE CLUSTER_SYNC (ID VARCHAR(254) NOT NULL, HOSTVMID VARCHAR(254), UPDATETIMESTAMP BIGINT, VERSION BIGINT NOT NULL, PRIMARY KEY (ID));
CREATE TABLE DEVICES (DEVICE_ID VARCHAR(254) NOT NULL, FRIENDLY_NAME VARCHAR(254), USER_ID VARCHAR(254), DEVICE_OS VARCHAR(254), DEVICE_MODEL VARCHAR(254), DEVICE_ENV VARCHAR(254), CERT_SERIAL_NUM VARCHAR(254), LAST_ACCESSED_TIME TIMESTAMP NOT NULL, STATUS SMALLINT, PRIMARY KEY (DEVICE_ID));
CREATE TABLE LICENSE_TERMS (ID BIGINT NOT NULL, ACT_DEVICES BIGINT NOT NULL, APP_COUNT BIGINT NOT NULL, INACT_DEVICES BIGINT NOT NULL, REPORT_TIME TIMESTAMP NOT NULL, SERVER_COUNT BIGINT NOT NULL, PRIMARY KEY (ID));
CREATE TABLE GADGETS (ID BIGINT NOT NULL, DISP_IN_GALLERY SMALLINT, LAST_UPDATE_TIME TIMESTAMP NOT NULL, NAME VARCHAR(254) NOT NULL, PRIMARY KEY (ID), CONSTRAINT UNQ_ UNIQUE (NAME));
CREATE TABLE GADGET_APPLICATIONS (ID BIGINT NOT NULL, ENFORCE_AUTHENTICITY SMALLINT, ENVIRONMENT_ID VARCHAR(254) NOT NULL, SERVER_VERSION VARCHAR(254) NOT NULL, VERSION VARCHAR(254) NOT NULL, VERSION_LOCKED SMALLINT, GADGET_ID BIGINT NOT NULL, PRIMARY KEY (ID));
CREATE TABLE GADGET_DEVICE_ASSOC (DEVICE_ID VARCHAR(254) NOT NULL, GADGET_ID BIGINT NOT NULL, CERT_SERIAL_NUM VARCHAR(254), STATUS SMALLINT, PRIMARY KEY (DEVICE_ID, GADGET_ID));
CREATE TABLE GADGET_USER (GADGET_APP_ID VARCHAR(254) NOT NULL, USER_ID VARCHAR(254) NOT NULL, FIRST_ACCESS_TIME DATE NOT NULL, GADGET_ID VARCHAR(254) NOT NULL, PRIMARY KEY (GADGET_APP_ID, USER_ID));
CREATE TABLE GADGET_USER_PREF (ID BIGINT NOT NULL, GADGET_APP_ID VARCHAR(254) NOT NULL, NAME VARCHAR(254) NOT NULL, USER_ID VARCHAR(254), VALUE CLOB, PRIMARY KEY (ID));
CREATE TABLE NOTIFICATION_APPLICATION (APPLICATIONID VARCHAR(254) NOT NULL, MEDIATORTYPE SMALLINT NOT NULL, PLATFORMSTR VARCHAR(254) NOT NULL, dataStr CLOB, ENABLED SMALLINT, PRIMARY KEY (APPLICATIONID, MEDIATORTYPE, PLATFORMSTR));
CREATE TABLE NOTIFICATION_DEVICE (ID BIGINT NOT NULL, ALIAS VARCHAR(254), APPLICATIONID VARCHAR(254) NOT NULL, DEVICE VARCHAR(254) NOT NULL, OPTIONS VARCHAR(254), PLATFORM VARCHAR(254) NOT NULL, TOKEN VARCHAR(254) NOT NULL, USERAGENT VARCHAR(254) NOT NULL, USERSUBSCRIPTIONID BIGINT NOT NULL, PRIMARY KEY (ID));
CREATE TABLE NOTIFICATION_MEDIATOR (MEDIATORSTR VARCHAR(254) NOT NULL, stateStr CLOB, PRIMARY KEY (MEDIATORSTR));
CREATE TABLE NOTIFICATION_USER (ID BIGINT NOT NULL, EVENTSOURCE VARCHAR(254) NOT NULL, state CLOB, USERID VARCHAR(254) NOT NULL, PRIMARY KEY (ID), CONSTRAINT UNQ_USERIDEVENTSOURCE UNIQUE (USERID, EVENTSOURCE));
CREATE TABLE OPENJPA_SEQUENCE_TABLE (ID SMALLINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID));
CREATE TABLE PROPERTIES (PROPERTY VARCHAR(254) NOT NULL, VALUE VARCHAR(254), PRIMARY KEY (PROPERTY));
CREATE TABLE SSO_LOGIN_CONTEXTS (DEVICE_ID VARCHAR(254) NOT NULL, DEVICE_LOGIN_MODULE VARCHAR(254) NOT NULL, SSO_LOGIN_MODULE VARCHAR(254) NOT NULL, LOGIN_CONTEXT CLOB(1M), EXPIRES TIMESTAMP NOT NULL, PRIMARY KEY (DEVICE_ID, DEVICE_LOGIN_MODULE, SSO_LOGIN_MODULE));
CREATE TABLE USAGE_DATA (TIME_AT_BEGINING_OF_DAY BIGINT NOT NULL, USER_ID VARCHAR(254) NOT NULL, EXACT_LOGIN_TIME BIGINT, PRIMARY KEY (TIME_AT_BEGINING_OF_DAY, USER_ID));
CREATE TABLE WORKLIGHT_VERSION (WORKLIGHT_VERSION VARCHAR(50) NOT NULL);
CREATE INDEX I_GDGTTNS_GADGET ON GADGET_APPLICATIONS (GADGET_ID);
CREATE INDEX I_NTFCDVC_PARENT ON NOTIFICATION_DEVICE (USERSUBSCRIPTIONID);
CREATE INDEX I_NTFCDVC_DEVICE ON NOTIFICATION_DEVICE (DEVICE);

INSERT INTO WORKLIGHT_VERSION(WORKLIGHT_VERSION) VALUES ('6.1.0');

我已经重新创建了db2数据库,这个问题似乎已经消失了,但是现在我收到了一条不同的错误消息:

[7/25/14 15:36:11:451 BST] 00000061 LocalContaine I     org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean createNativeEntityManagerFactory Building JPA container EntityManagerFactory for persistence unit 'WorklightPU'

1 个答案:

答案 0 :(得分:0)

这里的解决方案是重新创建数据库表,原始问题已经消失。

关于上述错误:

  

[7/25/14 15:36:11:451 BST] 00000061 LocalContaine I
  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean   createNativeEntityManagerFactory构建JPA容器   持久性单元'WorklightPU'的EntityManagerFactory

这实际上是一个警告,而不是错误。根据以下支持文档可以安全地忽略它: http://www-01.ibm.com/support/docview.wss?uid=swg21605316