diff --git a/source/java/org/alfresco/filesys/CIFSServerBean.java b/source/java/org/alfresco/filesys/CIFSServerBean.java index ce8095ac9e..fdfa4b5f72 100644 --- a/source/java/org/alfresco/filesys/CIFSServerBean.java +++ b/source/java/org/alfresco/filesys/CIFSServerBean.java @@ -203,11 +203,12 @@ public class CIFSServerBean extends AbstractLifecycleBean out.println("CIFS Server Test"); out.println("----------------"); + ClassPathXmlApplicationContext ctx = null; try { // Create the configuration service in the same way that Spring creates it - ApplicationContext ctx = new ClassPathXmlApplicationContext("alfresco/application-context.xml"); + ctx = new ClassPathXmlApplicationContext("alfresco/application-context.xml"); // Get the CIFS server bean @@ -267,6 +268,13 @@ public class CIFSServerBean extends AbstractLifecycleBean { ex.printStackTrace(); } + finally + { + if (ctx != null) + { + ctx.close(); + } + } System.exit(1); }