aspose file tools*
The moose likes Object Relational Mapping and the fly likes Web App hangs up when opening hibernate session factory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Web App hangs up when opening hibernate session factory" Watch "Web App hangs up when opening hibernate session factory" New topic
Author

Web App hangs up when opening hibernate session factory

Hasnain Javed Khan
Ranch Hand

Joined: Nov 23, 2007
Posts: 73
Hello All,
I have a very strange problem that causes our web application to hangup. I'm using the following technologies
Spring 2.5.6
Spring Security 2.0.1
Spring Security 2.0.1 core-tiger
Hibernate 3.0
JDK 1.6 update 10
PostgreSQL 8.3 (postgresql-8.3-603.jdbc3 driver)

I have a Class Campaign having a many-to-many association with Two other Classes namely Location and Advertisement.

A Campaign can be run on many locations and a location can run many campaigns

A Campaign is made up of many advertisements and an advertisement can appear in many campaigns.

Below are the class definition of Campaign,Location and Advertisement respectively.





At first the many-to-many association was unidirectional from campaign to location and from campaign to advertisement but later changed it to bi directional with campaign being the owner of the association(but the problem is not solved regardless of directionality).

Locations and Advertisements are being loaded lazily when a campaign is loaded. When a campaign is updated, the locations and advertisements are loaded (using query by criteria) and the lists are set manually in campaign using the appropriate setters. Below are the two query by criteria for fetching all the locations and advertisements for a campaign



The web application hangs up when editing/saving a campaign (mostly on editing and if done continuously 2 to 3 times) and all that is logged on the console is given below

DEBUG CampaignFormController - Calling doUpdate for entity with id: [113]
DEBUG SessionFactoryUtils - Opening Hibernate Session

during this hangup, if we try to log in again,following is the message that is logged on the console


