I implemented ejb3 on weblogic 10.3 and test successfully with application client when lookup object.
Test class is here :
package com.test;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;import com.ejb.MyController;
public class Test {
public static void main(String args[]) {
Test test = new Test();
test.testEjb();
}
public void testEjb(){
System.out.println("hello moto");
try {
Context context = getInitialContext();MyController obj = (MyController)context.lookup("MyController#com.ejb.MyController");
System.out.println("pass");
} catch (Exception ex) {
ex.printStackTrace();
}
}
private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
// WebLogic Server 10.x connection details
env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
env.put(Context.PROVIDER_URL, "t3://192.168.18.222:7001");
return new InitialContext( env );
}
}
But when i deploy Test on web application run on Jboss as 5.x then testEjb() method can not execute. It throws exception MyController ClassNotFound althrough MyController class is in my library and i set it into Web lib.
I try to deploy Test on Jboss 4.2.3 then it runs ok when i add jboss-ejb3-client.jar to web lib. I'm suprised by this because jboss as 5.0 is stable to support j2ee1.5. Please help me solve this problem , what matter with jboss as 5.x? Thanks in advance.