<div dir="ltr">Because scanning in WildFly requires VFS hooks that Jipijapa provided in its scanner specializations.<br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 3, 2015 at 11:10 AM Sanne Grinovero <<a href="mailto:sanne@hibernate.org">sanne@hibernate.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 3 June 2015 at 16:55, Scott Marlow <<a href="mailto:smarlow@redhat.com" target="_blank">smarlow@redhat.com</a>> wrote:<br>
> Hi Sanne,<br>
><br>
> I was able to reproduce one of the below errors that occur when packaging<br>
> Hibernate ORM jars with the application <a href="http://pastie.org/10221793" target="_blank">http://pastie.org/10221793</a>. This is<br>
> with the "jboss.as.jpa.providerModule" property set to value "application".<br>
><br>
> Test is pushed to [1] and is based on a test that I added for the [2] pull<br>
> request. Once [2] is merged to WildFly master, it should be easy to fix the<br>
> bug. The only change that I needed to [2], was to remove the provider from<br>
> the persistence.xml.<br>
><br>
> For the first approach below, we should probably allow the<br>
> "jboss.as.jpa.adapterClass" to specify the<br>
> "org.jboss.as.jpa.processor.PersistenceProviderAdaptorLoader.noopAdaptor"<br>
> (by name or via a special value).<br>
<br>
Right, being able to "force" usage of the no-op Adaptor like I did<br>
with my Byteman rule would give us a lot of nice flexibility.<br>
<br>
BTW once I did that, I noticed that the scanning of entities broke.<br>
Apparently entity scanning for Hibernate requires the Scanner which<br>
you would provide with the adaptor; would you know why?<br>
I'm wondering because it seems related to an Hibernate OGM issue: in<br>
that case we don't disable the adapter but still auto-detection of<br>
entities doesn't work.<br>
<br>
Thanks!<br>
Sanne<br>
<br>
><br>
> Scott<br>
><br>
> [1] <a href="https://github.com/scottmarlow/wildfly/tree/test_orm41_bundled" target="_blank">https://github.com/scottmarlow/wildfly/tree/test_orm41_bundled</a><br>
><br>
> [2] <a href="https://github.com/wildfly/wildfly/pull/7509" target="_blank">https://github.com/wildfly/wildfly/pull/7509</a><br>
><br>
><br>
> On 06/02/2015 08:15 PM, Sanne Grinovero wrote:<br>
>><br>
>> Hi Scott,<br>
>> finally got back on this upgrade. You were right, the problem is that<br>
>> JipiJapa figures out that I'm using Hibernate - even though I'm not<br>
>> hard coding the provider name, as in that case it will just default to<br>
>> Hibernate anyway - and because of that it's adding both the JPA<br>
>> adaptors for Hibernate 4 and the wrong version of the Hibernate<br>
>> dependencies as well.<br>
>><br>
>> This is the temporary solution I'm going to use:<br>
>><br>
>> <a href="https://github.com/hibernate/hibernate-search/commit/d2b05ef7511815d6c0a0779734b95a69cdcbf56d" target="_blank">https://github.com/hibernate/hibernate-search/commit/d2b05ef7511815d6c0a0779734b95a69cdcbf56d</a><br>
>><br>
>> Thanks for all pointers!<br>
>> Sanne<br>
>><br>
>><br>
>> On 1 June 2015 at 16:08, Scott Marlow <<a href="mailto:smarlow@redhat.com" target="_blank">smarlow@redhat.com</a>> wrote:<br>
>>><br>
>>> I suspect that this is a bug in WildFly that we need to track down. I'm<br>
>>> guessing that the condition is that we are trying to use a custom<br>
>>> Hibernate<br>
>>> module when there is an existing Hibernate module that matches the<br>
>>> Persistence provider name. Or something like that.<br>
>>><br>
>>><br>
>>> On 05/21/2015 07:30 AM, Sanne Grinovero wrote:<br>
>>>><br>
>>>><br>
>>>> Hi all,<br>
>>>> I'm attempting to deploy some integration tests on WildFly 9.0.0.CR1<br>
>>>> to use a preview of Hibernate ORM version 5.<br>
>>>><br>
>>>> It seems the JPA deployer isn't allowing me to run such experiments:<br>
>>>><br>
>>>> # First experiment - providerModule set to custom module<br>
>>>><br>
>>>> In my first attempt, I create a custom set of jboss modules which<br>
>>>> include the snapshot builds of ORM 5, add them to my standalone WF9<br>
>>>> instance and set the persistence.xml property:<br>
>>>> jboss.as.jpa.providerModule = my-custom-module-name<br>
>>>><br>
>>>> and then get:<br>
>>>><br>
>>>> Caused by: java.util.ServiceConfigurationError:<br>
>>>> org.hibernate.integrator.spi.Integrator: Provider<br>
>>>> org.hibernate.envers.boot.internal.EnversIntegrator not a subtype<br>
>>>> at java.util.ServiceLoader.fail(ServiceLoader.java:231)<br>
>>>> [rt.jar:1.7.0_51]<br>
>>>> at java.util.ServiceLoader.access$300(ServiceLoader.java:181)<br>
>>>> [rt.jar:1.7.0_51]<br>
>>>> at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:369)<br>
>>>> [rt.jar:1.7.0_51]<br>
>>>> at java.util.ServiceLoader$1.next(ServiceLoader.java:445)<br>
>>>> [rt.jar:1.7.0_51]<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:341)<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:57)<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:247)<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:520)<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:208)<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:188)<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:45)<br>
>>>> at<br>
>>>><br>
>>>> org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:57)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.<init>(TwoPhaseBootstrapImpl.java:38)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.hibernate4.HibernatePersistenceProviderAdaptor.getBootstrap(HibernatePersistenceProviderAdaptor.java:173)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.createContainerEntityManagerFactoryBuilder(PhaseOnePersistenceUnitServiceImpl.java:243)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access$800(PhaseOnePersistenceUnitServiceImpl.java:60)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:118)<br>
>>>> ... 7 more<br>
>>>><br>
>>>> Clearly it looks like I'm being served classes from the bundled<br>
>>>> Hibernate 4.x implementation - on top of those from the module I'm<br>
>>>> requesting. This isn't what the deployer should be doing, right?<br>
>>>><br>
>>>> # Second experiment - use the "application provided"<br>
>>>><br>
>>>> In this case I hope to hint the JPA deployer to not add the default<br>
>>>> implementor but look for a JPA implementation within my deployment,<br>
>>>> but still package my custom Hibernate build as a module.<br>
>>>><br>
>>>> - use the same custom module containing Hibernate ORM 5 (a preview<br>
>>>> snapshot)<br>
>>>> - Add a "Dependency:" section to the manifest to import (and export)<br>
>>>> my custom module<br>
>>>> - set the "jboss.as.jpa.providerModule" property to value<br>
>>>> "application"<br>
>>>><br>
>>>> This gets me:<br>
>>>><br>
>>>> Caused by:<br>
>>>> org.jboss.as.server.deployment.DeploymentUnitProcessingException:<br>
>>>> WFLYJPA0027: Persistence provider module load error application (class<br>
>>>> org.hibernate.jpa.HibernatePersistenceProvider)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:985)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:267)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleWarDeployment(PersistenceUnitServiceHandler.java:200)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:131)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)<br>
>>>> [wildfly-server-1.0.0.CR1.jar:1.0.0.CR1]<br>
>>>> ... 5 more<br>
>>>> Caused by: org.jboss.modules.ModuleNotFoundException: application:main<br>
>>>> at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:236)<br>
>>>> [jboss-modules.jar:1.4.3.Final]<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.persistenceprovider.PersistenceProviderLoader.loadProviderModuleByName(PersistenceProviderLoader.java:65)<br>
>>>> at<br>
>>>><br>
>>>> org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:978)<br>
>>>> ... 10 more<br>
>>>><br>
>>>> Remarks:<br>
>>>> - it's attempting to load the "application:main" module?! that's not<br>
>>>> what I'd expect from reading [1]<br>
>>>> - the provider should be available to the deployment classpath, so<br>
>>>> I'm not sure why it's not finding the Provider? (I'm even exporting<br>
>>>> it, although I'm not sure if that was required).<br>
>>>><br>
>>>> Any suggestions to get this running please?<br>
>>>><br>
>>>> Also I wonder if some of these should warrant opening a JIRA, but I'm<br>
>>>> not sure how far I misunderstood the intentions of these JPA deployer<br>
>>>> properties.<br>
>>>><br>
>>>> Thanks,<br>
>>>> Sanne<br>
>>>><br>
>>>> [1] -<br>
>>>><br>
>>>> <a href="https://docs.jboss.org/author/display/WFLY9/JPA+Reference+Guide#JPAReferenceGuide-Persistenceunitproperties" target="_blank">https://docs.jboss.org/author/display/WFLY9/JPA+Reference+Guide#JPAReferenceGuide-Persistenceunitproperties</a><br>
>>>><br>
>>><br>
><br>
_______________________________________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a><br>
</blockquote></div>