[jboss-user] [EJB/JBoss] - Re:

ANDRIA-NTOANINA do-not-reply at jboss.com
Thu Nov 9 08:15:44 EST 2006


Here's now my Application-client.xml file:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <application-client version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd">
  |         <display-name>MFEA-client</display-name>
  |         <ejb-ref>
  |             <ejb-ref-name>ejb/BeanSessionBean</ejb-ref-name>
  |             <ejb-ref-type>Session</ejb-ref-type>
  |             <home>bean.BeanSessionLocal</home>
  |             <remote>bean.BeanSessionRemote</remote>
  |         </ejb-ref>
  | </application-client>
  | 

jboss-client.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | <jboss-client>
  |   <jndi-name>MFEA-client</jndi-name>
  |     <ejb-ref>
  |     <ejb-ref-name>ejb/BeanSessionBean</ejb-ref-name>
  |     <jndi-name>BeanSessionBean</jndi-name>
  |     </ejb-ref>
  | </jboss-client>
  | 

my jndi.properties:

  | java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
  | java.naming.provider.url=jnp://localhost:1099
  | java.naming.factory.url.pkgs=org.jboss.naming.client
  | j2ee.clientName=MFEA-client
  | 

My beans:



  | *
  |  * BeanSessionBean.java
  |  *
  |  * Created on 8 novembre 2006, 17:00
  |  *
  |  * To change this template, choose Tools | Template Manager
  |  * and open the template in the editor.
  |  */
  | 
  | package bean;
  | 
  | import javax.ejb.Remote;
  | import javax.ejb.Stateless;
  | 
  | /**
  |  *
  |  * @author hrm
  |  */
  | @Stateless
  | public class BeanSessionBean implements bean.BeanSessionRemote, bean.BeanSessionLocal {
  |     
  |     /** Creates a new instance of BeanSessionBean */
  |     public BeanSessionBean() {
  |     }
  |     public double AriaryToFmg(double ariary)
  |     {
  |         return ariary/5;
  |     }
  |     
  | }
  | 

My local:

  | 
  | package bean;
  | 
  | import javax.ejb.Local;
  | 
  | 
  | /**
  |  * This is the business interface for BeanSession enterprise bean.
  |  */
  | @Local
  | public interface BeanSessionLocal {
  |     
  | }

My Remote

  | 
  | package bean;
  | 
  | import javax.ejb.Remote;
  | import org.jboss.annotation.ejb.RemoteBinding;
  | 
  | 
  | /**
  |  * This is the business interface for BeanSession enterprise bean.
  |  */
  | @RemoteBinding(jndiBinding="MySession")
  | public interface BeanSessionRemote {
  |     public double AriaryToFmg(double ariary);
  | }

and now my AppClient:

  |  public static void main(String[] args) {
  |         
  |         try {
  |                     Context c = new InitialContext();
  |                     Context ce = (Context)c.lookup("java:comp/env/ejb");
  |                     Object b = c.lookup("java:comp/env/ejb/BeanSessionBean");
  |                     
  |                     
  |                     /*NamingEnumeration li = ce.list("");
  |                     while(li.hasMore())
  |                     {
  |                         NameClassPair a= (NameClassPair)li.next();
  |                         System.out.println("ClassName="+a.getClassName()+" Name="+a.getName());;
  |                     }*/
  |         } catch (NamingException ex) {
  |             ex.printStackTrace();
  |         }
  |     }
  | 

And I got the next exception:

  | javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: BeanSessionBean not bound]
  |         at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1052)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:685)
  |         at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:120)
  |         at $Proxy0.lookup(Unknown Source)
  |         at javax.naming.InitialContext.lookup(InitialContext.java:351)
  |         at myfirstenterpriseapplication.Main.main(Main.java:43)
  | Caused by: javax.naming.NameNotFoundException: BeanSessionBean not bound
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
  |         at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
  |         at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
  |         at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
  |         at sun.rmi.transport.Transport$1.run(Transport.java:153)
  |         at java.security.AccessController.doPrivileged(Native Method)
  |         at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
  |         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
  |         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
  |         at java.lang.Thread.run(Thread.java:595)
  |         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
  |         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
  |         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
  |         at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
  |         at javax.naming.InitialContext.lookup(InitialContext.java:351)
  |         at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1046)
  |         ... 5 more
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984503#3984503

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984503



More information about the jboss-user mailing list