EJB3/JNDI problem with swing client

Discussion in 'Java' started by sveta, Aug 17, 2006.

  1. sveta

    sveta Guest

    Hi all,
    i'm a newbie in J2EE and now try to test simple stateless session bean
    (EJB3) on JBOSS 4.0.4GA with Swing client.
    The problem is - when running the client on the same java machine as
    jboss everithing is ok, but when i try to run client from another
    machine - lookup of the bean failes.

    What am i doing wrong?
    How can i get to know which jndi name to use in lookup()? Can i see it
    somewhere in "jmx-console" of jboss? How jndi-name in lookup() differs
    accoding to witch java machine it is running on?

    My texts are:
    -----------------------DirManager.java-------------------------------------
    package cis.sessionbeans.dir;

    import java.util.*;
    import javax.ejb.Remote;

    @Remote
    public interface DirManager {
    public List<Person> listPeople();
    public void savePerson(Person p);
    }

    -----------------------DirManagerBean.java------------------------------

    package cis.sessionbeans.dir;

    import javax.ejb.*;
    import javax.persistence.*;

    @Stateless
    public class DirManagerBean implements DirManager{

    @PersistenceContext(unitName="cis")
    private EntityManager em;

    public List <Person> listPeople(){
    ...some code...
    }

    public void savePerson(Person p) {
    ...some code...
    }
    }
    ------------------------CISClient.java----------------------------------------

    ....some code...

    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
    props.setProperty("java.naming.provider.url","jnp://myiphere:1099");
    props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:eek:rg.jnp.interfaces");
    InitialContext ctx = new InitialContext(props);
    Object ref = (Object)ctx.lookup("CIS/DirManagerBean/remote");

    ....some code...



    To tell the truth, accoding to the tutorial i should write
    lookup("DirManagerBean/remote") , but it doesn't work. I've found the
    name "CIS/DirManagerBean/remote" after experiments, where CIS - the
    name of ear (?)

    really need your help
    thanks

    Sveta

    p.s. sory for bad English
     
    sveta, Aug 17, 2006
    #1
    1. Advertising

  2. sveta

    sveta Guest

    I've solved the problem.
    The matter was in absence of library jboss-aop-jdk50.jar in the
    classpath

    Sveta
     
    sveta, Aug 21, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike S
    Replies:
    0
    Views:
    23,014
    Mike S
    Sep 16, 2004
  2. Mick
    Replies:
    2
    Views:
    9,555
    Marcin Grunwald
    Feb 23, 2005
  3. natG
    Replies:
    5
    Views:
    1,020
    Danno
    May 8, 2007
  4. Morpheus

    EJB3 App Deployment problem

    Morpheus, May 7, 2007, in forum: Java
    Replies:
    0
    Views:
    260
    Morpheus
    May 7, 2007
  5. Tom Anderson
    Replies:
    0
    Views:
    434
    Tom Anderson
    Apr 22, 2011
Loading...

Share This Page