Ove,

Please try the same thing I did - don't include persistence.xml in your JAR
file.  Assuming it's in the right spot on your classpath, it should still
get picked up when running embedded.

I was planning to add a failDeploymentIfPersistenceXmlNotReadable to
apache-deltaspike.properties to handle this case.  By default you would get
the current behaviour, but you could turn it off if you so choose.  I
simply didn't have time before J1 to fix it.  WDYT?

John

On Sat, Oct 11, 2014 at 5:23 AM, Ove Ranheim <[email protected]> wrote:

> Hi Thomas
>
> I created this issue: https://issues.apache.org/jira/browse/DELTASPIKE-740
> .
>
> Thanks for point out John's posting.
>
> Best regards
> Ove
>
> On 10 Oct 2014, at 09:47, Thomas Hug <[email protected]> wrote:
>
> > Hi Ove
> >
> > AFAIR John ran into similar issues recently, see
> >
> http://mail-archives.apache.org/mod_mbox/deltaspike-dev/201409.mbox/%3ccaoqetn9hat9yiorqtsafbo5ysmntngaqpet4bnxtw9-czw5...@mail.gmail.com%3E
> >
> > The reason we look for persistence.xml is to extract the orm.xml files -
> > we're mainly interested in those as they define entities, primary keys
> etc.
> > which is cached for later usage. Agree that failing deployments might be
> > too aggressive. An option would be to have a dedicated extension for
> > scanning which can be deactivated (as most use cases will have annotation
> > based entities anyway).
> >
> > On Fri, Oct 10, 2014 at 8:13 AM, Ove Ranheim <[email protected]> wrote:
> >
> >> Hi,
> >>
> >> I have a test case that uses jpa-module and hibernate; using
> >>
> org.jboss.arquillian.container:arquillian-weld-ee-embedded-1.1:1.0.0.CR8.
> >> The persistence.xml and the test case works correctly.
> >>
> >> When I add the data-module, it tries to load the persistence.xml over
> >> again and it fails with: URL does not exist:
> >> archive:test.war/WEB-INF/classes/META-INF/persistence.xml
> >>
> >> * Is there a way to disable DescriptorReader to load persistence.xml?
> >> * Why does data-module load the persistence.xml?
> >> * Any other way to circumvent this problem?
> >> * Is this a bug?
> >>
> >> I read through Mark's blog post:
> >>
> http://struberg.wordpress.com/2012/03/27/unit-testing-strategies-for-cdi-based-projects/
> ,
> >> which indicates that this may be due to a  classloading issue. The
> links to
> >> Arquillian Wiki is broken (under "Embedded style Arquillian tests"), so
> I'm
> >> a bit lost.
> >>
> >> Regards
> >> Ove
> >>
> >>
> >> INFO: class: org.apache.deltaspike.data.impl.RepositoryExtension
> >> activated=true
> >> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> >> -123,542.439 sec <<< FAILURE! - in
> >> org.jboss.weld.WeldTransactionServicesTest
> >> org.jboss.weld.WeldTransactionServicesTest  Time elapsed: -123,542.44
> sec
> >> <<< ERROR!
> >> org.jboss.weld.exceptions.DefinitionException: Exception List with 1
> >> exceptions:
> >> Exception 0 :
> >> java.lang.IllegalArgumentException: URL does not exist:
> >> archive:test.war/WEB-INF/classes/META-INF/persistence.xml
> >>        at
> >>
> org.apache.deltaspike.data.impl.meta.unit.DescriptorReader.readFromUrl(DescriptorReader.java:64)
> >>        at
> >>
> org.apache.deltaspike.data.impl.meta.unit.DescriptorReader.readAllFromClassPath(DescriptorReader.java:50)
> >>        at
> >>
> org.apache.deltaspike.data.impl.meta.unit.PersistenceUnitReader.readAll(PersistenceUnitReader.java:37)
> >>        at
> >>
> org.apache.deltaspike.data.impl.meta.unit.PersistenceUnits.readPersistenceXmls(PersistenceUnits.java:98)
> >>        at
> >>
> org.apache.deltaspike.data.impl.meta.unit.PersistenceUnits.init(PersistenceUnits.java:45)
> >>        at
> >>
> org.apache.deltaspike.data.impl.RepositoryExtension.beforeBeanDiscovery(RepositoryExtension.java:74)
> >>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>        at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> >>        at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>        at java.lang.reflect.Method.invoke(Method.java:483)
> >>        at
> >>
> org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:90)
> >>        at
> >>
> org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:271)
> >>        at
> >>
> org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:121)
> >>        at
> >>
> org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:258)
> >>        at
> >>
> org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:237)
> >>        at
> >>
> org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:174)
> >>        at
> >>
> org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:133)
> >>        at
> >>
> org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:107)
> >>        at
> >>
> org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:54)
> >>        at
> >>
> org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:42)
> >>        at
> >>
> org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:45)
> >>        at
> >>
> org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:385)
> >>        at
> >>
> org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:76)
> >>        at
> >>
> org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer.startContainer(TestContainer.java:273)
> >>        at
> >>
> org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer.deploy(WeldEEMockContainer.java:105)
> >>        at
> >>
> org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
> >>        at
> >>
> org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
> >>        at
> >>
> org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
> >>        at
> >>
> org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
> >>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>
> >>
> >>
> >>
> >>
>
>

Reply via email to