Link to home
Start Free TrialLog in
Avatar of ashishanand
ashishanandFlag for Singapore

asked on

JBOSS/Tomcat --Listener refused connection

When I call a JSP/Servlet deployed in JBOSS/Tomcat , I encounter the following error. The JSP/Servlet connects to Oracle 10g Express Edition installed locally. The error is not consistant.

      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
      at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:420)
      at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
      at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
      at java.sql.DriverManager.getConnection(DriverManager.java:525)
      at java.sql.DriverManager.getConnection(DriverManager.java:171)
      at org.apache.jsp.jsp.templateView_jsp._jspService(templateView_jsp.java:65)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)



Browser error

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
10.0.0.67:1521:XE

      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


root cause

javax.servlet.ServletException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
10.0.0.67:1521:XE

      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
      org.apache.jsp.jsp.templateView_jsp._jspService(templateView_jsp.java:305)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


root cause

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:
10.0.0.67:1521:XE

      oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
      oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
      oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:420)
      oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
      oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
      oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
      java.sql.DriverManager.getConnection(DriverManager.java:525)
      java.sql.DriverManager.getConnection(DriverManager.java:171)
      org.apache.jsp.jsp.templateView_jsp._jspService(templateView_jsp.java:65)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.


Any help is appreciated.

Regards,
Avatar of rama_krishna580
rama_krishna580
Flag of United States of America image

Hi,

Keep all dependency jar files in the classpath, like database jars etc...
make sure all the settings are setup properly, restart the server(s), and test it.

R.K
Avatar of KnightFire
KnightFire

It looks like the exception is being thrown during the process of logging on to to the database, so check (and doblecheck) that a valid set of credentials is being used to perform the log on., and that the users have 'connect' access to the schema that they are trying to connect to.
What type of driver are you using?  Are you using a Type IV thin driver?
Avatar of ashishanand

ASKER

Hii Daveyess,

We are using ojdbc14.jar driver for oracle 10g.

Any help is appreciated.

Regards,
Change the username and/or password that you use to connect to the DB to an invalid one. Do you get a different exception?
Hi,

As suggested above, we have checked the settings, username/password, jsbc driver, etc. Ever thought everything seems to be in place, we still have this problem.

Regards,
If I change the "PROCESSES" setting on the oracle database server, it minimizes the frequency of the error. However, it does not stop from happening.

I used the following command to do so:

ALTER SYSTEM SET PROCESSES=250 SCOPE=SPFILE

I believe by increasing the value of PROCESSES it would further minimize it however, I'm concerned about any impact it would have on the database server.

Any suggestions

Regards,
Any advance on this problem? I have encountered the same issue with JBoss 4.0.4.GA and an Oracle RAC on our production environment only. Have tried adding connection checking to the oracle-xa-ds.xml config with no change, and I added min-pool-size to 5, and now the error changes to below:

10:14:21,022 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=XAOracleDS' to JNDI name 'java:XAOracleDS'
10:14:21,937 WARN  [JBossManagedConnectionPool] Unable to fill pool
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Io exception: Socket is not connected)
        at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:153)
        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:539)
        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.fillToMin(InternalManagedConnectionPool.java:486)
        at org.jboss.resource.connectionmanager.PoolFiller.run(PoolFiller.java:74)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Io exception: Socket is not connected
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:420)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
        at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:297)
        at oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:472)
        at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:159)
        at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:133)
        at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:145)
        ... 4 more
ashishanand - Did you get this issue resolved?
Yes, I was able to solve the problem, I used the following command to do so:

ALTER SYSTEM SET PROCESSES=250 SCOPE=SPFILE

After making the able changes, if you still get the error, I would suggest you further increase the PROCESSES to 500 or 1000 and see if it helps.

I initially set the PROCESSES to 250 and the error became less frequent. Next I changed it to 500 and after that I did not encounter any error.


PS:
I believe by increasing the value of PROCESSES it would further minimize it however, I'm concerned about any impact it would have on the database server's performance.

Any one, any comments.


Regards,
It looks like this is probably the fix for the problem.

I believe that you are getting the error about being unable to fill the connection pool if Oracle cannot provide enough connections to service all the applications connected to it - not just JBoss.

So, when you increased the number of processes to 250 the problem initially vanished.  I would guess that there are other users/applications using your Oracle server and the total number of connections exceeded 250.  When a connection was then thrown out of the JBoss pool and JBoss tried to acquire another connection, it failed with the reported error message.

Given that you ar erunning Oracle 10 Express, its probably worth checking the oracle documentation to see how many process it can handle for a given server configuration.  Also, make sure that your min and max pool sizes in JBoss are reasonable.  Depending on the size of the application, a small pool size of about 10 may suffice.
Max pool size is 20 on 2 JBoss servers in my cluster and our Oracle RAC PROCESSES are set to 500, with only about 12 used.

The socket connection error still occurs, randomly but too frequently for a production environment. Any more ideas?

Regards...
ASKER CERTIFIED SOLUTION
Avatar of AnnieMod
AnnieMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial