Tomasz Wolak [
http://community.jboss.org/people/twolak] created the discussion
"org.jboss.ejb3.annotation.RemoteBinding on JBOSS4"
To view the discussion, visit:
http://community.jboss.org/message/599934#599934
--------------------------------------------------------------
Hi:
I have been tasked with wipping out a small app using ejb3 and jsf on jboss. Having jboss
5 already up and running I coded it there first. The app is very simple: entity Bean
together with Manager bean with local/remote interfaces. I used the
org.jboss.ejb3.annotation.RemoteBinding to map my custom name of the manager bean. The
manager bean was being accessed from JSF backing bean using direct injection. This setup
worked great on Jboss5. However we currently use JBoss4 in production but I figured this
will be a non issue just put the ear file in the Jboss4.x and off we go. Well not quite.
I was aware of the fact that DI does not work in non container manager beans (such as JSF
bean) so I used direct context lookup to account for this fact.
Here is stub for my manager:
import *org.jboss.ejb3.annotation*.LocalBinding;
import *org.jboss.ejb3.annotation*.RemoteBinding;
@RemoteBinding(jndiBinding = "FakeInvManager/remote")
@LocalBinding(jndiBinding = "FakeInvManager/local")
public class FakeInvManagerBean implements FakeInvManagerRemote,
FakeInvManagerLocal {
}
here is part of JSF where I look up the manager:
try {
Context envCtx = new InitialContext();
invMgr = (FakeInvManagerLocal) envCtx
.lookup("FakeInvManager/local");
} catch (NamingException ne) {
log.error("Cannot create instance of the FakeInvManager",
ne);
throw ne;
}
This is where it is getting intresting: I deployed this on JBOSS 4 and I had a failure
("FakeInvManager/local" not bound). Looked in the JNDI tree to find that the
bean is not getting registered under "FakeInvManager/local". I could only use
the global name "*earFileName/BeanName/local*". This meant that @LocalBinding
is not working. Did a bit digging and found out that @LocalBinding implmentation changed
from JBoss4 to JBoss5 from
org.jboss.annotation.ejb.LocalBinding;
to
org.jboss.ejb3.annotation.LocalBinding;
So I updated my manager to use JBoss4 (org.jboss.annotation.ejb.LocalBinding)
implementation and everything went to normal i.e. I could look up the resource using the
LocalBinding specified jndiBiding name (i.e. FakeInvManager/local").
You'd think that the story is over...problem solved?
Well here is my dilema: Originally I have deployed my manager Bean to JBOSS4.x using
JBOSS5.x specific import:*org.jboss.ejb3.annotation.*LocalBinding;
Yet there is NO trace of that package on Jboss4.x so how come I did not explode with
"ClassNotFound" or something to this account? In fact once I changed my lookup
to the global JNDI biding the whole thing worked where I think it shouldn't?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/599934#599934]
Start a new discussion in EJB3 at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]