JSF webApplication - glassfish server server encountered an internal error - mysql

in brief:
[Problem in glassfish Admin console when I try to Create a new JDBC Connection Pools]
can someone help me please solve this problem :
firstly, I want to develop a JSF application on Netbeans IDE 8.1
when I fill the page of creating a new JDBC Connection Pools glassfish console throws this Exception :
type : Exception report
message :Internal Server Error
description : The server encountered an internal error that prevented it from fulfilling this request.
exception :
java.lang.IllegalStateException: getOutputStream() has already been called for this response
note : The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1.1 logs.
see this pictures for more informations :
glassfish Admin console
domain.XML

I found a solution to my problem in this tutorial :
https://netbeans.org/kb/docs/javaee/javaee-gettingstarted-pf-screencast.html

Related

Datasource 'ds-mysql' is not available when using Service Activity Monitoring in Apache Karaf

I am a beginner in Apache Karaf, I deployed a Soap Webservice in Apache Karaf container (I use Talend Runtime), and I installed the SAM server with the following steps :
I installed MySql Driver with : bundle:install mvn:mysql/mysql-connector-java/8.0.27
I added the datasource with : feature:install tesb-datasource-mysql
I launched the the sam server with : tesb:start-sam
I configured the files org.talend.esb.sam.server.cfg as :
db.datasource=ds-mysql
db.dialect=mysqlDialect
I configured the file org.talend.esb.datasource.mysql.cfg as :
datasource.url=jdbc:mysql://localhost:3306/mydb
datasource.username=myusername
datasource.password=mypassword
datasource.pool.maxActive=20
datasource.pool.maxIdle=5
datasource.pool.maxWait=30000
I restarted karaf and requested WebService, I am getting this error in the logs :
org.springframework.dao.DataAccessResourceFailureException: Could not obtain last_insert_id(); nested exception is java.sql.SQLException: Datasource 'ds-mysql' is not available
The webservice works fine and my database is available but I can't get the SAM service to work, I spent many hours in internet without finding a clue.
Am I missing a step ?
Thanks in advance,

UWP MySQL error : Unable to connect to any of the specified MySQL hosts

This simple code shows an error in a UWP application : MySql.Data.MySqlClient.MySqlException: 'Unable to connect to any of the specified MySQL hosts.'
using MySql.Data.MySqlClient;
string connString = "Server=serverName; Uid=user; Password=password; Database=db; SslMode=none";
MySqlConnection conn = new MySqlConnection(connString);
conn.Open();
Console.WriteLine($"Mysql version : {conn.ServerVersion}");
conn.Close();
The problem is that exact same code works perfectly fine when creating a Console app with .net framework 4.8, and also a console app built in .net Core 5 or 6.
Do you have any idea of what may causes this error message in UWP ?
Edit : no matter which sql connector is used, the result is always the same.
Edit 2 : server is another computer, located on the same lan.
If you are connecting to the localhost, please make sure Enabling loopback for a UWP application in your device. UWP apps have limitations because it's running in the sandbox, so if you want to connect to the local host, it is necessary to enable the local loopback for your device.

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

show connection URL in tomcat

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.

How to deploy Lightswitch app connecting to MySql Database

I have a simple (no authentication yet) Lightswitch VS 2012 app. That on my local computer connects to a mysql database (the database is hosted by my hosting company). All works well.
I then 'publish' this app to my local IIS server, and copy all that to my hosting companies server.
It mostly works, except the WCF service won't work. Upon connecting to the WCF service directly (the .svc file) I get a 'request error'. The stack trace in the Trace.axd is as follows
[Microsoft.LightSwitch.DataService][Application:Error][LightSwitchServiceApplication.vinyldyeData:CreateObjectContext] An exception has occurred: System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at LightSwitchApplication.Implementation.vinyldyeDataServiceImplementation.CreateObjectContext()
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.get_ObjectContext()
It looked as though the hosting company just doesn't have the MySQL Connector in the GAC, so i've added this into the bin folder, still get the same error.
I've looked in the Web.configs, and there is no mention of mysql connector, how does the app know which connector to use?
Have you deployed a Lightswitch app to a host using mysql? if so what files am i missing, or config option.
thanks
Since you've already added the MySQL Connector (I assume 6.4.4) DLLs to the bin folder, refer to this post. Worked for me.