Salut,

Je veux réaliser une application web (applet + EJB3), tout d'abord, je me pose une question : est ce que les EJB3.0 remplacent ou peuvent remplacer les servlets, car je ne voit pas à quoi sert un EJB3 et je ne vois pas la différence entre une servlet et EJB3 donc si vous pouvez me l'expliquer, je veux bien.

Ensuite, j'ai essayé de dévelloper une application web, pour cela, j'ai créé une applet où il y a un bouton et lorsque je clique sur le bouton je fais appel à une fonction que j'ai définit dans mon EJB qui est sayHello, et j'ai un textArea dans le quel il devrait s'afficher hello World, mais ça ne marche pas.

Voici le code de mon applet :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
public class fenetre1 extends JApplet{
 
JTabbedPane jtp = new JTabbedPane();
public void init(){
   setLayout(new BorderLayout());
 
   b1 = new JButton("ok");
   b1.addActionListener(this);
 
   JTexeArea jta = new JTextArea();
 
   this.add(b1,BorderLayout.SOUTH);
Voici le code de mon ejb : interface

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
package ejb;
import javax.ejb.*; 
 
@Remote 
public interface SimpleBean {
 	public String sayHello(String name);
}
implémentation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
package ejb;
import javax.ejb.*; 
 
@Stateless(name="Example", mappedName="ejb/SimpleBeanJNDI") 
public class SimpleBeanImpl implements SimpleBean {
    public String sayHello(String name) { 	
        return "Hello World"; 	
    } 
}
Voici enfin l'erreur :

javax.naming.CommunicationException: Cannot connect to ORB [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe]
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(Unknown Source)
at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(Unknown Source)
at com.sun.jndi.cosnaming.CNCtx.<init>(Unknown Source)
at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at panneau.boutonDocument.runTest(boutonDocument.java:208)
at panneau.boutonDocument.actionPerformed(boutonDocument.java:241)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(Unknown Source)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBits(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.handleEvent(Unknown Source)
at com.sun.corba.se.impl.transport.SelectorImpl.run(Unknown Source)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 211 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(Unknown Source)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.readGIOPHeader(Unknown Source)
at com.sun.corba.se.impl.transport.CorbaContactInfoBase.createMessageMediator(Unknown Source)
... 3 more
Caused by: java.io.IOException: End-of-stream
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readFully(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.read(Unknown Source)
... 5 more


Dernière précision : mon serveur d'application est GlassFish

Merci pour vos réponses