Problem en testant le module ejb

cs_Mimamima Messages postés 9 Date d'inscription dimanche 28 novembre 2010 Statut Membre Dernière intervention 26 décembre 2011 - 10 mai 2011 à 21:33
cs_Mimamima Messages postés 9 Date d'inscription dimanche 28 novembre 2010 Statut Membre Dernière intervention 26 décembre 2011 - 11 mai 2011 à 12:02
Bonsoir à tous,
J'essayer de tester mon module ejb en crayant une classe java qui contient le code suivant :
package test;

import javax.naming.InitialContext;
import javax.naming.NamingException;
public class test {
public static void main(String[] args) throws NamingException {

InitialContext ctx = new InitialContext();
testRemote cfr = (testRemote)ctx.lookup("java:global/MySingleton");
System.err.println("EJB message is: " + cfr.getResult());

}}
le saission bean contient le code suivat:
package test;

import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Stateless;

@Stateless
@Singleton
@EJB(name="java:global/MySingleton", beanInterface=testRemote.class)
public class test implements testRemote {
public String getResult() {
return "This is EJB 3.0 Bean";}
}
l'erreur qui s'affiche et le suivant :
java.lang.NoSuchMethodError: main
Exception in thread "main" Java Result: 1
Avez vous une idée?
Merci d'avance.

2 réponses

cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 371
11 mai 2011 à 10:59
Tu devrais peut être catcher ton exception dans la main au lieu de la propager.
0
cs_Mimamima Messages postés 9 Date d'inscription dimanche 28 novembre 2010 Statut Membre Dernière intervention 26 décembre 2011
11 mai 2011 à 12:02
Merci Julien39, mais l'erreur devient :
com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3452)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:256)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:269)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:125)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:188)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:186)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:352)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
at com.sun.enterprise.naming.impl.SerialContext.narrowProvider(SerialContext.java:355)
at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:327)
at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javaapplication3.Main.main(Main.java:28)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:239)
... 13 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:106)
at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)
... 14 more
Exception in thread "main" javax.naming.NamingException: Lookup failed for 'java:global/MySingleton' in SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javaapplication3.Main.main(Main.java:28)
Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]
at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:276)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
... 2 more
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)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3452)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:256)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:269)
at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:125)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:188)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:186)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:352)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
at com.sun.enterprise.naming.impl.SerialContext.narrowProvider(SerialContext.java:355)
at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:327)
at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
... 3 more
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:239)
... 13 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:106)
at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)
... 14 more
0
Rejoignez-nous