diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java index 44ea98d385395e..05353c01bffe46 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java @@ -19,6 +19,7 @@ import static org.hibernate.jpa.AvailableSettings.COLLECTION_CACHE_PREFIX; import static org.hibernate.jpa.AvailableSettings.PERSISTENCE_UNIT_NAME; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -603,8 +604,8 @@ private void applyMetadataBuilderContributor() { if (metadataBuilderContributorImplClass != null) { try { - metadataBuilderContributor = metadataBuilderContributorImplClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + metadataBuilderContributor = metadataBuilderContributorImplClass.getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new IllegalArgumentException("The MetadataBuilderContributor class [" + metadataBuilderContributorImplClass + "] could not be instantiated!", e); } diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/RecordableBootstrapFactory.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/RecordableBootstrapFactory.java index 26ddc5648c3271..13dce20f0ac6b0 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/RecordableBootstrapFactory.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/RecordableBootstrapFactory.java @@ -1,5 +1,7 @@ package io.quarkus.hibernate.orm.runtime.boot; +import java.lang.reflect.InvocationTargetException; + import org.hibernate.boot.registry.BootstrapServiceRegistry; import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; import org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl; @@ -51,9 +53,10 @@ private static InitialInitiatorListProvider initReactiveListProviderMaybe() { //Use reflection as we don't want the Hibernate ORM extension to depend on the Hibernate Reactive extension: final Class forName = Class .forName("io.quarkus.hibernate.reactive.runtime.boot.registry.ReactiveHibernateInitiatorListProvider"); - final Object o = forName.newInstance(); + final Object o = forName.getDeclaredConstructor().newInstance(); return (InitialInitiatorListProvider) o; - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException + | InvocationTargetException e) { //Be silent as this is a static initializer: most likely the Hibernate Reactive extension is //not on the classpath, which implies we won't need this. return null;