Migration Issue :: JBoss 4 with EJB 2.1 to JBoss 7.1
debashish2016 Feb 24, 2016 5:58 AMHi All,
I am in the process of Migration of an Application which was developed in EJB 2.1 and was hosted in JBoss 4.
We are moving to JBoss 7.1.
I have below files for EJB.
Remote
public interface Authenticator extends javax.ejb.EJBObject
{
public boolean validateUser(String loginId,String systemName,String password,Integer organizationId)throws RemoteException,java.sql.SQLException;
}
Home
public interface AuthenticatorHome extends javax.ejb.EJBHome
{
public Authenticator create() throws CreateException,RemoteException;
}
Bean
public boolean validateUser(String loginId,String systemName,String password,Integer organizationId)throws RemoteException,java.sql.SQLException
{
System.out.println("AuthenticatorBean::validateUser() method called");
return true;
}
ejb-jar.xml
<ejb-jar> |
<enterprise-beans>
<session>
<ejb-name>AuthenticatorSessionEJB</ejb-name>
<home>com.myapp.authenticator.AuthenticatorHome</home>
<remote>com.myapp.authenticator.Authenticator</remote>
<ejb-class>com.myapp.authenticator.AuthenticatorBean</ejb-class>
<session-type>Stateless</session-type> | |
<transaction-type>Container</transaction-type> | |
</session> |
</enterprise-beans>
</ejb-jar> |
jboss.xml
<jboss>
<enterprise-beans>
<session>
<ejb-name>AuthenticatorSessionEJB</ejb-name>
<jndi-name>AuthenticatorSessionJNDI</jndi-name>
</session>
</enterprise-beans>
</jboss>
EJB Client class
final Hashtable<String, String> p = new Hashtable<String, String>();
p.put( Context.PROVIDER_URL, "remote://127.0.0.1:4447" );
p.put( Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming" );
p.put( Context.SECURITY_PRINCIPAL, "appuser" );
p.put( Context.SECURITY_CREDENTIALS, "appuser123" );
p.put( Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory" );
ctx =new javax.naming.InitialContext(p);
String jndiString = "java:app/AuthenticatorSessionJNDI";
ref = ctx.lookup(jndiString);
Authenticator statelessAuthenticator = (Authenticator) ref;
statelessAuthenticator.validateUser("1", "1", "1", 1);
I have gone through some tutorials regarding the strict JNDI naming conventions used for JBoss 7.1. As per the link https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project
I am unable to invoke the Bean. I guess this is due to the JNDI configuration which I have done in files ejb-jar.xml, jboss.xml and EJB Client class.
Please let me know if anything else I have to do to make it work. This is a serious show stopper for me now and I am not able to proceed further because of this.
Thank you and have a nice day