@Override public <R extends Service> void injectDependencies(ServiceBinding<R> binding) { throw new ServiceException( "Boot-strap registry should only contain provided services" ); }
@Test public void testMissingCacheStrategyFail() { /* * The cache manager is created per session factory, and we don't use any specific ehcache configuration, * so we know the caches don't exist before we start the session factory. */ // let's try to build the standard testing SessionFactory, without pre-defining caches try ( SessionFactoryImplementor ignored = TestHelper.buildStandardSessionFactory( builder -> builder.applySetting( ConfigSettings.MISSING_CACHE_STRATEGY, "fail" ) ) ) { fail(); } catch (ServiceException expected) { assertTyping( CacheException.class, expected.getCause() ); assertThat( expected.getMessage(), CoreMatchers.equalTo( "Unable to create requested service [" + org.hibernate.cache.spi.CacheImplementor.class.getName() + "]" ) ); assertThat( expected.getCause().getMessage(), CoreMatchers.startsWith( "On-the-fly creation of Ehcache Cache objects is not supported" ) ); } catch (CacheException expected) { assertThat( expected.getMessage(), CoreMatchers.equalTo( "On-the-fly creation of Ehcache Cache objects is not supported" ) ); } }
public final org.hibernate.service.spi.ServiceException unableToConfigureDatastoreProvider(final java.lang.Exception arg0) { org.hibernate.service.spi.ServiceException result = new org.hibernate.service.spi.ServiceException(java.lang.String.format(unableToConfigureDatastoreProvider$str()), arg0); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
smsCodeService.save(smsCodeEntity); } catch (ServiceException e) { e.printStackTrace(); return JsonResponse.error(100000, e.getMessage()); } catch (Exception e) { e.printStackTrace();
public final org.hibernate.service.spi.ServiceException unableToStartDatastoreProvider(final java.lang.Exception arg0) { org.hibernate.service.spi.ServiceException result = new org.hibernate.service.spi.ServiceException(java.lang.String.format(unableToStartDatastoreProvider$str()), arg0); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
public final org.hibernate.service.spi.ServiceException unableToStartDatastoreProvider(final java.lang.Exception arg0) { org.hibernate.service.spi.ServiceException result = new org.hibernate.service.spi.ServiceException(java.lang.String.format(unableToStartDatastoreProvider$str()), arg0); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
@Override public <R extends Service> R initiateService(ServiceInitiator<R> serviceInitiator) { throw new ServiceException( "Boot-strap registry should only contain provided services" ); }
@Test public void testMissingCacheStrategyFail_legacyNames() { /* * The cache manager is created per session factory, and we don't use any specific ehcache configuration, * so we know the caches don't exist before we start the session factory. */ // let's try to build the standard testing SessionFactory, without pre-defining caches try ( SessionFactoryImplementor ignored = TestHelper.buildStandardSessionFactory( builder -> builder.applySetting( ConfigSettings.MISSING_CACHE_STRATEGY, "fail" ) ) ) { fail(); } catch (ServiceException expected) { assertTyping( CacheException.class, expected.getCause() ); assertThat( expected.getMessage(), CoreMatchers.equalTo( "Unable to create requested service [" + org.hibernate.cache.spi.CacheImplementor.class.getName() + "]" ) ); assertThat( expected.getCause().getMessage(), CoreMatchers.startsWith( "On-the-fly creation of Ehcache Cache objects is not supported" ) ); } catch (CacheException expected) { assertThat( expected.getMessage(), CoreMatchers.equalTo( "On-the-fly creation of Ehcache Cache objects is not supported" ) ); } }
public final org.hibernate.service.spi.ServiceException unableToConfigureDatastoreProvider(final java.lang.Exception arg0) { org.hibernate.service.spi.ServiceException result = new org.hibernate.service.spi.ServiceException(java.lang.String.format(unableToConfigureDatastoreProvider$str()), arg0); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
@Override public <R extends Service> void configureService(ServiceBinding<R> binding) { throw new ServiceException( "Boot-strap registry should only contain provided services" ); }
@Test public void testMissingCacheStrategyFail() { // first, lets make sure that the region names we think are non-existent really do not exist for ( String regionName : TestHelper.allDomainRegionNames ) { assertThat( TestHelper.getCache( regionName ), nullValue() ); } // and now let's try to build the standard testing SessionFactory, without pre-defining caches try ( SessionFactoryImplementor ignored = TestHelper.buildStandardSessionFactory( builder -> builder.applySetting( ConfigSettings.MISSING_CACHE_STRATEGY, "fail" ) ) ) { fail(); } catch (ServiceException expected) { assertTyping( CacheException.class, expected.getCause() ); assertThat( expected.getMessage(), CoreMatchers.equalTo( "Unable to create requested service [" + org.hibernate.cache.spi.CacheImplementor.class.getName() + "]" ) ); assertThat( expected.getCause().getMessage(), CoreMatchers.startsWith( "On-the-fly creation of JCache Cache objects is not supported" ) ); } catch (CacheException expected) { assertThat( expected.getMessage(), CoreMatchers.equalTo( "On-the-fly creation of JCache Cache objects is not supported" ) ); } }
public final org.hibernate.service.spi.ServiceException unableToStartDatastoreProvider(final java.lang.Exception arg0) { org.hibernate.service.spi.ServiceException result = new org.hibernate.service.spi.ServiceException(java.lang.String.format(unableToStartDatastoreProvider$str()), arg0); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
@Override public <R extends Service> void startService(ServiceBinding<R> binding) { throw new ServiceException( "Boot-strap registry should only contain provided services" ); }
public final org.hibernate.service.spi.ServiceException unableToConfigureDatastoreProvider(final java.lang.Exception arg0) { org.hibernate.service.spi.ServiceException result = new org.hibernate.service.spi.ServiceException(java.lang.String.format(unableToConfigureDatastoreProvider$str()), arg0); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
@Override @SuppressWarnings( {"unchecked"}) public PersisterClassResolver initiateService(Map configurationValues, ServiceRegistryImplementor registry) { final Object customImpl = configurationValues.get( IMPL_NAME ); if ( customImpl == null ) { return new StandardPersisterClassResolver(); } if ( PersisterClassResolver.class.isInstance( customImpl ) ) { return (PersisterClassResolver) customImpl; } final Class<? extends PersisterClassResolver> customImplClass = Class.class.isInstance( customImpl ) ? (Class<? extends PersisterClassResolver>) customImpl : locate( registry, customImpl.toString() ); try { return customImplClass.newInstance(); } catch (Exception e) { throw new ServiceException( "Could not initialize custom PersisterClassResolver impl [" + customImplClass.getName() + "]", e ); } }
@Override public final ServiceException unableToStartDatastoreProvider(final Exception arg0) { final ServiceException result = new ServiceException(String.format(getLoggingLocale(), unableToStartDatastoreProvider$str()), arg0); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unableToConfigureDatastoreProvider = "OGM000072: Unable to configure datastore provider";
@Override @SuppressWarnings( {"unchecked"}) public PersisterFactory initiateService(Map configurationValues, ServiceRegistryImplementor registry) { final Object customImpl = configurationValues.get( IMPL_NAME ); if ( customImpl == null ) { return new PersisterFactoryImpl(); } if ( PersisterFactory.class.isInstance( customImpl ) ) { return (PersisterFactory) customImpl; } final Class<? extends PersisterFactory> customImplClass = Class.class.isInstance( customImpl ) ? ( Class<? extends PersisterFactory> ) customImpl : locate( registry, customImpl.toString() ); try { return customImplClass.newInstance(); } catch (Exception e) { throw new ServiceException( "Could not initialize custom PersisterFactory impl [" + customImplClass.getName() + "]", e ); } }
@Override public final ServiceException unableToConfigureDatastoreProvider(final Exception arg0) { final ServiceException result = new ServiceException(String.format(getLoggingLocale(), unableToConfigureDatastoreProvider$str()), arg0); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotLoadLuceneParserBackend = "OGM000073: Couldn't load the Lucene-based query parser backend. Make sure the dependency org.hibernate.hql:hibernate-hql-lucene is part of the classpath.";
private static Driver loadDriverIfPossible(String driverClassName, ServiceRegistryImplementor serviceRegistry) { if ( driverClassName == null ) { log.debug( "No driver class specified" ); return null; } if ( serviceRegistry != null ) { final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class ); final Class<Driver> driverClass = classLoaderService.classForName( driverClassName ); try { return driverClass.newInstance(); } catch ( Exception e ) { throw new ServiceException( "Specified JDBC Driver " + driverClassName + " could not be loaded", e ); } } try { return (Driver) Class.forName( driverClassName ).newInstance(); } catch ( Exception e1 ) { throw new ServiceException( "Specified JDBC Driver " + driverClassName + " could not be loaded", e1 ); } }
@Override public final ServiceException unableToConfigureDatastoreProvider(final Exception arg0) { final ServiceException result = new ServiceException(String.format(getLoggingLocale(), unableToConfigureDatastoreProvider$str()), arg0); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotLoadLuceneParserBackend = "OGM000073: Couldn't load the Lucene-based query parser backend. Make sure the dependency org.hibernate.hql:hibernate-hql-lucene is part of the classpath.";