Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 42

Thread: configuration help: pool problems create deadlocks

  1. #11
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Default

    What I was getting at here though is what releases the ResultSet?
    Code:
     String query = "SELECT * FROM CabeceraAlmacen c, DetalleAlmacen d, Articulo a, Medida m  WHERE " +
    	        " c.idnumero=d.idnumero AND c.serie=d.serie AND " +
    	        " d.idArticulo=a.idArticulo AND a.idMedida=m.idMedida AND " +
    	        " c.serie='SAL' AND c.idnumero=?";
    see bold part , 4 classes

    the ResultSet should return a header with its detail used by jasper report , thats all
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  2. #12
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    But if you look at your code, you get a connection, execute a query and you have an open ResultSet that you give to Jasper reports. I'm just wondering what actually releases that.
    Last edited by karldmoore; Aug 29th, 2007 at 11:18 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #13
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Default

    But if you look at your code, you get a connection, execute a query and you have an open ResultSet that you give to Jasper reports.
    thats right, like the book

    I'm just wondering what actually releases that
    it seems that i should close the ResultSet right???


    thanks for advanced
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  4. #14
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Well as I said I haven't used this bit before but I would have thought you'd have to close it once you've generated the report.
    Code:
        finally
        {
          //boilerplate code to close the result set, statement, and exception
        }
    http://www.ensode.net/jasperreports_database_pg3.html
    Last edited by karldmoore; Aug 29th, 2007 at 11:18 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  5. #15
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Default

    Well as I said I haven't used this bit before but I would have thought you'd have to close it once you've generated the report.
    yes, it seems, really wondered why this not appear in the book

    thanks for the link, i am not in my home now so i will test this in the night

    one favor,can you show an extract of your code, when you use JRBeanCollectionDataSource but with more classes to fill the object,
    like my case when i use the JRResultSetDataSource???

    regards

    and thanks for your time
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  6. #16
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Quote Originally Posted by dr_pompeii View Post
    one favor,can you show an extract of your code, when you use JRBeanCollectionDataSource but with more classes to fill the object, like my case when i use the JRResultSetDataSource???
    The code was from a previous closed sourced project so I can't post it here. I'm sure there are lots of good examples on the net though.
    Last edited by karldmoore; Aug 29th, 2007 at 11:18 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  7. #17
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Default

    The code was from a previous closed sourced project so I can't post it here.
    privacy code mmm

    dont worry man, thanks for your time

    I'm sure there are lots of good examples on the net though.
    i will see

    regards
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  8. #18
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I think the implementation is conceptually the same thing, it's just that you have packaged up the data in objects instead of reading it from the ResultSet.
    Last edited by karldmoore; Aug 29th, 2007 at 11:18 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  9. #19
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Thumbs down problems with ResultSet.

    hi karl

    pls see this code
    Code:
    @Override
    protected Event doExecute(RequestContext context)throws Exception{
       logger.info("\n TransaccionSalidaAlmacenJasperReportAction doExecute \n");
       Connection connection=null;
        PreparedStatement ps=null;
        ResultSet resultSet=null;
        try{
        	CabeceraSalidaAlmacen cabeceraSalidaAlmacen = 
        		(CabeceraSalidaAlmacen) (context.getFlowScope().get("cabeceraSalidaAlmacenCommand"));
        	AlmacenPK almacenPK = cabeceraSalidaAlmacen.getAlmacenPK();
    	       	    
        	String query = " SELECT * FROM CabeceraAlmacen c, DetalleAlmacen d, Articulo             
                                  a, Medida m  WHERE " +
    	    			 " c.idnumero=d.idnumero AND c.serie=d.serie AND " +
    	    			  " d.idArticulo=a.idArticulo AND a.idMedida=m.idMedida AND " +
    	    			  " c.serie='SAL' AND c.idnumero=?";
    	    		 
    	    	connection = dataSource.getConnection();
    	    	ps=connection.prepareStatement(query);
    	    	ps.setString(1, almacenPK.getIdnumero());
    	    	resultSet = ps.executeQuery();	    
    	    
    	    	JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(resultSet);
    	    	context.getRequestScope().put("datasource", resultSetDataSource);
    	    	
    	    }
    	    catch(Exception e){
    		logger.info("\n TransaccionSalidaAlmacenJasperReportAction doExecute  
                                     Exception: \n"+
    					e.getMessage() );
    		}
    		finally{
    			logger.info("\n TransaccionSalidaAlmacenJasperReportAction doExecute B4 CLOSE RS");
    			resultSet.close();
    			logger.info("\n TransaccionSalidaAlmacenJasperReportAction doExecute A4 CLOSE RS");
    		}
    		return success();
    	}
    my log

    Code:
    08:23:48 INFO                    TransaccionSalidaAlmacenJasperReportAction doExecute                 
     TransaccionSalidaAlmacenJasperReportAction doExecute 
    
    08:23:48 INFO                    TransaccionSalidaAlmacenJasperReportAction doExecute                 
     TransaccionSalidaAlmacenJasperReportAction doExecute B4 CLOSE RS
    08:23:48 INFO                    TransaccionSalidaAlmacenJasperReportAction doExecute                 
     TransaccionSalidaAlmacenJasperReportAction doExecute A4 CLOSE RS
    08:23:50 ERROR tainerBase.[Catalina].[localhost].[/lagranjita].[lagranjita] invoke                    Servlet.service() para servlet lagranjita lanzó excepción
    net.sf.jasperreports.engine.JRException: Unable to get next record.
    	at net.sf.jasperreports.engine.JRResultSetDataSource.next(JRResultSetDataSource.java:99)
    	at net.sf.jasperreports.engine.fill.JRFillDataset.advanceDataSource(JRFillDataset.java:842)
    	at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:760)
    	at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1078)
    	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:107)
    	at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:751)
    	at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:679)
    	at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)
    	at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
    	at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.fillReport(AbstractJasperReportsView.java:604)
    	at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.renderMergedOutputModel(AbstractJasperReportsView.java:546)
    	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:247)
    	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1105)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:841)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
    	at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
    	at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
    	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
    	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
    	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
    	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.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.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Thread.java:595)
    Code:
    
    Caused by: java.sql.SQLException: You can't operate on a closed ResultSet!!!
    	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
    	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
    	at com.mchange.v2.c3p0.impl.NewProxyResultSet.next(NewProxyResultSet.java:3047)
    	at net.sf.jasperreports.engine.JRResultSetDataSource.next(JRResultSetDataSource.java:95)
    	... 54 more
    Caused by: java.lang.NullPointerException
    	at com.mchange.v2.c3p0.impl.NewProxyResultSet.next(NewProxyResultSet.java:3041)
    	... 55 more
    i am doom, how i can resolve this karl???

    thanks for advanced
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  10. #20
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I think if you need to close anything, it's going to need to be after you've built the report.
    Last edited by karldmoore; Aug 29th, 2007 at 11:17 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •