1

This is the scenario: I created an EJB project in eclipse on wildfly as a server. The EJB project It has been deployed with its beans, and is ready in the wildfly administrative console.

Now I need to create a remote client to use the EJB project beans. I understand that this is done through a context lookup. Therefore, it included the following code in the client:

Context ctx = new InitialContext(jndiProps);
// lookup the bean     Foo interface lives inside the remote EJB
Foo beanRemoteInterface = (Foo) ctx.lookup("myapp/myejbmodule/FooBean!org.myapp.ejb.Foo");

The problem is that, since the EJB and the client are in separate projects, the Foo interface as unknown in the code from the client and I cannot have the client compile because the Foo type is not found.

  • Is there any way to obtain this remote class reference on the client? -How can I make the client code compile in eclipse?
  • Just create shared library, put 'Foo' interface there and link this library to both EJB and client projects. – Alex Chernyshev Feb 05 '20 at 00:12
  • Yikes. I know they exist, but I haven't seen an RMI EJB project in... a very long time. Modern practice is generally to use Web services or message queues. – chrylis -cautiouslyoptimistic- Feb 05 '20 at 00:13
  • @AlexChernyshev: That could be a nice solution. However, I am concerned about how can we keep that library in sync at both sides when some future changes arrives. – Gabriel Solitario Feb 06 '20 at 18:47
  • There is no strict requirement for sync all the time - old compiled version on client side should work with updated server, till you not add breaking changes. In case of such - just rebuild library, client and server. – Alex Chernyshev Feb 06 '20 at 20:31

0 Answers0