Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.5.1
-
None
-
None
-
Windows 7x64, JDK 1.7
Description
When I try to define a PersistenceUnit with ApplicationComposer like this:
@Module
public PersistenceUnit persistence() {
PersistenceUnit unit = new PersistenceUnit("test", "org.hibernate.ejb.HibernatePersistence");
unit.addClass(Message.class);
unit.setProperty("hibernate.hbm2ddl.auto", "create-drop");
return unit;
}
I get the following stacktrace (only if a persistence.xml is already found on the classpath):
java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:841)
at org.apache.openejb.util.URLs.uri(URLs.java:105)
at org.apache.openejb.config.PersistenceModule.setRootUrl(PersistenceModule.java:52)
at org.apache.openejb.config.PersistenceModule.<init>(PersistenceModule.java:41)
at org.apache.openejb.testing.ApplicationComposers.before(ApplicationComposers.java:414)
at org.apache.openejb.testing.ApplicationComposers.evaluate(ApplicationComposers.java:590)
at org.apache.openejb.junit.ApplicationComposer$DeployApplication.evaluate(ApplicationComposer.java:64)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
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: java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\dev\myproject\target\classes
at java.net.URI$Parser.fail(URI.java:2810)
at java.net.URI$Parser.checkChars(URI.java:2983)
at java.net.URI$Parser.parse(URI.java:3020)
at java.net.URI.<init>(URI.java:577)
at java.net.URI.create(URI.java:839)
... 21 more
I think the cause could be in the method ApplicationComposers.implicitRootUrl(): I think the use of File.getAbsolutePath() should be changed to File.toURI().toASCIIString().