DEBUG FilterChainProxy - Converted URL to lowercase, from: '/login.jsp'; to: '/login.jsp'
DEBUG FilterChainProxy - Candidate is: '/login.jsp'; pattern is /**; matched=true
DEBUG FilterChainProxy - /login.jsp at position 1 of 10 in additional filter chain; firing Filter: 'org.springframework.security.context.HttpSessionContextIntegrationFilter[ order=200; ]'
DEBUG essionContextIntegrationFilter - Obtained a valid SecurityContext from SPRING_SECURITY_CONTEXT to associate with SecurityContextHolder: 'org.springframework.security.context.SecurityContextImpl@ef073bd6: Authentication: org.springframework.security.providers.UsernamePasswordAuthenticationToken@ef073bd6: Principal: org.springframework.security.userdetails.User@0: Username: hasnain; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_USER; Password: [PROTECTED]; Authenticated: true; Details: org.springframework.security.ui.WebAuthenticationDetails@2eb76: RemoteIpAddress: 127.0.0.1; SessionId: 0DA65CF76F3BAE76B73416C7AEDE1538; Granted Authorities: ROLE_USER'
DEBUG FilterChainProxy - /login.jsp at position 2 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.SessionFixationProtectionFilter[ order=300; ]'
DEBUG FilterChainProxy - /login.jsp at position 3 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.logout.LogoutFilter[ order=400; ]'
DEBUG FilterChainProxy - /login.jsp at position 4 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.webapp.AuthenticationProcessingFilter[ order=800; ]'
DEBUG FilterChainProxy - /login.jsp at position 5 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.basicauth.BasicProcessingFilter[ order=1100; ]'
DEBUG BasicProcessingFilter - Authorization header: null
DEBUG FilterChainProxy - /login.jsp at position 6 of 10 in additional filter chain; firing Filter: 'org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter[ order=1200; ]'
DEBUG SavedRequestAwareWrapper - Wrapper not replaced; SavedRequest was: null
DEBUG FilterChainProxy - /login.jsp at position 7 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.rememberme.RememberMeProcessingFilter[ order=1300; ]'
DEBUG RememberMeProcessingFilter - SecurityContextHolder not populated with remember-me token, as it already contained: 'org.springframework.security.providers.UsernamePasswordAuthenticationToken@ef073bd6: Principal: org.springframework.security.userdetails.User@0: Username: hasnain; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_USER; Password: [PROTECTED]; Authenticated: true; Details: org.springframework.security.ui.WebAuthenticationDetails@2eb76: RemoteIpAddress: 127.0.0.1; SessionId: 0DA65CF76F3BAE76B73416C7AEDE1538; Granted Authorities: ROLE_USER'
DEBUG FilterChainProxy - /login.jsp at position 8 of 10 in additional filter chain; firing Filter: 'org.springframework.security.providers.anonymous.AnonymousProcessingFilter[ order=1400; ]'
DEBUG AnonymousProcessingFilter - SecurityContextHolder not populated with anonymous token, as it already contained: 'org.springframework.security.providers.UsernamePasswordAuthenticationToken@ef073bd6: Principal: org.springframework.security.userdetails.User@0: Username: hasnain; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_USER; Password: [PROTECTED]; Authenticated: true; Details: org.springframework.security.ui.WebAuthenticationDetails@2eb76: RemoteIpAddress: 127.0.0.1; SessionId: 0DA65CF76F3BAE76B73416C7AEDE1538; Granted Authorities: ROLE_USER'
DEBUG FilterChainProxy - /login.jsp at position 9 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.ExceptionTranslationFilter[ order=1500; ]'
DEBUG FilterChainProxy - /login.jsp at position 10 of 10 in additional filter chain; firing Filter: 'org.springframework.security.intercept.web.FilterSecurityInterceptor@16528a2'
DEBUG lterInvocationDefinitionSource - Converted URL to lowercase, from: '/login.jsp'; to: '/login.jsp'
DEBUG lterInvocationDefinitionSource - Candidate is: '/login.jsp'; pattern is /**/*.htm*; matched=false
DEBUG AbstractSecurityInterceptor - Public object - authentication not attempted
DEBUG XmlWebApplicationContext - Publishing event in context [org.springframework.web.context.support.XmlWebApplicationContext@381a53]: org.springframework.security.event.authorization.PublicInvocationEvent[source=FilterInvocation: URL: /login.jsp]
DEBUG FilterChainProxy - /login.jsp reached end of additional filter chain; proceeding with original chain
DEBUG ExceptionTranslationFilter - Chain processed normally
DEBUG essionContextIntegrationFilter - SecurityContextHolder now cleared, as request processing completed
DEBUG FilterChainProxy - Converted URL to lowercase, from: '/j_security_check'; to: '/j_security_check'
DEBUG FilterChainProxy - Candidate is: '/j_security_check'; pattern is /**; matched=true
DEBUG FilterChainProxy - /j_security_check at position 1 of 10 in additional filter chain; firing Filter: 'org.springframework.security.context.HttpSessionContextIntegrationFilter[ order=200; ]'
DEBUG essionContextIntegrationFilter - Obtained a valid SecurityContext from SPRING_SECURITY_CONTEXT to associate with SecurityContextHolder: 'org.springframework.security.context.SecurityContextImpl@ef073bd6: Authentication: org.springframework.security.providers.UsernamePasswordAuthenticationToken@ef073bd6: Principal: org.springframework.security.userdetails.User@0: Username: hasnain; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_USER; Password: [PROTECTED]; Authenticated: true; Details: org.springframework.security.ui.WebAuthenticationDetails@2eb76: RemoteIpAddress: 127.0.0.1; SessionId: 0DA65CF76F3BAE76B73416C7AEDE1538; Granted Authorities: ROLE_USER'
DEBUG FilterChainProxy - /j_security_check at position 2 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.SessionFixationProtectionFilter[ order=300; ]'
DEBUG FilterChainProxy - /j_security_check at position 3 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.logout.LogoutFilter[ order=400; ]'
DEBUG FilterChainProxy - /j_security_check at position 4 of 10 in additional filter chain; firing Filter: 'org.springframework.security.ui.webapp.AuthenticationProcessingFilter[ order=800; ]'
DEBUG AuthenticationProcessingFilter - Request is to process authentication
DEBUG ProviderManager - Authentication attempt using org.springframework.security.providers.dao.DaoAuthenticationProvider
DEBUG JdbcTemplate - Executing prepared SQL query
DEBUG JdbcTemplate - Executing prepared SQL statement [SELECT username,password,enabled FROM users WHERE username = ?]
DEBUG DataSourceUtils - Fetching JDBC Connection from DataSource


Some times, it happens that the web application/tomcat hangs up during deployment and happens at two separate occasions and the logged messages that are shown on the console are given below

1.

DEBUG FilterChainProxy- /netbeans-tomcat-status-test at position 10 of 10 in additional filter chain; firing Filter: 'org.springframework.security.intercept.web.FilterSecurityInterceptor@e20ef8'


2.

DEBUG essionContextIntegrationFilter - HttpSession being created as SecurityContextHolder contents are non-default


Have no idea why the application hangs up ??

Any help would be highly appreciated.Waiting for a favorable response.

Thanks in advance .

Kind regrads.
HJaved.

PS. apologies for a long post
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Web App hangs up when opening hibernate session factory