JBoss Bean EJB n'est pas lié
J'ai l'erreur suivante
Exception in thread "main" javax.naming.NameNotFoundException: CounterBean not bound
en essayant d'accéder à un EJB CounterBean.jar déployé sur JBoss5 partir d'une application client en dehors de l'Application Serveur.
À partir du journal de Jboss, on dirait qu'il n'a pas un nom JNDI global? Est-ce ok?
Qu'ai-je fait de mal?
Journal de JBoss:
13:50:39,669 INFO [JBossASKernel] Created KernelDeployment for: Counter.jar
13:50:39,672 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=Counter.jar,name=CounterBean,service=EJB3
13:50:39,672 INFO [JBossASKernel] with dependencies:
13:50:39,672 INFO [JBossASKernel] and demands:
13:50:39,673 INFO [JBossASKernel] partition:partitionName=DefaultPartition; Required: Described
13:50:39,673 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
13:50:39,673 INFO [JBossASKernel] and supplies:
13:50:39,673 INFO [JBossASKernel] jndi:CounterBean
13:50:39,673 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=Counter.jar,name=CounterBean,service=EJB3) to KernelDeployment of: Counter.jar
13:50:39,712 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=Counter.jar,name=CounterBean,service=EJB3
13:50:39,727 INFO [EJBContainer] STARTED EJB: com.don.CounterBean ejbName: CounterBean
13:50:39,732 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
Le code du client est:
public static void main(String[] args) throws NamingException, InterruptedException {
InitialContext ctx = new InitialContext();
Counter s = (Counter)ctx.lookup("CounterBean/remote");
for(int i = 0; i < 100; i++ ) {
s.printCount(i);
Thread.sleep(1000);
}
}
Message d'erreur:
java -Djava.naming.provider.url=jnp://123.123.123.123:1099 -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory com.don.Client
Exception in thread "main" javax.naming.NameNotFoundException: CounterBean not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.don.Client.main(Client.java:10)
OriginalL'auteur Lydon Ch | 2010-03-14
Vous devez vous connecter pour publier un commentaire.
C'est ce que j'obtiens quand je déployer un simple Bean Session sans état (SLSB) avec une interface à distance sur JBoss 5.x:
Quand je regarde la trace que vous avez fournies, je ne peux pas voir tout ce qui est lié à l'interface à distance (que vous aurez besoin pour un appel à distance) et par conséquent, aucun nom JNDI. La question est donc: est-ce que votre SLSB définir et mettre en œuvre une interface à distance correctement?
Dans mon cas, mon haricot est définie comme ceci:
Et la distance de l'interface ressemble:
Avez-vous quelque chose de semblable?
OriginalL'auteur Pascal Thivent