Dave,
is that really appropriate? that same exception should be thrown
automatically whenever someone tries to access the
RollerFactory.getRoller() method.
also, you are exposing a persistence implementation detail in the
presentation layer. what if we switch away from Hibernate?
i think this one should be rolled back.
-- Allen
[EMAIL PROTECTED] wrote:
Author: snoopdave
Date: Wed May 3 13:29:46 2006
New Revision: 399407
URL: http://svn.apache.org/viewcvs?rev=399407&view=rev
Log:
Fail fast with appropriate error message when Hibernate is not found
Modified:
incubator/roller/trunk/src/org/apache/roller/presentation/RollerContext.java
Modified:
incubator/roller/trunk/src/org/apache/roller/presentation/RollerContext.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/presentation/RollerContext.java?rev=399407&r1=399406&r2=399407&view=diff
==============================================================================
---
incubator/roller/trunk/src/org/apache/roller/presentation/RollerContext.java
(original)
+++
incubator/roller/trunk/src/org/apache/roller/presentation/RollerContext.java
Wed May 3 13:29:46 2006
@@ -133,6 +133,14 @@
*/
public void contextInitialized(ServletContextEvent sce) {
+ try {
+ Class.forName("org.hibernate.Session");
+ } catch (Throwable t) {
+ // if Hibernate is not available, we're hosed
+ throw new RuntimeException(
+ "FATAL ERROR: Hibernate not found, please refer to the Roller
Installation Guide for instructions on how to install the required Hibernate jars");
+ }
+
mLogger.debug("RollerContext initializing");
// Save context in self and self in context