tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CodeMonkey <ccaspane...@gmail.com>
Subject URISyntaxException when creating PersistenceUnit for Test
Date Tue, 19 Feb 2013 16:01:09 GMT
I am following one of the Examples on the TomEE site however, I get an
IllegalArguementException when creating the PersistenceUnit.  Any ideas?

Thanks,
CodeMonkey

java.lang.IllegalArgumentException
	at java.net.URI.create(URI.java:841)
	at
org.apache.openejb.config.PersistenceModule.setRootUrl(PersistenceModule.java:45)
	at
org.apache.openejb.config.PersistenceModule.<init>(PersistenceModule.java:35)
	at
org.apache.openejb.junit.ApplicationComposer$DeployApplication.evaluate(ApplicationComposer.java:414)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	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:\MOVIE\MOVIE_JPA\build\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)
	... 18 more

[code]
@RunWith(ApplicationComposer.class)
public class MovieBeanTest extends TestCase
{
	private static final String UNIT_NAME = "jdbcMovie";

	@EJB
	private MovieBean movieBean;

	@Module
	public PersistenceUnit persistence()
	{
		PersistenceUnit unit = new PersistenceUnit(UNIT_NAME);
		unit.setJtaDataSource("movieDatabase");
		unit.setProperty("openjpa.jdbc.SynchronizeMappings",
"buildSchema(ForeignKeys=true)");
		return unit;
	}

	@Module
	public EjbJar beans()
	{
		EjbJar ejbJar = new EjbJar("MOVIE_EJB.jar");
		ejbJar.addEnterpriseBean(new StatefulBean(MovieBean.class));
		return ejbJar;
	}

	@Configuration
	public Properties config() throws Exception
	{
		Properties p = new Properties();
		p.put("movieDatabase", "new://Resource?type=DataSource");
		p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
		p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
		return p;
	}

	@Test
	public void test() throws Exception
	{
		movieBean.insert(new Movie("Movie 1", 1992));
		movieBean.insert(new Movie("Movie 2", 1996));
		movieBean.insert(new Movie("Movie 3", 1998));

		List<Movie> list = movieBean.getAll();
		assertEquals("List.size()", 3, list.size());

		for (Movie movie : list)
		{
			movieBean.delete(movie);
		}

		assertEquals("Movies.getMovies()", 0, movieBean.getAll().size());
	}
}
[/code]



--
View this message in context: http://openejb.979440.n4.nabble.com/URISyntaxException-when-creating-PersistenceUnit-for-Test-tp4660898.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message