我目前正在创建一个Worklight应用程序,它从我的计算机的MySQL数据库中检索一些数据。
当我尝试运行应用程序时,它无法连接到数据库。当我将数据库的URL更改为IP地址(192.168.6.1(我的计算机的本地主机))时,会发生错误。
当我通过调用worklight过程(地址是localhost)从我的计算机上测试它时它工作正常,但当我将URL更改为IP地址时,它显示错误:
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.). [project BarcodeScannerSample]
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[WARNING ] FWLSE0082W: Failed to deploy adapter. This may be due to a JavaScript error in your adapter implementation (archive: 'C:\Users\stephen\AppData\Local\Temp\loginAdapter7158962596204999276.adapter'). [project mywatermelon]
The 'adapter' version '6.1.0.00.20131219-1900' is different than the version of Worklight Server '6.0.0'.
Use Worklight Studio '6.0.0' to build and deploy the application.
[WARNING ] FWLSE0082W: Failed to deploy adapter. This may be due to a JavaScript error in your adapter implementation (archive: 'C:\Users\stephen\AppData\Local\Temp\myRESTAdapter36508485292314915.adapter'). [project mywatermelon]
The 'adapter' version '6.1.0.00.20131219-1900' is different than the version of Worklight Server '6.0.0'.
Use Worklight Studio '6.0.0' to build and deploy the application.
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
以下是适配器XML的连接设置:
<?xml version="1.0" encoding="UTF-8"?>
...
...
<connectivity>
<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<!-- Example for using a JNDI data source, replace with actual data source name -->
<!-- <dataSourceJNDIName>java:/data-source-jndi-name</dataSourceJNDIName> -->
<!-- Example for using MySQL connector, do not forget to put the MySQL connector library in the project's lib folder -->
<dataSourceDefinition>
<driverClass>com.mysql.jdbc.Driver</driverClass>
<url>jdbc:mysql://192.168.6.1:3306/barcode</url>
<user>root</user>
<password>170693</password>
</dataSourceDefinition>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="5" />
</connectivity>
...
...
</wl:adapter>
答案 0 :(得分:2)
我不知道您正在使用哪个数据库前端,但您需要转到用户创建/权限屏幕,并确保您已授予用户“root”权限以连接到{{1} }和localhost
(全部),以便接受IP地址。
例如:%
而不是/ root@%
。