Announcement Announcement Module
Collapse
No announcement yet.
Closing a result set you left open! Please close it yourself Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Closing a result set you left open! Please close it yourself

    Hello,

    I'm developing an aplication using Hibernate and Spring (with AOP) and a exception is throw in my log when I try to save by hibernate: [org.jboss.resource.adapter.jdbc.WrappedConnection] Closing a result set you left open! Please close it yourself..
    I looking for solutions but I didnt find. I'm using JBoss Web 1.01, Hibernate 3, Spring and MySQL.

    Below follows my log..

    20:51:14,567 WARN [org.jboss.resource.adapter.jdbc.WrappedConnection] Closing a result set you left open! Please close it yourself.
    java.lang.Throwable: STACKTRACE
    at org.jboss.resource.adapter.jdbc.WrappedStatement.r egisterResultSet(WrappedStatement.java:617)
    at org.jboss.resource.adapter.jdbc.WrappedStatement.g etGeneratedKeys(WrappedStatement.java:533)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.hibernate.util.GetGeneratedKeysHelper.getGener atedKey(GetGeneratedKeysHelper.java:69)
    at org.hibernate.id.IdentityGenerator$GetGeneratedKey sDelegate.executeAndExtract(IdentityGenerator.java :74)
    at org.hibernate.id.insert.AbstractReturningDelegate. performInsert(AbstractReturningDelegate.java:33)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.insert(AbstractEntityPersister.java:2108)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.insert(AbstractEntityPersister.java:2588)
    at org.hibernate.action.EntityIdentityInsertAction.ex ecute(EntityIdentityInsertAction.java:48)
    at org.hibernate.engine.ActionQueue.execute(ActionQue ue.java:248)
    at org.hibernate.event.def.AbstractSaveEventListener. performSaveOrReplicate(AbstractSaveEventListener.j ava:290)
    at org.hibernate.event.def.AbstractSaveEventListener. performSave(AbstractSaveEventListener.java:180)
    at org.hibernate.event.def.AbstractSaveEventListener. saveWithGeneratedId(AbstractSaveEventListener.java :108)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.saveWithGeneratedOrRequestedId(DefaultSaveO rUpdateEventListener.java:186)
    at org.hibernate.event.def.DefaultSaveEventListener.s aveWithGeneratedOrRequestedId(DefaultSaveEventList ener.java:33)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.entityIsTransient(DefaultSaveOrUpdateEventL istener.java:175)
    at org.hibernate.event.def.DefaultSaveEventListener.p erformSaveOrUpdate(DefaultSaveEventListener.java:2 7)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.onSaveOrUpdate(DefaultSaveOrUpdateEventList ener.java:70)
    at org.hibernate.impl.SessionImpl.fireSave(SessionImp l.java:535)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.ja va:523)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.ja va:519)
    at com.app.dao.impl.AbstractBaseDaoImpl.criar(Abstrac tBaseDaoImpl.java:68)
    at com.app.dao.impl.UsuarioDaoImpl.criar(UsuarioDaoIm pl.java:51)
    at com.app.service.impl.UsuarioServiceImpl.incluirUsu ario(UsuarioServiceImpl.java:203)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    ....
    Bellows my aplication-context.xml:

    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="
           [url]http://www.springframework.org/schema/beans[/url] [url]http://www.springframework.org/schema/beans/spring-beans-2.0.xsd[/url]
           [url]http://www.springframework.org/schema/tx[/url] [url]http://www.springframework.org/schema/tx/spring-tx-2.0.xsd[/url]
           [url]http://www.springframework.org/schema/aop[/url] http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
           
        <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="location" value="classpath:application.properties"/>
            <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
        </bean>
       <!-- Hibernate SessionFactory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <!-- Se quiser definir named queries em documentos xml, 
            	para não ficarem mapeadas por annotations -->
            <property name="mappingResources">
    			<list>
    				<value>com/app/domain/Sessao.hbm.xml</value>
    				<value>com/app/domain/Perfil.hbm.xml</value>
    				<value>com/app/domain/Usuario.hbm.xml</value>
    				<value>com/app/domain/Template.hbm.xml</value>
    				<value>com/app/domain/TipoOperacao.hbm.xml</value>
    				<value>com/app/domain/ArquivoLock.hbm.xml</value>
    				<value>com/app/domain/Log.hbm.xml</value>
    			</list>
    		</property>
            
            <property name="annotatedClasses">
                <list>
                    <value>com.app.domain.Sessao</value> 
    				<value>com.app.domain.Perfil</value>
    				<value>com.app.domain.Usuario</value>
    				<value>com.app.domain.Template</value>
    				<value>com.app.domain.TipoOperacao</value>
    				<value>com.app.domain.ArquivoLock</value>
    				<value>com.app.domain.Log</value>
                </list>
            </property>
            <property name="hibernateProperties">
                <props>
                	<prop key="hibernate.connection.datasource">java:/contcma</prop>
                    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                    <prop key="hibernate.show_sql">false</prop>
                    <prop key="hibernate.jdbc.batch_size">20</prop>
                    <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
                    <prop key="hibernate.cache.use_second_level_cache">false</prop>
                    <prop key="hibernate.query.substitutions">true 1, false 0</prop>
                </props>
            </property>
        </bean>
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    	<!-- the transactional advice -->
      	<tx:advice id="transactionAdvice" transaction-manager="transactionManager">
        	<!-- the transactional semantics... -->
        	<tx:attributes>
          		<!-- com transacao -->
          		<tx:method name="incluir*" read-only="false" />
          		<tx:method name="alterar*" read-only="false" />
          		<tx:method name="excluir*" read-only="false" />
           		<tx:method name="consumir*" read-only="false" />
    			<tx:method name="registrar*" read-only="false" />
    
    			<!-- sem transacao -->
    			<tx:method name="*" read-only="true" />
         	</tx:attributes>
      	</tx:advice>
    	<!-- ensure that the above transactional advice runs for any execution
        	of an operation defined by the FooService interface -->
    	<aop:config>
        	<aop:pointcut id="usuarioServiceOperation" expression="execution(* com.app.service.UsuarioService.*(..))"/>
        	<aop:pointcut id="sessaoServiceOperation" expression="execution(* com.app.service.SessaoService.*(..))"/>
        	<aop:pointcut id="logServiceOperation" expression="execution(* com.app.service.LogService.*(..))"/>
        	<aop:pointcut id="arquivoLockServiceOperation" expression="execution(* com.app.service.ArquivoLockService.*(..))"/>
        	<aop:pointcut id="templateServiceOperation" expression="execution(* com.app.service.TemplateService.*(..))"/>
        	<aop:advisor advice-ref="transactionAdvice" pointcut-ref="usuarioServiceOperation"/>
        	<aop:advisor advice-ref="transactionAdvice" pointcut-ref="sessaoServiceOperation"/>
        	<aop:advisor advice-ref="transactionAdvice" pointcut-ref="logServiceOperation"/>
        	<aop:advisor advice-ref="transactionAdvice" pointcut-ref="arquivoLockServiceOperation"/>
        	<aop:advisor advice-ref="transactionAdvice" pointcut-ref="templateServiceOperation"/>
       </aop:config>
    	
    	<!-- Dao's -->
    	<bean id="usuarioDao" class="com.app.dao.impl.UsuarioDaoImpl">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    	
    	<bean id="sessaoDao" class="com.app.dao.impl.SessaoDaoImpl">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    
    	<bean id="perfilDao" class="com.app.dao.impl.PerfilDaoImpl">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    
    	<!-- /Dao's -->
    	
    	<!-- Services -->
    	<bean id="usuarioService" class="com.app.service.impl.UsuarioServiceImpl">
    		<property name="dao"><ref local="usuarioDao"/></property>
    		<property name="perfilDao"><ref local="perfilDao"/></property>
    		<property name="sessaoDao"><ref local="sessaoDao"/></property>
    	</bean>
    	<!-- /Services -->
    	
    	<!-- Actions -->
    	<bean id="login" scope="prototype"
            class="com.app.controller.admin.LoginAction">
            <constructor-arg ref="usuarioService" />
        </bean>
        <bean id="cadastrarUsuarioForm" scope="prototype"
            class="com.app.controller.admin.usuario.CadastrarUsuarioFormAction">
            <constructor-arg ref="usuarioService" />
        </bean>
        <!-- /Actions -->   
    </beans>


    It's missing something that I forgot in this configurations?
    If its missing any data that you want to see just ask....

    Thanks guys...
    Last edited by Ramon Andrade; Jul 10th, 2007, 04:07 PM. Reason: more information

  • #2
    This is not an error, it's a warning. I'd say you can safely ignore it and configure log4j not to log it.

    Comment

    Working...
    X