EasyBeans is an open source implementation by ObjectWeb of the EJB3 container specification.
Project
Developer
Wiki
|
|
|
Thanks for your reply.
Of course with remote interface it works. But as I'm co-localized in the same JVM I would like to use local interfaces instead. For information here is the code of the main application: package test.ejbs; import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.List; import javax.naming.InitialContext; import org.objectweb.easybeans.server.Embedded; import org.objectweb.easybeans.server.EmbeddedConfigurator; import test.ejbs.entity.User; import test.ejbs.stateless.UserManager; public class TestEB { public static void main(String[] args)throws Exception{ Embedded server = EmbeddedConfigurator.create(new URL("file:///Temp/ebreport/config/easybeans.xml")); server.getServerConfig().setShouldWait(false); List<File> dirs = new ArrayList<File>(); dirs.add(new File("d:/Temp/ebreport/easybeans-deploy")); server.getServerConfig().setDeployDirectories(dirs); server.start(); InitialContext rootCtx = new InitialContext(); UserManager manager = (UserManager)rootCtx.lookup("test.ejbs.stateless.UserManagerBean_test.ejbs.stateless.UserManager@Remote"); User user = new User(); user.setId(1); user.setFirstName("toto"); user.setLastName("titi"); manager.addUser(user); } } A question : why not create a JVM agent to start the EasyBean server at JVM server when using the embedded version ? The advantage of an agent is that you can register a class transformer which allow you to instrument classes without having to use your own classloader. I think this would solve this issue no ? |
||||||||||||||||||||||||||||||||||||||||||||||
You should use Remote interface I think or to give me more details about the way you call your bean (different JVM or not), etc.