-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: ORA-12519, TNS:no appropriate service handler found
PostPosted: Fri Mar 10, 2006 9:37 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
Hi,

Hibernate version:3.1

I get the following error when I run my code repeatedly.


java.sql.SQLException: Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found


Can anybody suggest why I am getting this error.
The same thing I can run happily in Postgres database.
Do we need to set any property through which oracle releases the connection object.

I found out that every time I run the code my connection pool size increases.

Code between sessionFactory.openSession() and session.close():
asketReqTO.setProductId(new Long(1002));
basketReqTO.setUserId(USER_NAME);
BasketRespTO basketRespTO = basketfacade.addToBasket(basketReqTO);
basketReqTO.setBasketRespTO(basketRespTO);

System.out.println("testRemoveBasket:: content of basket req "+basketReqTO);
basketfacade.saveBasket(basketReqTO);
IBasketDOMgr basketDAOMgr = (IBasketDOMgr)PersistenceService
.getDomainObjectMgr(IBasketDOMgr.class);
Object [] arr = new Long[2];
arr[0] = new Long(1002);
arr[1] = new Long(1005);
QryFactory qryFactory = new QryFactoryImpl();
CritQry crit = qryFactory.newCriteriaQuery(Basket.class);
List products = crit.add(Restrictions.and(Restrictions.eq("userid",USER_NAME),Restrictions.not(Restrictions.in("productid", arr)))).execute();
System.out.println("List size: "+products.size());
System.out.println("DB Contain "+basketDAOMgr.selectAll());
if(products != null) {
Iterator iter = products.iterator();
while(iter.hasNext()) {
Basket product = (Basket) iter.next();
System.out.println("Name of the product is ..."+product.getProductid());

}
}



