Problème de test unitaire d'EJB

Nicolas Delsaux <[email protected]> Thu, 24 Mar 2011 15:58:40 +0100
Newsgroups gmane.comp.java.french.general
Message-ID <[email protected]>
Salut
je suis en traind e me lancer dans le grand bain de JavaEE 6 avec des
EJB 3.1. Pour ça, j'ai fait un test "bindon" suivant l'exemple du
bouquin d'A. Goncalvez :

public class TemplateEJBImplTest {

	private static EJBContainer container;
	private static Context context;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		Map properties = new HashMap();
		properties.put(EJBContainer.MODULES, new File("target/classes"));
		container = EJBContainer.createEJBContainer(properties);
		context = container.getContext();
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		container.close();
	}

	@Test
	public void testClassicOperationsWithRemote() throws NamingException {
		Template t = new Template();
		String templateName = "template for "+getClass().getName();
		t.setName(templateName);
		t.setComments("this is a test template that should not be used
outside of them");
		TemplateEJBRemote ejb = (TemplateEJBRemote)
context.lookup("java:global/"+NamingConstants.PERSISTENCE_CONTEXT+"/"+TemplateEJBRemote.class.getSimpleName());
		// Ensure book is correctly created


/* La fin nous intéresse moins */

Seulement, quand je lance ce test, dans Eclipse ou dans Maven, j'ai
une "sale" exception qui apparaît au bout d'un moment :

24 mars 2011 15:50:13
com.sun.jts.CosTransactions.DefaultTransactionService identify_ORB
ATTENTION: jts.unexpected_error_when_creating_poa
org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
	....
Caused by: org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201
completed: No
	at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431)
	....
Caused by: java.lang.RuntimeException: java.net.ConnectException:
Connection refused: connect
	at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
	....
Caused by: java.net.ConnectException: Connection refused: connect
	at sun.nio.ch.Net.connect(Native Method)
	....


Vous auriez une idée d'où ça peut venir ?


-- 
Nicolas Delsaux