ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oak McIlwain <oak_mcilw...@yahoo.com>
Subject Re: No operations allowed after connection closed.
Date Sun, 16 Oct 2005 12:43:20 GMT
Thanks for your reply daniel.

I was not using transactions, they were all
autocommit.  This is why I thought it was strange as
it meant that ibatis was having trouble managing the
connections or that the mysql driver was not
functioning correctly.

As a fix for the moment I have added a "select 1"
style ping command to the config to validate the
connection. This has resulted in fixing the error,
however I am not entirely happy with it as a solution
as is has performance implications and also has not
lead me to understanding why the original error was
occuring. I would be interested to find out the real
cause of the problem. 

Here is the config before I added the ping command:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE sqlMapConfig PUBLIC
	"-//iBATIS.com//DTD SQL Map Config 2.0//EN"
	"http://www.ibatis.com/dtd/sql-map-config-2.dtd">

<sqlMapConfig>

  <properties
resource="resources/database.properties"/>

  <settings
    cacheModelsEnabled="true"
    enhancementEnabled="true"
    maxSessions="64"
    maxTransactions="8"
    maxRequests="128"/>

  <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property value="${driver}" name="JDBC.Driver"/>
      <property value="${url}"
name="JDBC.ConnectionURL"/>
      <property value="${username}"
name="JDBC.Username"/>
      <property value="${password}"
name="JDBC.Password"/>
      <property value="15"
name="Pool.MaximumActiveConnections"/>
      <property value="15"
name="Pool.MaximumIdleConnections"/>
      <property value="1000" name="Pool.MaximumWait"/>
    </dataSource>
  </transactionManager>

  <sqlMap resource="persistence/sqlmaps/Booking.xml"/>
  <sqlMap
resource="persistence/sqlmaps/Property.xml"/>
  <sqlMap resource="persistence/sqlmaps/Manager.xml"/>
  <sqlMap resource="persistence/sqlmaps/Image.xml"/>
  <sqlMap resource="persistence/sqlmaps/Event.xml"/>
  <sqlMap resource="persistence/sqlmaps/Holiday.xml"/>
  <sqlMap
resource="persistence/sqlmaps/Attribute.xml"/>
  <sqlMap
resource="persistence/sqlmaps/Administrator.xml"/>
  <sqlMap
resource="persistence/sqlmaps/GuestbookEntry.xml"/>

</sqlMapConfig>

Here is an example of a call that was causing the
error, although when the error occured, it would
happen on ANY call:

	public Property getProperty(String propertyID)
	{
		logger.debug("Method: getProperty");
		logger.info("propertyID = " + propertyID);
		return (Property) queryForObject("getProperty",
propertyID);
	}

--- Daniel Henrique Ferreira e Silva
<dhsilva@gmail.com> wrote:

> Hi Oak,
> 
> Can you post your sql-maps-config.xml file in here?
> And a sample of
> your code calling SqlMaps API?
> 
> Also, look at how you are invoking SQLMaps services.
> Are you using
> transactions? Or batch execution?
> People seemed to have such issues when using
> transactions/batch
> execution improperly.
> 
> Cheers,
> Daniel Silva.
> 
> On 10/15/05, Oak McIlwain <oak_mcilwain@yahoo.com>
> wrote:
> >
> > I have just uploaded a web app to a server and I
> am getting an intermittent
> > exception as follow:
> >
> >  --- The error occurred in
> > persistence/sqlmaps/Property.xml.
> > --- The error occurred while executing query.
> > --- Check the  SELECT * FROM Miem_Property WHERE
> Pty_Property_ID = ? .
> > --- Check the SQL Statement (preparation failed).
> > --- Cause: java.sql.SQLException: No operations
> allowed after connection
> > closed.
> > Caused by: java.sql.SQLException: No operations
> allowed after connection
> > closed.
> >
>
com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject(SqlMapDaoTemplate.java:164)
> >
>
persistence.sqlmapdao.PropertySqlMapDao.getProperty(Unknown
> > Source)
> >
>
sun.reflect.GeneratedMethodAccessor298.invoke(Unknown
> > Source)
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > java.lang.reflect.Method.invoke(Method.java:585)
> >
>
com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)
> > $Proxy29.getProperty(Unknown Source)
> > service.PropertyService.getProperty(Unknown
> Source)
> > action.view.ViewProperty.execute(Unknown Source)
> >
>
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
> >
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
> >
>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
> >
>
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >
> >
> > The sql is valid and works fine but ever since I
> uploaded it this has been
> > happening every 15 or so requests.
> >
> > OS: Linux
> > Mysql : 4.1.13
> > Java: 1.5.0
> > Connector/j: mysql-connector-java-3.2.0-alpha-bin
> (having
> > tried many others with similar results)
> >
> > Any help would be much appreciated !
> >
> >  ________________________________
> >  Yahoo! Music Unlimited - Access over 1 million
> songs. Try it free.
> >
> >
> 



		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

Mime
View raw message