Hi Archive url issue is due to the arquillian adapter (so no problem for data module)
Can't the other one be fixed using @Typed? Le 1 sept. 2014 21:41, "John D. Ament" <[email protected]> a écrit : > Hi All! > > I've hit a couple of issues with the Data Module and wanted to know if it > was worth fixing. > > First, my sample app can be found at [1] (note you'll need JDK8 to run) and > you can run the test JPATest to see the results, using > > mvn -Dtest=JPATest -Ddeltaspike.version=1.0.2 > > First issue you'll note is that the following output (or something similar > to it will be given): > > java.lang.IllegalArgumentException: URL does not exist: > archive:se-examples.jar/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:73) > > (full stack available at [2], test.log). It seems like the > RepositoryExtension is picking up on my persistence.xml and aggressively > trying to parse them (at this point, I don't have any @Repository's defined > in my app). For some reason it cannot parse this URL but it does seem to > pick up the persistence.xml from target/classes/META-INF so it does > eventually parse it. To work around this, I wrapped > DescriptorReader.readAllFromClassPath's result.add with an exception check. > I figure if it can't read the descriptor, no reason to make the whole app > die. What do you think? > > Second issue, after fixing this one, was that AbstractEntityRepository was > being picked up as a @Repository and erroring out saying that there's no > entity for it. This one I wasn't expecting. To fix it, in > RepsitoryComponents, I added an explicit check if it was the base class, if > it was return null rather than exception and check for null in the add > method. This also fixed things and the tests started running fine. This > fix seems more hacky, and I'm wondering if I'm just doing something wrong > to make this class be picked up. > > You can see the summary of changes in the gist's patch.txt. > > John > > > [1]: https://github.com/johnament/restful-and-beyond-tut2184 > [2]: https://gist.github.com/johnament/d4a55ce7251062ee0b85 >
