Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6676779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:02:05+00:00 2026-05-26T04:02:05+00:00

I have a web application written in gwt, and I’m using a PostgreSQL database

  • 0

I have a web application written in gwt, and I’m using a PostgreSQL database in the back end. When I make a new session on the server, I set up c3p0 and get a jdbc connection:

ComboPooledDataSource source = new ComboPooledDataSource();
Properties connectionProps = new Properties();
connectionProps.put("user", "username");
connectionProps.put("password", "password");   
source.setProperties(connectionProps);
source.setJdbcUrl("some jdbc url that works");

and when I close my session on the server, I close the ComboPooledDataSource.

However… when I press the yellow “reload web server” button in GWT development mode and refresh my page, I get the following warning, and a bunch of subsequent errors preventing me from obtaining a database connection:

WARNING: A C3P0Registry mbean is already registered. This probably means that an application using c3p0 was undeployed, but not all PooledDataSources were closed prior to undeployment. This may lead to resource leaks over time. Please take care to close all PooledDataSources.

Which I assume means that reloading the web server didn’t close the ComboPooledDataSource I made (probably a safe assumption). Is there any way I can get it to do that so I can obtain a connection after reloading the web server?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:02:06+00:00Added an answer on May 26, 2026 at 4:02 am

    Closing dataSource generally (not only C3P0) is unadvisable because they should to be used from many applications on your server. If you kill this connection pool other can loose data access. In practice you shoud leave pool management to your container and use only JNDI.

    Anyway if you neet to ged rid of the warning in your GWT console use this method in your EventListener contextDestroyer:

    public abstract class YourListenerimplements EventListener {
        //Probably you initialize your dataSource here. I do it with Guice.
        @Override
        public void contextInitialized(ServletContextEvent servletContextEvent) {
            ...
        }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        try {
            connection = dataSource.getConnection(); //Your dataSource (I obtain it from Guice)
        } catch (SQLException ex) {
        } finally {
            try {
                if (connection != null) {
                    connection.close();
                }
                if (dataSource != null) {
                    try {
                        DataSources.destroy(dataSource);
                        dataSource = null;
                    } catch (Exception e) {
                    }
                }
            } catch (SQLException sQLException) {
                XLog.error(sQLException);
            }
        }
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net web application written in C# using a SQL Server 2008
In a web application written in Perl and using PostgreSQL the users have username
I have web application written in java using Eclipse. It has just one servlet
I have a web application written using CherryPy, which is run locally on 127.0.0.1:4321
I have a web application, written in ColdFusion, which periodically starts using 100% of
I have a web application written in PHP using MySQL that I would like
We have a web application that uses SQL Server 2008 as the database. Our
We have a web application written in ASP.NET for .NET 3.5, using standard web
I have a web application written in ASP .NET MVC 3. I'm using ACS
I am new to web serivce. I have written a few clients using AXIS2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.