[jboss-user] [EJB 3.0] - Re: problem passivating SFSB

asookazian do-not-reply at jboss.com
Wed Apr 16 19:24:30 EDT 2008


Problem resolved by setting an additional instance variable to null in the @PrePassivate method:

	private void cleanUp() 
  | 	{
  | 		try 
  | 		{
  | 			if (rs != null) 
  | 			{
  | 				rs.close();
  | 			}
  | 			if (preparedStmt != null) 
  | 			{
  | 				preparedStmt.close();
  | 			}
  | 			if (stmt != null) 
  | 			{
  | 				stmt.close();
  | 			}
  | 			if (con != null) 
  | 			{
  | 				con.close();
  | 			}
  | 			
  | 		}
  | 		catch(SQLException e) {
  | 			e.printStackTrace();
  | 		}
  | 	}	
  | 
  | @PrePassivate
  | 	private void cleanupBeforePassivation() {
  | 				
  | 		cleanUp();
  | 		con 				  = null;    
  | 		stmt 				 = null;  
  | 		preparedStmt		   = null; 
  | 		rs 				  = null;   
  | 				
  | 		params = null;  //<-- root cause identified!  at least this variable not being set to null causes the 
  | 				// javax.ejb.EJBException: Could not passivate; failed to save state error...
  | 	}

Alternative fix is to not use the Map params variable as an instance variable, but as multiple local instances.

The stack trace is very misleading:

anonymous wrote : Caused by: java.lang.NoClassDefFoundError: org/jaxen/VariableContext
  | 

when that class is actually residing in the JBOSS_HOME/server/default/lib/jaxen.jar...

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144672#4144672

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144672



More information about the jboss-user mailing list