yz3162611 2009-04-14 10:28
浏览 1833
已采纳

JDBC连接oracle 出问题:Listener refused the connection!

我现在在做一个小项目,环境是MYECLIPS6+TOMCAT5+ORACLE10g
当我在页面浏览时,总出现间接性的数据库连接错误,郁闷了很久。。

下面是MYECLIPSE中报的错误:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
192.168.133.250:1521:oracle

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:279)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:318)
at oracle.jdbc.driver.PhysicalConnection. (PhysicalConnection.java:343)
at oracle.jdbc.driver.T4CConnection. (T4CConnection.java:147)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.zjsoft.zjsj.util.Database.getConnection(Database.java:59)
at org.zjsoft.zjsj.util.Database.getPreparedStatement(Database.java:79)
at org.zjsoft.zjsj.dao.impl.DepartmentDAOImpl.getDepartmentByID(DepartmentDAOImpl.java:41)
at org.zjsoft.zjsj.dao.impl.ApplyTypeDAOImpl.setData(ApplyTypeDAOImpl.java:104)
at org.zjsoft.zjsj.dao.impl.ApplyTypeDAOImpl.getApplyTypeByID(ApplyTypeDAOImpl.java:25)
at org.zjsoft.zjsj.dao.impl.ApplyDAOImpl.setDataList(ApplyDAOImpl.java:151)
at org.zjsoft.zjsj.dao.impl.ApplyDAOImpl.listApplyByStatus(ApplyDAOImpl.java:36)
at org.zjsoft.zjsj.servlet.accepter.AcceptStatusServlet.doPost(AcceptStatusServlet.java:42)
at org.zjsoft.zjsj.servlet.accepter.AcceptStatusServlet.doGet(AcceptStatusServlet.java:24)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.zjsoft.zjsj.filter.EncodingFilter.doFilter(EncodingFilter.java:25)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)

下面是我浏览器上显示的错误:
java.lang.NullPointerException
org.zjsoft.zjsj.util.Database.getPreparedStatement(Database.java:81)
org.zjsoft.zjsj.dao.impl.DepartmentDAOImpl.getDepartmentByID(DepartmentDAOImpl.java:41)
org.zjsoft.zjsj.dao.impl.ApplyTypeDAOImpl.setData(ApplyTypeDAOImpl.java:104)
org.zjsoft.zjsj.dao.impl.ApplyTypeDAOImpl.getApplyTypeByID(ApplyTypeDAOImpl.java:25)
org.zjsoft.zjsj.dao.impl.ApplyDAOImpl.setDataList(ApplyDAOImpl.java:151)
org.zjsoft.zjsj.dao.impl.ApplyDAOImpl.listApplyByStatus(ApplyDAOImpl.java:36)
org.zjsoft.zjsj.servlet.accepter.AcceptStatusServlet.doPost(AcceptStatusServlet.java:42)
org.zjsoft.zjsj.servlet.accepter.AcceptStatusServlet.doGet(AcceptStatusServlet.java:24)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.zjsoft.zjsj.filter.EncodingFilter.doFilter(EncodingFilter.java:25)

org.zjsoft.zjsj.util.Database.getPreparedStatement(Database.java:81)代码如下:
private Connection getConnection() {
Connection connection = null;
try {
Class.forName(DBDRIVER); // 加载数据库驱动类
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
connection = DriverManager.getConnection(DBURL, USER, PASSWORD); } catch (SQLException e) {
e.printStackTrace();
}
return connection;
}

[b]问题补充:[/b]
项目都做了这么久了 不可能再改数据库了 修改连接试了下

连接数已经改为300了 但还是出现那个错误啊

  • 写回答

8条回答 默认 最新

  • qq_123 2009-04-14 10:45
    关注

    可能是数据库上当前的连接数目已经超过了它能够处理的最大值.

    selectcount(*)fromv$process--当前的连接数
    selectvaluefromv$parameterwherename='processes'--数据库允许的最大连接数

    修改最大连接数:
    altersystemsetprocesses=300scope=spfile;

    重启数据库:
    shutdownimmediate;
    startup;

    --查看当前有哪些用户正在使用数据
    SELECTosuser, a.username,cpu_time/executions/1000000||'s', sql_fulltext,machine
    fromv$session a, v$sqlarea b
    wherea.sql_address=b.addressorderbycpu_time/executionsdesc;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥200 如何使用postGis实现最短领规划?
  • ¥15 pyinstaller打包错误
  • ¥20 cesm的气溶胶排放文件
  • ¥15 逐月累计,月份不连续,补齐月份
  • ¥15 应用简单的Python代码完成一个学生成绩管理系统
  • ¥15 用matlab求微分方程初值问题
  • ¥15 vscode下编写第三方库opencv与pcl代码时没有代码提示
  • ¥15 能够跑通不报错,如何解决?(标签-matlab)
  • ¥15 MOS在RDS较大,频率高时开关波形异常
  • ¥15 SCENIC分析报错求解答