From 2d1cd8a23ae4db36875a200dd5a474c26df9b43a Mon Sep 17 00:00:00 2001
From: Kinshuk Bairagi <kingster@users.noreply.github.com>
Date: Tue, 1 Dec 2020 12:28:00 +0530
Subject: [PATCH] Orkweb Startup Fixes (#39)

* orkweb: fix Log4jConfigFile
* Update ContextListener.java
* orkweb: remove old hibernate versions
---
 orkweb/context/WEB-INF/web.xml                    |  2 +-
 orkweb/pom.xml                                    | 14 +-------------
 .../src/net/sf/oreka/orkweb/ContextListener.java  | 15 +++++++++++----
 3 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/orkweb/context/WEB-INF/web.xml b/orkweb/context/WEB-INF/web.xml
index 9efa1db4..a3918f11 100644
--- a/orkweb/context/WEB-INF/web.xml
+++ b/orkweb/context/WEB-INF/web.xml
@@ -13,7 +13,7 @@
 	  </context-param>
 	  <context-param>
 		  <param-name>Log4jConfigFile</param-name>
-		  <param-value>logging.properties</param-value>
+		  <param-value>logging.xml</param-value>
     </context-param>
 	  <context-param>
 		  <param-name>HibernateConfigFile</param-name>
diff --git a/orkweb/pom.xml b/orkweb/pom.xml
index fee95084..728c9a23 100644
--- a/orkweb/pom.xml
+++ b/orkweb/pom.xml
@@ -3,7 +3,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>net.sf.oreka</groupId>
     <artifactId>orkweb</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>0.0.2-SNAPSHOT</version>
     <packaging>war</packaging>
     <build>
         <sourceDirectory>src</sourceDirectory>
@@ -76,18 +76,6 @@
             <scope>provided</scope>
         </dependency>
 
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate</artifactId>
-            <version>3.2.6.ga</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-            <version>3.3.1.GA</version>
-        </dependency>
-
         <dependency>
             <groupId>tapestry</groupId>
             <artifactId>tapestry</artifactId>
diff --git a/orkweb/src/net/sf/oreka/orkweb/ContextListener.java b/orkweb/src/net/sf/oreka/orkweb/ContextListener.java
index d098f41b..b92d2d03 100644
--- a/orkweb/src/net/sf/oreka/orkweb/ContextListener.java
+++ b/orkweb/src/net/sf/oreka/orkweb/ContextListener.java
@@ -40,8 +40,14 @@ public void contextInitialized(ServletContextEvent servletContextEvent) {
 			log.error("OrkWeb ContextInitialized(): Log4jConfigFile context-param missing in web.xml");
 		} else {
 			log4jConfigFile = configFolder + "/" + log4jConfigFile;
-			LogManager.getInstance().configure(log4jConfigFile);
-			log.info("OrkWeb ContextInitialized(): log4jConfigFile is " + log4jConfigFile);
+			try {
+				LogManager.getInstance().configure(log4jConfigFile);
+				log.info("OrkWeb ContextInitialized(): log4jConfigFile is " + log4jConfigFile);
+			} catch (Throwable e){
+				e.printStackTrace();
+				log.error("OrkWeb ContextInitialized(): Error configuring log4j: " + e.getMessage());
+			}
+
 		}
 
 		log.info("========================================");
@@ -58,8 +64,9 @@ public void contextInitialized(ServletContextEvent servletContextEvent) {
 		try {
 			OrkWeb.hibernateManager.configure(hibernateConfigFile);
 		}
-		catch (Exception e) {
-			log.error("OrkWeb ContextInitialized(): Error configuring Hibernate: " + e.getMessage());				
+		catch (Throwable e) {
+			e.printStackTrace();
+			log.error("OrkWeb ContextInitialized(): Error configuring Hibernate: " + e.getMessage());
 		}
 		
 		// Get path to server.xml file