-
1. Binding EJB's to JNDI
wdfink May 23, 2011 9:27 AM (in response to prasad.deshpande)I suppose it is because you use a snapshot.
Could you reproduce it with a fresh downloaded 6.0.0-final version.
-
2. Binding EJB's to JNDI
prasad.deshpande May 24, 2011 4:46 AM (in response to wdfink)I can't deploy my application on 6.0.0-final as it has some issues. One of them is https://issues.jboss.org/browse/JBAS-8895. So I only have chance to deploy on 6.1.0.
Besides, though I'm using snapshot version, that sould not give such basic problems. Any thoughts?
-
3. Re: Binding EJB's to JNDI
jaikiran May 25, 2011 3:54 AM (in response to prasad.deshpande)You'll have to post the relevant bean code and the relevant exception stacktrace(s).
-
4. Re: Binding EJB's to JNDI
prasad.deshpande May 25, 2011 4:32 AM (in response to jaikiran)I've attached boot.log here. You can clearly see
09:22:01,250 ERROR [STDERR] javax.ejb.EJBException: org.jboss.injection.manager.spi.InjectionException: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: RuleManager not bound]]
It is complaining about RuleManager not being bound to JNDI at the time of deployment of WAR, and then a second later you see this in the following log.
09:22:02,640 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
efp/RuleManager/local - EJB3.x Default Local Business Interface
efp/RuleManager/local-com.banctec.caseware.server.rulemanager.RuleManagerLocal - EJB3.x Local Business Interface
So surely here there is some timing issue.
-
boot.log.zip 28.6 KB
-
-
5. Re: Binding EJB's to JNDI
jaikiran May 25, 2011 5:39 AM (in response to prasad.deshpande)Like I said earlier:
You'll have to post the relevant bean code
-
6. Re: Binding EJB's to JNDI
prasad.deshpande May 25, 2011 5:49 AM (in response to jaikiran)Hope, this helps..
@Stateless(name="RuleManager", description="Rule Manager")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@Resources({
@javax.annotation.Resource(authenticationType=AuthenticationType.CONTAINER, type=TopicConnectionFactory.class, name="jms/TopicFactory", mappedName="java:/JmsXA"),
@javax.annotation.Resource(name="jms/AuditTopic", type=Topic.class, mappedName="topic/efpAuditTopic")
})
@Local(RuleManagerLocal.class)
public class RuleManagerBean implements RuleManagerLocal {
//method goes here
}
-
7. Re: Binding EJB's to JNDI
jaikiran May 25, 2011 6:10 AM (in response to prasad.deshpande)We'll also need the code of other bean(s) or other components (like servlets) which inject this RuleManagerBean.
-
8. Re: Binding EJB's to JNDI
prasad.deshpande May 25, 2011 11:02 AM (in response to jaikiran)Hi Jaikiran,
Sorry, due to security reasons, I can't give you all the code, but I'll try to paste the relavant code.
Firstly abstract class PC:
public abstract class PC {
// Other injected beans
@EJB
@IgnoreDependency
private RuleManagerLocal ruleManager;
//other methods
protected RuleManagerLocal getRuleManagerLocal() throws CaseWareException {
if (ruleManager == null) {
//createRuleManager will lookup in JNDI for Local Interface
ruleManager = ServiceLocator.getInstance().createRuleManager();
}
return ruleManager;
}
}
}
APCBean:
@Stateless(name="APC", mappedName="caseware/APC")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@Remote(APC.class)
public class APCBean extends PC implements APC {
//all other business methods....
public void doSessionCleanup() {
//some code
}
}
SessionCleanupImp class:
public class SessionCleanupImp {
// other methods
public void setup() {
//some other code
try {
Context mContext = new InitialContext();
APC apc = (APC)mContext.lookup("caseware/APC");
apc.doSessionCleanup();
log("Cleanup done.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
In a WAR file a Servlet calls this SessionCleanupImp.setup() method. which intern calls doSessionCleanup() business method on APCBean. I suspect, since this is the first business method being called on apc bean, that is the point where ejb injection happens, & because RuleManager is not yet bound to JNDI, it throws error.
-
9. Re: Binding EJB's to JNDI
jaikiran May 25, 2011 11:07 AM (in response to prasad.deshpande)Remove that @IgnoreDependency, that should get you past this (assuming that I'm reading your code correctly).
-
10. Re: Binding EJB's to JNDI
prasad.deshpande May 25, 2011 11:46 AM (in response to jaikiran)tried that, still inconsistent, sometimes it works when bean is deployed before WAR. It still gives same error. BTW, what was the logic of removing @IgnoreDependency? what is happening behind the scenes here you reckon?
-
11. Re: Binding EJB's to JNDI
jaikiran May 25, 2011 12:03 PM (in response to prasad.deshpande)If you have a @IgnoreDependency, then the server will not setup the correct dependencies during deployment. That can result into issues like the one you are seeing.
At this point, I can't much guess on what's wrong, unless I see the actual application or a simple one which reproduces it.