Introduction
Are you getting logon denied error while starting or deploying your Spring Boot application into Pivotal Cloud Foundry (PCF) cloud environment? Generally, logon denied error occurs while your application is trying to connect to database server. The error you get in your application log is similar to the following error:
Java.sql.SQLException: ORA-01017 : invalid username/password; logon denied
From the above error message it is clear that the application is trying to make connection to the Oracle database and unable to establish connection to the datbase.
To see the above error, you can find in your application’s log file. The Logs menu can be found on the left side of your application page.
From the application UI (User Interface), you will get the equivalent error message as “Internal Server Error” with HTTP status code 50x, because end users are not expected to see the technical errors which are meant for only developers.
To fix this error you need to update your in environment variables section with Oracle database’s credentials which you have set for your Spring boot application. In your local or development environment you generally set it in the application.properties file as a spring datasource.
On PCF home page, click on the appropriate item name under Orgs -> Org Name. Then click on appropriate item name under Spaces. Next click on the appropriate App name under Apps. Then click on Settings from left menu.
Click on REVEAL USER PROVIDED ENV VARS.
Now you will find the page like the following image.
Now you can verify the value of your corresponding key, specially, the spring.datasource.password
, spring.datasource.username
and spring.datasource.url
. Once you update these values appropriately, you would be able to connect to the database.
Finally, you need to restart your application to reflect the changes. To restart the container, click on the restart button or icon as highlighted in the following image:
That’s all about how to update database credentials for Spring Boot application in PCF cloud.