Skip to main content

Glassfish and MySQL - Connection Issue

Hi all

I recently downloaded the new Netbeans 6.1 including the Glassfish v2 package to replace my previous versions. Once I moved my application to the new platform I had to temporarily deploy the application database from Oracle to MySQL to test on my local machine. My application is built on JavaEE and for the persitence layer I am making use of data access objects (using Toplink) fronted by a set of session beans. After porting the database for testing I started getting the following error:

Internal Exception: java.sql.SQLException: Error in allocation a connection. Cause: No PasswordCredential found

This problem doesn't occur during development within Netbeans (hence all jdbc resources and Persistence units work fine from within netbeans) but occurs on deployment on Glassfish.

From some google searches i found that this problem existed for some time with previous versions but still exists with the latest installation of Netbeans/Glassfish including a bundled MySQL. A solution for this problem is to add the password property manually on the glassfish server -> jdbc -> database connection pools from the Administration Console. Once this is done the error will disappear. To test that this problem exists you can try to ping the database from the msqlpool Administration screen and you notice that on installation the ping gives this error.

Although its a small thing I believe that with the new Netbeans 6.1/Glassfish v2/MySQL bundle Sun can fix this setting by default and hence save some debugging time! 

Comments

Spasulato said…
THANK YOU MAN!
GRAZIE CIAO :)
Anonymous said…
It was rather interesting for me to read the post. Thanx for it. I like such topics and everything that is connected to them. I would like to read more soon.
Anonymous said…
tambien hay que editar el archivo sun-resources.xml que esta dentro del proyecto de netbeans alli dentro estan el usuario y password entre otras cosas.
esto es util cuando cambiamos el password de nuestra base de datos y estamos en mode de desarrollo. pero si es para produccion debemos configurar estos parametros en el servidor glassfish en la seccion jdbc pool de conexiones

Popular posts from this blog

Interfacing C# .Net and R - Integrating the best of both worlds

In specific software areas like in quantitative finance or else in other mathematical domains, data centric programming typically requires a good balance between three requirements - (1) a solid platform with rich mathematical/statistical functionality (2) having an easy to use, contemporary, programming environment which permits easy and flexible front end code development and (3) an easy to use interface between the two environments. In this artcile I am going to explain how such a balance can be attained by using two of the best products in their specific worlds - using the rich R library as the mathematical/statistical component but then interfacing with C# for the front end application design. As an interfacing option I banked on using R (D)COM which provides an easy to use interfacing method which keeps you away from spending hours identifying interfacing problems. The software required for this tutorial is the following: 1. R software ( download from here ) 2. R (D)COM In...

Interfacing C# .Net and R - Integrating the best of both worlds (Part 2)

This post is a continuation from the previous post ( Part I ) focusing on interfacing C# with R using the R (D)COM. In this post I am going to enhance my previous exercise by creating a Facade .Net Class which facilitates access to specific functions in R. Creating the R Facade Class Creating a Facade Class (or a set of .Net classes) which acts as a .Net wrapper to R functions greatly facilitate the use of R functions and their integration within the .Net programming environment. Below I am showing an excerpt from the class RFacade that I have created in this example. using System; using System.Collections.Generic; using System.Linq; using System.Text; using StatConnectorCommonLib; using STATCONNECTORSRVLib; using System.Runtime.InteropServices; namespace R { class RFacade : IDisposable {      private StatConnector rconn;      private bool disposed = false;      public RFacade()    ...

Interfacing C# .Net and R - Integrating the best of both worlds (Part 3) - Trader Desk Example

In this third and final part of the series ( Part 1 , Part 2 ), I am going to continue shaping the examples in the previous posts by quickly building a small application - a simple Trading Desk application. In the example I will use the same C# and R interface method together with a specific Quantitative Financial Modelling R library called Quantmod . Example Objective In the example the objective is to build a C# Web Form which acts as the main application controller that captures various user option parameters with the main functions being: 1. To automatically kick off an R routine to download data from Yahoo Finance. 2. To select specific dates of interest 3. To add or udpate different charts 4. To add different chart indicators 5. To calculate Period Return Statistics Most of these functions are provided through the set of R functions exposed by the Quantmod R library. Additions under the hood Below I am showing some of the salient additions done to the code over and abov...