tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amber <ambe...@hotmail.fr>
Subject Re: openEJB fail on second test
Date Thu, 23 Feb 2012 16:25:40 GMT
just adding a println : 

public List<Movie> foo() { 
		  Query query = entityManager.createQuery("SELECT m from Movie m");
		  List<Movie> movies = query.getResultList();
		  System.out.println("movies.size() = " + movies.size()); 
		  return movies; 
		} 



giving :

movies.size() = 2
movies.size() = 0


amber wrote
> 
> sure here the code :
> 
> public void testWSCreateDelete() throws Exception {
> 		Service movieService = Service.create(new
> URL("http://127.0.0.1:4204/Movies?wsdl"), new
> QName("http://superbiz.org/wsdl", "MoviesWebService"));
> 		assertNotNull(movieService);
> 
> 		IMoviesWS mv = movieService.getPort(IMoviesWS.class);
> 		
> 		mv.addMovie(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992));
> 		mv.addMovie(new Movie("Joel Coen", "Fargo", 1996));
> 		
> 		List<Movie> list = mv.foo();
> 		assertEquals("List.size()", 2, list.size());
> 		
> 		for (Movie movie : list) {
> 			mv.deleteMovie(movie);
> 		}
> 		
> 		List<Movie> list2 = mv.foo();
> 
> *// return null*
> 		assertEquals("List2.size()", 0, list2.size());
> 	}
> 
> 
> 
> the movies bean :
> 	public List<Movie> foo() { 
> 		  Query query = entityManager.createQuery("SELECT m from Movie m");
> 		  List<Movie> movies = query.getResultList();
> 		  movies.size(); 
> 		  return movies; 
> 		} 
> 
> the trace :
> 
> 
> 
> java.lang.NullPointerException
> 	at org.superbiz.altdd.MoviesTest.testWSCreateDelete(MoviesTest.java:128)
> 	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 junit.framework.TestCase.runTest(TestCase.java:168)
> 	at junit.framework.TestCase.runBare(TestCase.java:134)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:124)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:232)
> 	at junit.framework.TestSuite.run(TestSuite.java:227)
> 	at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
> 	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)
> 
> 
> I added too the foo() to the Ws interface and the MovieLocal interface
> 
> 
> Romain Manni-Bucau wrote
>> 
>> can you try doing something like this please?
>> 
>> List foo() {
>>   List movies = ...;
>>   movies.size();
>>   return movies;
>> }
>> 
>> - Romain
>> 
>> 
>> 2012/2/23 amber &lt;amber63@&gt;
>> 
>>> ok for the "as" keyword )
>>>
>>> the difference is on the Web Service that failed on the "select m from
>>> Movie
>>> m" after a delete operation, works fine when I pass through the @EJB
>>> injection (like your code)
>>>
>>> the getMovies() return an empty List (debugger mark the return value as
>>> [])
>>> as expected (we deleted content just before) but from the caller the
>>> pointer
>>> is set to null. I don't understand why.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://openejb.979440.n4.nabble.com/openEJB-fail-on-second-test-tp4401889p4414214.html
>>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>>
>> 
> 


--
View this message in context: http://openejb.979440.n4.nabble.com/openEJB-fail-on-second-test-tp4401889p4414347.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message