[
https://issues.jboss.org/browse/ARQ-510?page=com.atlassian.jira.plugin.sy...
]
Andrew Rubinger edited comment on ARQ-510 at 7/14/11 2:15 PM:
--------------------------------------------------------------
This isn't really an Arquillian issue. The reason this occurs is because the
ShrinkWrapClassloader creates a URL with custom protocol, and attaches a valid
URLStreamHandler to the URL so that it can be read. Hibernate in turn is taking this URL
and reconstructing it from some of its pieces to make a new one, along the way losing the
handler. Like this:
${code}final URL resource = shrinkWrapClassLoader.getResource(resourceName);
// Great, we already have a working URL.
// Now reconstruct the URL by composition of its pieces
try
{
new URL(resource.getProtocol(), resource.getHost(), resource.getPort(),
resource.getFile());
}
catch (final MalformedURLException murle)
{
// Blow up
Assert.fail("Malformed URL should not be received when reconstructing a new
URL from pieces of the one we already have");
} ${code}
That is being done here:
https://github.com/ALRubinger/hibernate-core/blob/master/hibernate-entity...
So I contend that it's Hibernate with the bug, not Arquillian or even ShrinkWrap.
was (Author: ALRubinger):
This isn't really an Arquillian issue. The reason this occurs is because the
ShrinkWrapClassloader creates a URL with custom protocol, and attaches a valid
URLStreamHandler to the URL so that it can be read. Hibernate in turn is taking this URL
and reconstructing it from some of its pieces to make a new one, along the way losing the
handler. Like this:
[code]final URL resource = shrinkWrapClassLoader.getResource(resourceName);
// Great, we already have a working URL.
// Now reconstruct the URL by composition of its pieces
try
{
new URL(resource.getProtocol(), resource.getHost(), resource.getPort(),
resource.getFile());
}
catch (final MalformedURLException murle)
{
// Blow up
Assert.fail("Malformed URL should not be received when reconstructing a new
URL from pieces of the one we already have");
} [code]
That is being done here:
https://github.com/ALRubinger/hibernate-core/blob/master/hibernate-entity...
So I contend that it's Hibernate with the bug, not Arquillian or even ShrinkWrap.
Can't load persistence.xml from ShrinkWrap Classloader using
Hibernate
----------------------------------------------------------------------
Key: ARQ-510
URL:
https://issues.jboss.org/browse/ARQ-510
Project: Arquillian
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Weld Containers
Affects Versions: weld-1.0.0.CR1
Environment: Windows 7.
Reporter: Michal Huniewicz
Labels: hibernate
I got this while letting Hibernate load my persistence.xml.
java.lang.RuntimeException: Could not inject members
at
org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:135)
at
org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.enrich(CDIInjectionEnricher.java:78)
at
org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:130)
at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:95)
at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:198)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)
at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:216)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:161)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:123)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.persistence.PersistenceException: Unable to configure
EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:378)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at
org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.MockJpaInjectionServices.initialiseEntityManager(MockJpaInjectionServices.java:54)
at
org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.MockJpaInjectionServices.resolvePersistenceContext(MockJpaInjectionServices.java:38)
at org.jboss.weld.util.Beans.injectEEFields(Beans.java:781)
at
org.jboss.weld.manager.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:119)
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:54)
at org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:114)
at
org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectNonContextualInstance(CDIInjectionEnricher.java:145)
at
org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:125)
... 65 more
Caused by: java.lang.IllegalArgumentException: Unable to determine JAR Url from
archive:JpaDogRepositoryExplicitSetTest.jar/META-INF/persistence.xml. Cause: unknown
protocol: archive
at
org.hibernate.ejb.packaging.JarVisitorFactory.getJarURLFromURLEntry(JarVisitorFactory.java:90)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:344)
... 76 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira