show connection URL in tomcat - mysql

I have a webapp on tomcat that keeps not being able to connect to a MySQL database and I don't have the source code for it. Is there a way to see the URL that it is trying to connect to? The exception trace just says communications error and it's not very helpful at all.

If you're lucky it will be defined in META-INF/context.xml, in a Resource element.

Related

SQLException when deploying ASP.NET Boilerplate application to Azure

I've been trying to deploy an ASP.NET Boilerplate application to Azure for the last couple of days and I haven't been able to do so. I keep stumbling upon this error:
First I make a Web App + SQL resource and then publish my project to it from inside Visual Studio using the right click -> deploy option, and then importing the publication profile I got from Azure. I make sure the database connection string in the appsettings.production.json are correct but I can't seem to connect to the database. If I try to connect to the database through the SQL Server Management Studio I get a similar error. This means something is wrong with the database itself.
Do I need to create a separate SQL database in Azure that makes use of the SQL database server that comes with the Web App + MySQL resource?
Any help would be greatly appreciated! I have been spending way too much time on this problem already.
This is a screenshot of all the resources in the Azure portal, these were created while creating the Web app + MySQL resource:
Edit: This is the error I am getting:
Win32Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Unknown location SqlException: 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: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) Microsoft.Data.ProviderBase.DbConnectionPool.CheckPoolBlockingPeriod(Exception e) InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call. Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute<TState, TResult>(TState state, Func<DbContext, TState, TResult> operation, Func<DbContext, TState, ExecutionResult<TResult>> verifySucceeded) Win32Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Since you mentioned you can't access db in any other way, I provided step-by-step instruction
You can get your connection string from Azure resource panel
Navigate to Connection security tab and enable access from other Azure resources. This way WebApp will be able access database server inside Azure network. I also added my client IP to test db connection from my PC later. Click Save at the top when you are done
On the same page there is setting called configure SSL connection. Certificate can be downloaded from https://learn.microsoft.com/uk-ua/azure/mysql/howto-configure-ssl. I used this file https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem . Optionally, you could disable this feature for now.
Now we have everything to test db connection. I will show it with the use of HeidiSQL client.
Click open and see your databases
According to this you need to have CACertificateFile parameter appended to connection string to use SSL, so you need to put file into repository and provide its relative path in connection string
This was all caused by a stupid mistake, in the Azure portal I selected the Web App + MySQL resource instead of the Web App + SQL resource. For the ASP.NET Boilerplate project I am using you need a Web App + SQL resource.

WebLogic Bridge Message: "Failure of Web Server bridge: No backend server available for connection..."

I have an application (packaged software from a vendor) that runs on Oracle WebLogic.
There are few operations that, if I try them, I consistently get the following error page:
(WebLogic Bridge Message) Failure of Web Server bridge: No backend server available for connection: timed out after 10 seconds or idempotent set to OFF or method not idempotent.
The error occurs consistently almost exactly five minutes after I try the operation.
The page does not look like the typical error page you get when the application logic fails. It looks like something to do with the infrastructure (e.g., WebLogic configuration).
I am pursuing the issue with the software vendor, but that's not going well.
Has anyone seen this message and/or suggest an approach for diagnosing the root cause here?
Looks like you are using a Proxy Server between Browser and Weblogic Server. By seeing the error it's evident that proxy server unable to connect to back-end WLS server. You may have to enable proxy debugs to get more info.

A Hosted Spring MVC and mySql Application Sometimes Generates Server Disconnection Error

I developed a spring MVC application that interacts with mySql and when I was satisfied that it was working 100% of the time locally on my own computer I put it online using a hosting service. However, I've had nothing but problems and am trying to work out if the source is my code or a problem with the host.
Sometimes my application works fine, and at other times I get a http status 500 internal server error so that would lead me to believe that the problem is with the host and not my application.
Unfortuneatly the error is saved as a pdf that I can't upload to your site but it says the problem is:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: communications link failure
Please note that on this hosting site I have my own private tomcat server. Also, I use connection pooling to connect to the database.
Any help would be appreciated.
Sorry, I also get the following error message at the bottom of the error 500 page:
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost

Can't attach MySQL database with my web application

I am using the vmc tool to upload my web application to cloudfoundry. I have pushed my web aplication and created service to bind with. But I am getting a problem in tunneling it. I want to connect my database stored in backup file in my system with my web application. Here is the image where I entered the commands:
I am having an error about path. I don't know how to resolve this. Please let me know how I should attach my databse with my web application.
What the error is saying is that you need to have MySQL client on your build path. Caldecott (the application which gets executed when you type vmc tunnel) uses your own client for either MySQL, Postgres or Redis. If you do not have MySQL client installed or if you do not have it defined in your PATH environment variable, you will get this error.
This is probably not it but there's a space in your password string in the screenshot provided.
Besides that it seems that this error may be generated if the "build path" used for connecting to the database is incorrect. Manually check if the tunnel to the database works fine with those credentials and/or check to see if VMC can access other databases.

Flex/Air : Flex, BlazeDS, Hibernate (Tomcat) and MySQL

I create a Flex application that works with a browser using a database with the MySQL server that I can create, modify and delete data from a database.
The problem I encounter now is that I want to see my program with Adobe AIR (virtual machine). At the display that does not pose a problem. The problem is that air can not reach the database server is located in the MySQ. the error message displayed is as follows:
"Error : client.Error.MessageSend - Channel.connect.failed error NetConnection.Call.Failled : HTTP: Status 404:url:'http://xxx.swf/xxx/messagebroker/amf' - Send failed"
Thank you kindly explain to me why I obtain this error? and why do I get to work with the browser but not with AIR? and do work well with AIR application "Client - Server"?
I await your answers or comments with pleasure
It would be best to have some service on the server-side to serve as a facade to database operations. Thus:
you will work with a limited interface from your flex client
you won't need to store DB credentials on the client (this is security flaw - anyone can connect to your database and drop anything)
you won't need special firewall permissions (or mysql port configurations) for your clients - most servers don't allow external parties to connect to port 3306
You can use BlazeDS for that, or you can create your own solution, if the case is simple enough (I actually didn't like the way BlazeDS handles stuff when I had to make this choice a while ago)
The exception you are getting is actually in the AMF broker messaging rather than any of the other technologies. Check whether the URL shown in the message really returns 404.
If you are getting a 404 error then your BlazeDS servlet is not running. Make sure you didn't get any errors when you started Tomcat.