Author: stliu
Date: 2010-04-22 05:48:57 -0400 (Thu, 22 Apr 2010)
New Revision: 19281
Modified:
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/cfg/SettingsFactory.java
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/connection/ConnectionProviderFactory.java
Log:
JBPAPP-2440 Exceptions due to missing non-supported connection and cache providers are not
meaningful
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/cfg/SettingsFactory.java
===================================================================
---
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/cfg/SettingsFactory.java 2010-04-22
09:40:04 UTC (rev 19280)
+++
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/cfg/SettingsFactory.java 2010-04-22
09:48:57 UTC (rev 19281)
@@ -374,8 +374,13 @@
try {
return (CacheProvider) ReflectHelper.classForName(cacheClassName).newInstance();
}
- catch (Exception cnfe) {
- throw new HibernateException("could not instantiate CacheProvider: " +
cacheClassName, cnfe);
+ catch ( Throwable cnfe ) {
+ String msg = "Could not instantiate cache provider: "
+ + cacheClassName
+ + "\nUnsupported cache provider implemention is not included our Product."
+ + "\nThis error may be caused by the configured cache provider was not found in
the classpath."
+ + "\nPlease check the cache configuration and make sure the provider is in the
classpath.";
+ throw new HibernateException( msg, cnfe );
}
}
Modified:
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/connection/ConnectionProviderFactory.java
===================================================================
---
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/connection/ConnectionProviderFactory.java 2010-04-22
09:40:04 UTC (rev 19280)
+++
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/connection/ConnectionProviderFactory.java 2010-04-22
09:48:57 UTC (rev 19281)
@@ -121,7 +121,21 @@
throw new HibernateException("Unable to inject objects into the conenction
provider", e);
}
}
- connections.configure(properties);
+ try {
+ connections.configure( properties );
+ } catch ( Throwable e ) {
+ if ( providerClass != null ) {
+ String msg = "Could not instantiate connection provider: "
+ + providerClass
+ + "\nUnsupported connection provider implemention is not included our
Product."
+ + "\nThis error may be caused by the configured connection provider was not
found in the classpath."
+ + "\nPlease check the connection configuration and make sure the provider is
in the classpath.";
+ log.error( msg, e );
+ throw new HibernateException( msg );
+ }else{
+ throw new HibernateException( e );
+ }
+ }
return connections;
}
Show replies by date