Community

Error working wih EJB3, Struts2 & JBoss 4.2GA

reply from NAG Kum in EJB 3.0 - View the full discussion

Hi Wolfgang,

 

Client Code :

 

ServiceLocator.getEJB :

 

public static Object getEJB(String jndiName) {
        Object object = null;
        Context ctx = null;
        try {
            ctx = new InitialContext();
            object = ctx.lookup(jndiName);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return object;
    }

 

public static final String RemoteJNDIName =  "AuthenticationBean/remote";

AuthenticationRemote authEjb = (AuthenticationRemote)ServiceLocator.getEJB(AuthenticationBean.RemoteJNDIName);
            System.out.println("EJB Look up successfull "); 

 

Jndi View :

 

+- AuthenticationBean (class: org.jnp.interfaces.NamingContext)   |   +- remote (class: org.jnp.interfaces.NamingContext)   |   |   +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)   |   |   +- metaData (class: org.jboss.metadata.client.jboss.JBossClientMetaData)   |   |   +- env (class: org.jnp.interfaces.NamingContext)   |   |   |   +- com.tarangtech.mtg.authentication.AuthenticationBean[link -> AuthenticationBean/remote] (class: javax.naming.LinkRef)   |   |   +- classPathEntries (class: java.util.ArrayList)

 

Pls find jboss-client.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-client PUBLIC
    "-//JBoss//DTD Application Client 5.0//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-client_5_0.dtd">
<jboss-client>
   
    <jndi-name>AuthenticationBean/remote</jndi-name>
    <ejb-ref>       
        <ejb-ref-name>com.tarangtech.mtg.authentication.AuthenticationBean</ejb-ref-name>
        <jndi-name>AuthenticationBean/remote</jndi-name>                   
    </ejb-ref>
   
</jboss-client>

 

Pls .. suggest me as it is urgent ......

 

Regds,

NK

Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community