多个项目使用同一个数据库

romeo2015 发布于 2016/01/14 16:48
阅读 710
收藏 0

@wenshao 你好,想跟你请教个问题:

我在使用多个项目访问同一个数据库时,启动第二个项目会报错。

2016-01-14 16:40:48
 [] [] [ERROR]-[Thread: localhost-startStop-1]-[com.alibaba.druid.pool.DruidDataSource.init()]: init datasource error, url: jdbc:postgresql://192.168.6.97:5432/project2
org.postgresql.util.PSQLException: 尝试连线已失败。
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:257)
	at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
	at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:159)
	at org.postgresql.Driver.makeConnection(Driver.java:416)
	at org.postgresql.Driver.connect(Driver.java:283)
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:148)
	at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:785)
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:142)
	at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:211)
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:142)
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1388)
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1442)
	at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:632)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:934)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:930)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:102)
	at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:80)
	at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:171)
	at com.jfinal.core.Config.startPlugins(Config.java:87)
	at com.jfinal.core.Config.configJFinal(Config.java:48)
	at com.jfinal.core.JFinal.init(JFinal.java:65)
	at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4574)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5193)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Illegal UTF-8 sequence: byte 2 of 2 byte sequence is not 10xxxxxx: -62
	at org.postgresql.core.UTF8Encoding.checkByte(UTF8Encoding.java:28)
	at org.postgresql.core.UTF8Encoding.decode(UTF8Encoding.java:103)
	at org.postgresql.core.PGStream.ReceiveString(PGStream.java:329)
	at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:424)
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:203)
	... 33 more



我使用的数据库是postgresql  ,请问如何配置 druid 能使得多个项目访问同一个数据库不报错。

加载中
0
classic_mystical
classic_mystical
 数据库的配置是什么
romeo2015
romeo2015
解决了 连接池配置问题 连接数配的太大了
返回顶部
顶部