วิธีแก้ไขปัญหาแหล่งข้อมูล open liberty

แอปพลิเคชัน Open Liberty ของฉันไม่ได้เชื่อมต่อกับฐานข้อมูล ฉันจะแก้ไขการตั้งค่าการเชื่อมต่อได้อย่างไร

ตัวอย่างเช่นการเชื่อมต่อล้มเหลวด้วย:


[INFO] Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
[INFO] Internal Exception: java.sql.SQLException: The server requested password-based authentication, but no password was provided. DSRA0010E: SQL State = 08004, Error Code = 0
[INFO] Error Code: 0

person Ich    schedule 29.06.2021    source แหล่งที่มา


คำตอบ (1)


ความคิดเห็นจาก Scott Kurz ยอดเยี่ยมมาก มันควรจะได้รับโพสต์ของตัวเอง:

หากคุณต้องการตรวจสอบว่าการกำหนดค่าเซิร์ฟเวอร์ Liberty เป็นสิ่งที่คุณคาดหวังจริงหรือไม่:

ดูบล็อกนี้: https://openliberty.io/blog/2019/09/13/testing-database-connections-REST-APIs.html

คุณต้องการ

<feature>restConnector-2.0</feature> 

และผู้ใช้ที่เป็นผู้ดูแลระบบ (หากคุณไม่มี) เช่น

<quickStartSecurity userName="Bob" userPassword="bobpwd" /> 

ตอนนี้คุณสามารถดู DB-config ของคุณได้แล้ว: http://localhost:9080/ibm/api/config/dataSource/todoListDS

สำหรับ postgres ควรมีลักษณะดังนี้:

{
   "configElementName": "dataSource",
   "uid": "jpadatasource",
   "id": "jpadatasource",
   "jndiName": "jpadatasource",
   "beginTranForResultSetScrollingAPIs": true,
   "beginTranForVendorAPIs": true,
   "connectionSharing": "MatchOriginalRequest",
   "enableConnectionCasting": false,
   "jdbcDriverRef": {
      "configElementName": "jdbcDriver",
      "uid": "dataSource[jpadatasource]/jdbcDriver[default-0]",
      "libraryRef": {
         "configElementName": "library",
         "uid": "postgresql-driver",
         "id": "postgresql-driver",
         "apiTypeVisibility": "spec,ibm-api,api,stable",
         "filesetRef": [
            {
               "configElementName": "fileset",
               "uid": "library[postgresql-driver]/fileset[default-0]",
               "caseSensitive": true,
               "dir": "/Users/d067570/SAPDevelop/gh/ciaas/api/target/liberty/wlp/usr/shared/resources/",
               "excludes": "",
               "includes": "postgresql-*.jar",
               "scanInterval": 0
            }
         ]
      }
   },
   "statementCacheSize": 10,
   "syncQueryTimeoutWithTransactionTimeout": false,
   "transactional": true,
   "properties.postgresql": {
      "databaseName": "postgres",
      "password": "******",
      "portNumber": 5432,
      "preparedStatementCacheQueries": 0,
      "serverName": "localhost",
      "user": "postgres"
   },
   "api": [
      "/ibm/api/validation/dataSource/jpadatasource"
   ]
}
person Ich    schedule 29.06.2021