Full stack trace of any exception that occurs:
2006-03-10 19:05:28,008 (org.hibernate.engine.QueryParameters) - parameters: [1]
2006-03-10 19:05:28,008 (org.hibernate.engine.QueryParameters) - named parameters: {}
2006-03-10 19:05:28,008 (org.hibernate.jdbc.AbstractBatcher) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-03-10 19:05:28,008 (org.hibernate.jdbc.ConnectionManager) - opening JDBC connection
2006-03-10 19:05:28,008 (org.hibernate.connection.DriverManagerConnectionProvider) - total checked-out connections: 27
2006-03-10 19:05:28,008 (org.hibernate.connection.DriverManagerConnectionProvider) - opening new JDBC connection
2006-03-10 19:05:28,024 (org.hibernate.connection.DriverManagerConnectionProvider) - created connection to: jdbc:oracle:thin:@192.168.150.122:1521:dna, Isolation Level: 2
2006-03-10 19:05:28,024 (org.hibernate.SQL) - select max(basket0_.itemno) as col_0_0_ from basket basket0_ where basket0_.basketid=?
2006-03-10 19:05:28,024 (org.hibernate.jdbc.AbstractBatcher) - preparing statement
2006-03-10 19:05:28,024 (org.hibernate.type.LongType) - binding '1' to parameter: 1
2006-03-10 19:05:28,024 (org.hibernate.jdbc.AbstractBatcher) - about to open ResultSet (open ResultSets: 0, globally: 0)
2006-03-10 19:05:28,024 (org.hibernate.loader.Loader) - processing result set
2006-03-10 19:05:28,024 (org.hibernate.loader.Loader) - result set row: 0
2006-03-10 19:05:28,024 (org.hibernate.loader.Loader) - result row:
2006-03-10 19:05:28,024 (org.hibernate.type.LongType) - returning '2' as column: col_0_0_
2006-03-10 19:05:28,024 (org.hibernate.loader.Loader) - done processing result set (1 rows)
2006-03-10 19:05:28,024 (org.hibernate.jdbc.AbstractBatcher) - about to close ResultSet (open ResultSets: 1, globally: 1)
2006-03-10 19:05:28,024 (org.hibernate.jdbc.AbstractBatcher) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-03-10 19:05:28,024 (org.hibernate.jdbc.AbstractBatcher) - closing statement
2006-03-10 19:05:28,024 (org.hibernate.engine.StatefulPersistenceContext) - initializing non-lazy collections
2006-03-10 19:05:28,024 (org.hibernate.jdbc.JDBCContext) - after autocommit
2006-03-10 19:05:28,024 (org.hibernate.jdbc.ConnectionManager) - aggressively releasing JDBC connection
2006-03-10 19:05:28,024 (org.hibernate.jdbc.ConnectionManager) - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2006-03-10 19:05:28,024 (org.hibernate.connection.DriverManagerConnectionProvider) - returning connection to pool, pool size: 1
[DEBUG] [NONE] # main # com.dnaO2.basket.dao.BasketDAO.<BasketDAO::getItemno> : Basket Id: 1 Item No: 3
[INFO] [NONE] # main # com.dnaO2.basket.bizsrv.BasketAppSrv.convertBasketBOtoBasketPojo : Enter...........
2006-03-10 19:05:28,024 (org.hibernate.jdbc.JDBCContext) - opening user JDBC connection, application must close it
2006-03-10 19:05:28,024 (org.hibernate.connection.DriverManagerConnectionProvider) - total checked-out connections: 27
2006-03-10 19:05:28,024 (org.hibernate.connection.DriverManagerConnectionProvider) - using pooled JDBC connection, pool size: 0
[DEBUG] [NONE] # main # com.dnaO2.infra.persistence.service.SrvLocatorImpl.getSession() : session.isConnected() :--> true
2006-03-10 19:05:28,024 (org.hibernate.transaction.JDBCTransaction) - begin
2006-03-10 19:05:28,024 (org.hibernate.jdbc.ConnectionManager) - opening JDBC connection
2006-03-10 19:05:28,024 (org.hibernate.connection.DriverManagerConnectionProvider) - total checked-out connections: 28
2006-03-10 19:05:28,024 (org.hibernate.connection.DriverManagerConnectionProvider) - opening new JDBC connection
2006-03-10 19:05:28,055 (org.hibernate.util.JDBCExceptionReporter) - Cannot open connection [???]
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.150.122:1521:dna

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:260)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:315)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:109)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1262)
at com.dnaO2.infra.persistence.service.TxnCmd.invokeSqlCommand(TxnCmd.java:38)
at com.dnaO2.infra.persistence.service.SrvLocatorImpl$ManagerDelegate.invoke(SrvLocatorImpl.java:168)
at $Proxy0.add(Unknown Source)
at com.dnaO2.basket.dao.BasketDAO.save(BasketDAO.java:227)
at com.dnaO2.basket.bo.BasketBO.save(BasketBO.java:137)
at com.dnaO2.basket.bizsrv.BasketAppSrv.saveBasket(BasketAppSrv.java:66)
at com.dnaO2.basket.bizsrv.BasketFacade.saveBasket(BasketFacade.java:41)
at com.dnaO2.basket.test.BasketFacadeTest.testRemoveBasket(BasketFacadeTest.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at junit.textui.TestRunner.run(TestRunner.java:72)
at com.dnaO2.basket.test.BasketFacadeTest.main(BasketFacadeTest.java:211)
2006-03-10 19:05:28,071 (org.hibernate.util.JDBCExceptionReporter) - SQL Error: 0, SQLState: null
2006-03-10 19:05:28,071 (org.hibernate.util.JDBCExceptionReporter) - Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found


Name and version of the database you are using: Oracle 10i

The generated SQL (show_sql=true):



Debug level Hibernate log excerpt:



Top
 Profile  
 
 Post subject: Check your database status
PostPosted: Fri Mar 10, 2006 11:15 am 
Beginner
Beginner

Joined: Mon Mar 14, 2005 6:07 pm
Posts: 36
The "ORA-12519, TNS:no appropriate service handler found" message you are getting indicates that either (1) the listener is not configured correctly, or (2) the database instance to which it is connecting is not up. Try connecting from sqlplus, and ask your DBA for help if it doesn't work.

I hope this helps.


Top
 Profile  
 
 Post subject: ORA-12519 - Is it a problem of the Oracle9Dialect?
PostPosted: Sat Mar 11, 2006 2:30 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
Hi,

Thanks for the help.

Well, I will definitely contact with my DBA.

But the thing is that why is the connection pool size increasing everytime.
Whereas, in PostgresSql the connection pool size returns to "0" after completing all the transactions.

Is there any problem with OracleDialect, because, we are using
Oracle 10g as the database and I found no Oracle10Dialect for Hibernate.
So, I am using Oracle9Dialect. Does this conflict with the Database in releasing the connection.

Moreover Can anybody suggest what should be the ideal Connection Pool size in real time environmen?


Thanks
Manjith Kumar A.


Top
 Profile  
 
 Post subject: Neither of these is a problem
PostPosted: Sat Mar 11, 2006 11:31 am 
Beginner
Beginner

Joined: Mon Mar 14, 2005 6:07 pm
Posts: 36
I think the most likely reason the pool grows is that your session.close() is not in a try/finally: when an exception is thrown, the code without try/finally leaks a connection.

We use Oracle 10g with Oracle9Dialect in our product - it is not a problem.

Was the DBA able to help?


Top
 Profile  
 
 Post subject: How to release the Connection object in hibernate?
PostPosted: Mon Mar 13, 2006 2:16 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
Hi,

Thanks for the suggestion.
One Thing I have observed in our application is that My application in turn
calls many queries nestedly. This causes the Hibernate to hold the current session thread
and which in turn holds the connection object which leads me in giving this error : "ORA-12519, TNS:no appropriate service handler found" .

My Hibernate.cfg.xml is configured as below : -

Code:
<!-- a SessionFactory instance listed as /jndi/name -->
    <session-factory>
          <property name="connection.pool_size">50</property>
       <property name="hibernate.cache.use_query_cache">false</property>
<property name="current_session_context_class">thread</property>
        <property name="show_sql">true</property>
        <property name="use_outer_join">true</property>
        <!-- Oracle Configuration -->
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
       <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
       <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:abc</property>
       <property name="hibernate.connection.username">abc</property>
       <property name="hibernate.connection.password">abc</property>
          <property name="hibernate.cache.use_query_cache">false</property>
        <property name="show_sql">false</property>
               <property name="hibernate.connection.autocommit">true</property>
       
        <property name="use_outer_join">true</property>

  </session-factory>


Can anybody suggest any changes in the configuration that can solve my problem in releasing the connection object.

One more important issue I found out is that the execution of Hibernate is so fast that before the connection object is released by the database, the hibernate calls one more Connection object.

Thanks
Manjith Kumar A.

[/code]


Top
 Profile  
 
 Post subject: found a solution
PostPosted: Thu Apr 20, 2006 5:38 am 
Beginner
Beginner

Joined: Wed Nov 23, 2005 12:55 pm
Posts: 23
Hey,

I've got the same problem. I setup a test environment with grinder and ran multiple testcases and after a while I receive the same error you've got. Have you found a solution to the problem yet?

What I find very odd, is the fact that oracle level I can't seem to find any indication that there has been an error.? (note that I'm not a dba)

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 10:59 am 
Beginner
Beginner

Joined: Tue Aug 09, 2005 1:34 am
Posts: 26
Location: Bangalore
Hi,

Well we have solved this problem.
the problem is one needs to increase the number of sessions and processes from default 50 size to 300 which is an ideal size suggested by one of the dba's in the init.ora file in the oracle database and start the oracle DB Server using the following 3 steps: -
1) connect to database as sysdba
2)shutdown abort
3)startup pfile="specifies the path of the init.ora file"

Your problem will be solved.

Enjoy,
Manjith.


Top
 Profile  
 
 Post subject: may other solution
PostPosted: Wed Apr 26, 2006 2:51 am 
Beginner
Beginner

Joined: Wed Nov 23, 2005 12:55 pm
Posts: 23
Hey,

I updated my hibernate.cfg.xml and inserted following variables:

Quote:
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.max_size">30</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">100</property>


The problem doesn't seem to surface for the moment. I haven't altered my database settings yet, but the error occurs again, I'll def. try it out.

Thnx


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.