Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using DataSource with Oracle 10g Application Server results in error

 
hasina kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After creating a DataSource on Oracle Application Server, we deploy a war file for the application. But when we try to run the application, it results in following error:
OrionCMTConnection not closed, check your code
Logical Connection not closed, check your code.
I have checked my code for closing all the open connections. All the connections are closed in the finally Block.

I have checked the web.xml for resource-ref tag pointing to correct DataSource. Also check the connection string in DataSource on the application server. Everything seems to be correcty. Does anybody have any idea why i would get this error. -Thanks
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems odd to see a CMT exception but have somebody say
they are closing a connection manually in a finally clause.
Are you using this data source in some kind of session bean,
or did you wrap this in some kind of JTA code? Or maybe
the data source is configured for XA when one for local
transactions would be more appropriate?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you closing each of your JDBC objects in a separate try/catch block?
 
hasina kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not using Session Bean. I getting the dataSource by using JNDI context
try {
// Get the JNDI context
Context ic = new InitialContext();
ds = (DataSource) ic.lookup(dsName);
}
catch (NamingException e) {
e.printStackTrace();
throw new RemoteException(e.getMessage());

And this is the try-catch blocks to get the connection. I close connection in finally block
try
{
try {
conn = DbConnectionPool.getConnection(dsName);
}
catch (RemoteException e1) {
e1.printStackTrace();
}
stmt = conn.prepareCall(sql);
}
catch (SQLException e)
{
try {
throw new RemoteException(e.getMessage());
}
catch (RemoteException e1) {
e1.printStackTrace();
}
}
finally{
try{
conn.close();
}
catch(SQLException e){
}
}
return stmt;
}
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you swallow the exception, how can you tell that the close() worked?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic