我在API Designer上创建一个LoopBack项目(用于管理API和应用程序的IBM Toolkit),设置数据源,将其附加到模型并保存成功。通过选择DataPower Gateway Policies
并单击“运行”按钮尝试在本地运行应用程序后,出现错误:
Service inventory started but did not initialize within the timeout period. Dumping log buffer.
2018-04-06T14:43:52.994Z pid:12620 worker:1 Cannot find module 'node-report/api': skipping optional dependency
2018-04-06T14:43:53.697Z pid:12620 worker:1 Web server listening at: http://localhost:4001
2018-04-06T14:44:00.590Z pid:12620 worker:1 Connection failed : Error: Handshake inactivity timeout
2018-04-06T14:44:00.591Z pid:12620 worker:1 A new test will be done for the next request.
2018-04-06T14:44:02.615Z pid:12620 worker:1 events.js:183
2018-04-06T14:44:02.615Z pid:12620 worker:1 throw er; // Unhandled 'error' event
2018-04-06T14:44:02.615Z pid:12620 worker:1 ^
2018-04-06T14:44:02.615Z pid:12620 worker:1 Error: Handshake inactivity timeout
2018-04-06T14:44:02.615Z pid:12620 worker:1 at Handshake.<anonymous> (C:\Users\ASUS\Desktop\apis\inventory\node_modules\mysql\lib\protocol\Protocol.js:164:17)
2018-04-06T14:44:02.615Z pid:12620 worker:1 at emitNone (events.js:106:13)
2018-04-06T14:44:02.615Z pid:12620 worker:1 at Handshake.emit (events.js:208:7)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Handshake._onTimeout (C:\Users\ASUS\Desktop\apis\inventory\node_modules\mysql\lib\protocol\sequences\Sequence.js:129:8)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at ontimeout (timers.js:482:11)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at tryOnTimeout (timers.js:317:5)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Timer.listOnTimeout (timers.js:277:5)
2018-04-06T14:44:02.616Z pid:12620 worker:1 --------------------
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Protocol._enqueue (C:\Users\ASUS\Desktop\apis\inventory\node_modules\mysql\lib\protocol\Protocol.js:145:48)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Protocol.handshake (C:\Users\ASUS\Desktop\apis\inventory\node_modules\mysql\lib\protocol\Protocol.js:52:23)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at PoolConnection.connect (C:\Users\ASUS\Desktop\apis\inventory\node_modules\mysql\lib\Connection.js:130:18)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Pool.getConnection (C:\Users\ASUS\Desktop\apis\inventory\node_modules\mysql\lib\Pool.js:48:16)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at MySQL.connect (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-connector-mysql\lib\mysql.js:90:17)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Object.initializeDataSource [as initialize] (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-connector-mysql\lib\mysql.js:44:28)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at DataSource.setup (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-datasource-juggler\lib\datasource.js:470:19)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at new DataSource (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-datasource-juggler\lib\datasource.js:138:8)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Registry.createDataSource (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback\lib\registry.js:362:12)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at dataSourcesFromConfig (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback\lib\application.js:522:19)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Function.app.dataSource (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback\lib\application.js:229:14)
2018-04-06T14:44:02.616Z pid:12620 worker:1 at C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-boot\lib\executor.js:191:9
2018-04-06T14:44:02.616Z pid:12620 worker:1 at C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-boot\lib\executor.js:282:5
2018-04-06T14:44:02.616Z pid:12620 worker:1 at Array.forEach (<anonymous>)
2018-04-06T14:44:02.617Z pid:12620 worker:1 at forEachKeyedObject (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-boot\lib\executor.js:281:20)
2018-04-06T14:44:02.617Z pid:12620 worker:1 at setupDataSources (C:\Users\ASUS\Desktop\apis\inventory\node_modules\loopback-boot\lib\executor.js:181:3)
2018-04-06T14:44:02.795Z pid:10000 worker:0 ERROR supervisor worker id 1 (pid 12620) accidental exit with 1
(node:10000) [DEP0007] DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
此外,我已经检查了API Connect的预先要求:
node.js:v8.10.0
npm:v5.8.0
apiconnect:v5.0.8.2
Docker:
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:06:28 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:14:32 2018
OS/Arch: linux/amd64
Experimental: false
Docker-compose:
docker-compose version 1.20.1, build 5d8c71b2
docker-py version: 3.1.4
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
此外,我已将Docker设置设置为4096MB RAM,2CPU并与C:\ Drive共享。
我已经搜索并阅读了类似的问题,但没有弄清楚确切的问题在哪里。请帮忙!
答案 0 :(得分:0)
该错误表示应用程序无法连接到MySQL数据库。
如果您的数据库在本地计算机上运行,则需要更改连接字符串以访问Docker网关(通常为172.17.0.1)而不是localhost本身(这将是指向正在运行的docker容器的指针)。 / p>
如果MySQL正在其他地方运行,那么它可能已关闭,或者您遇到网络问题。
解决MySQL连接问题后,您的应用程序应该与其他组件一起启动。