created a default Jhipster app, followed the Jhipster Deploying to Cloud Foundry instructions, PCF created the service just fine, the application Started fine, but will not accept the admin/admin login, I queried the service database using , I see the admin entry (admin $2a$10$gSAhZrxMllrbgj/kkK9Uce...) I even tried using the password for giggles. But the app will not authenticate the admin, or user Account, what am I missing ?
I checked PCF / Web Service App Logs and found:
org.springframework.orm.jpa.JpaSystemException: Unable to commit against JDBC Connection; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection
2019-03-04T16:01:34.944-07:00 [APP/PROC/WEB/0] [OUT] 2019-03-04 23:01:34.937 ERROR 14 --- [nio-8080-exec-4] o.s.b.w.servlet.support.ErrorPageFilter : Forwarding to error page from request [/api/account] due to exception [Unable to commit against JDBC Connection; nested exception is org.hibernate.TransactionException: Unable to commit against JDBC Connection]
Not sure where this will take me, so what am I missing ?
Related
I have a webapp running in Azure. It uses a Azure MSSQL database set to Standard S0: 10 DTUs performance. The backend is written in dot net core 3.1. The app works fine when I visit it.
Checking my logs I found a few of these, they happen weeks apart at odd times.
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)
This error has me wondering if some random user is unable to access the site because the SQL server won't respond.
Any suggestions as to what this might be about?
Or suggestions as to what I should try doing?
Update 1: As a response to comment regarding retry. I actually have implemented retry on the connection (.net core entity framework) using this code.
services.AddDbContext<ApplicationDbContext>(
options =>
{
options.UseSqlServer(connectionString, sqlOptions =>
{
sqlOptions.EnableRetryOnFailure(
maxRetryCount: 10,
maxRetryDelay: TimeSpan.FromSeconds(10),
errorNumbersToAdd: null
);
});
options.EnableSensitiveDataLogging(true);
},
ServiceLifetime.Transient
);
I'm trying to report Node.js errors to Google Error Reporting, from one of our kubernetes deployments running on a GCP/GKE cluster with RBAC. (i.e. permissions defined in a service account associated to the cluster)
const googleCloud = require('#google-cloud/error-reporting');
const googleCloudErrorReporting = new googleCloud.ErrorReporting();
googleCloudErrorReporting.report('[test] dummy error message');
This works only in certain environments:
it works when run on my laptop, using a service account that has the "Errors Writer" role
it works when running in my cluster as a K8S job, after having added the "Errors Writer" role to that cluster's service account
it causes the following error when called from my Node.js application running in one of my K8S deployments:
ERROR:#google-cloud/error-reporting: Encountered an error while attempting to transmit an error to the Stackdriver Error Reporting API.
Error: Request had insufficient authentication scopes.
It feels like the job did pick up the permission changes of the cluster's service account, whereas my deployment did not.
I did try to re-create the deployment to make it refresh its auth token, but the error is still happening...
Any ideas?
UPDATE: I ended up following Jérémie Girault's suggestion: create a service account and bind it to my deployment. It works!
The error message has to do with the access scopes set on the cluster when using the default service account. You must enable access to the appropriate API.
As you mentioned, creating a separate service account, providing it the appropriate IAM permissions and linking it to your cluster or workload will bypass this error as well.
A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable) - occurs intermittently, using hybrid connector to connect to on-premise database from Azure API
I try connecting to SQL database in on-premise sever from app service resource (Web API). Configured classic hybrid connection end point to on-premise db.
Root Cause :
In SQL database, there is a property 'Auto Close' in Options tab, which is set to TRUE by default.
When Azure Service(API) establishes connection to SQL server. Azure tries to maintain the same connection pool and try to reuse and reconnect to it.
As we have set 'Auto Close as TRUE', the SQL database clears the existing connection after sometime. Whereas Azure tries to reconnect with the earlier connection which has already been cleared by SQL database. This results in 'Physical Connection is not usable - error 19'.
SOLUTION:
In SQL db, go to database properties. Navigate to 'OPTIONS' page and expand automatic tab and set 'AUTO CLOSE' property as 'FALSE'.
Make sure you restart Azure app and your database server to ensure no old connections are used.
PROBLEM SOLVED.
NOTE : This is one of the reason (which happened to me).
Another useful method to get rid of this error is to use RETRY LOGIC of Entity Framework 1.1.0
services.AddDbContext<DbContext>(options => options.UseSqlServer('yourconnectionstring',
sqlServerOptionsAction: sqlOptions =>
{
sqlOptions.EnableRetryOnFailure(
maxRetryCount: 5,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: new List<int>() { 19 });
}));
In Retry logic, error 19 is not included. So you have to pass the error code 19 to set retry logic for error code 19.
It seems you need to add a retry logic to your Web API as explained here. The "Physical connection is not usable" error may be caused by transient errors as explained on this Microsoft documentation.
"Transient fault errors typically manifest as one of the following error messages from your client programs:+
•Database on server is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of
•Database on server is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of . (Microsoft SQL Server, Error: 40613)
•An existing connection was forcibly closed by the remote host.
•System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
•An connection attempt to a secondary database failed because the database is in the process of reconfguration and it is busy applying new pages while in the middle of an active transation on the primary database."
I have a jHipster generated Gateway which is in the process of being deployed to Cloud Foundry. The registry has been deployed and is up and running.
Upon firing jhipster cloudfoundry from commandline, and at the time of instance startup in cloud, I see the error below:
017-06-24T09:43:36.568-04:00 [APP/0] [OUT] Caused by:
org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.cloud.CloudException: No unique service matching class javax.sql.DataSource found. Expected 1, found 0
The database definitions are provided in the Gateway-dev.yml file defined and accessible in the registry.
I have tried to follow the spring-music example in github, which details (in User provided Services section) how to create User defined Oracle service in Cloud Foundry but the same error persists.
Can someone please provide thoughts on how best to approach this or is there a working example that someone knows and can be git cloned?
Thanks!
In Azure CLI I was trying azure sql db to manage databases:
azure sql db create server1 db1 - works fine, creates the database
azure sql db show server1 db1 - fails with
Service Unavailable
Service Unavailable
HTTP Error 503. The service is unavailable.
azure sql db delete server1 db1 - fails with
Service Unavailable
Service Unavailable
HTTP Error 503. The service is unavailable.
I tried with intentionally mistaken server name, the result is as expected:
info: Executing command sql db show
Administrator password: *************
+ Getting SQL server databases
error: getaddrinfo ENOTFOUND <wrong server>.database.windows.net <wrong server>.database.windows.net:443
error: Error information has been recorded to .azure\azure.err
error: sql db show command failed
I wonder what would be the cause of 503. The service is unavailable error. Ideas?
I've encountered the same problem.
Apparently it's a known issue on the Azure CLI and they plan to fix it soon when they will rewrite the CLI.
https://github.com/Azure/azure-xplat-cli/issues/2090
As a work around you can try the Azure Power Shell commands.