|
|
|
|
|
|
Re: [neon] No bean returned [message #1751372 is a reply to message #1751370] |
Mon, 09 January 2017 13:40 |
Urs Beeli Messages: 573 Registered: October 2012 Location: Bern, Switzerland |
Senior Member |
|
|
Ivan, you are of course right and in my real code I am using IRemoteService, I just left it out in the post to demonstrate that the ClientOnlyService and the RemoteService mechanisms seem to work but the ServerOnlyService is not picked up by Jandex.
[Updated on: Mon, 09 January 2017 13:41] Report message to a moderator
|
|
|
|
|
|
Re: [neon] No bean returned [message #1751379 is a reply to message #1751378] |
Mon, 09 January 2017 15:18 |
Urs Beeli Messages: 573 Registered: October 2012 Location: Bern, Switzerland |
Senior Member |
|
|
Next update:
I changed my RemoteService as follows:
@ApplicationScoped
@TunnelToServer
public class RemoteService { // really implementing IRemoteService which is annotated :-)
public void executeAction() {
IBeanManager mgr = BEANS.getBeanManager();
List<IBean<ServerOnlyService>> beans = mgr.getRegisteredBeans(ServerOnlyService.class);
if (beans == null || beans.size() == 0) {
System.err.println("--- No ServerOnlyService beans registered, trying to manually register beans");
mgr.registerClass(ServerOnlyService.class);
} else {
System.out.println("--- Number of registered beans=" + beans.size());
}
BEANS.get(ServerOnlyService.class).doTheWork(); // now this line no longer causes an AssertionException
}
}
Now, on the first timed call, I get the syserr() line, telling me no beans were registered for ServerOnlyService but my manual registering of the class works, because the call to doTheWork() is now successfully called.
On all subsequent calls, I get the sysout() line, telling me that there is 1 bean registered.
So, for some reason, despite ServerOnlyService being annotated with @ApplicationScoped and being in the same app.server project (though in a different package), it is not automatically picked up by Jandex (as opposed to the RemoteService).
Are there any reasons that could cause this (other than the @IgnoreBean annotation, which we are not using)? Anything in my class that would make it "unpickupable" by Jandex?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08920 seconds