---
title: "Hibernate在Resin下部署多个c3p0数据源"
author: "meiping"
date: "2011-03-11T17:22:13Z"
tags: ["Hibernate", "Spring"]
categories: ["编程语言"]
slug: "hibernate-resin-c3p0"
draft: false
lastmod: "2011-03-11T17:22:13Z"
id: 954215
url: "https://meiping.iteye.com/blog/954215"
---

环境：

resin3.x

hibernate3

c3p0-0.9.1

 

单纯的使用hibernate，没有spring来配合，如果同一个resin下配置了多个c3p0连接池，则会报错，错误信息如下：

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

 

**解决的方法是在hibernate的配置文件中给session-factory取各不相同的名称**