static{
try{
_context = (Context) new InitialContext().lookup("java:comp/env");
_bean1Home = (Bean1LocalHome) _context.lookup("Bean1");
_bean2Home = (Bean2LocalHome) _context.lookup("Bean2");
_bean3Home = (Bean3LocalHome) _context.lookup("Bean3");
} catch(NamingException ned) {
_systemLogger.error("SessionLocator...Naming exception: " + ned.getMessage());
_systemLogger.error("Couldn't initialize all of the session beans.");
}
}
So there is no way that I can make a context available to SessionLocator that has all of the beans available in the context without specifying <ejb-local-refs> for every one of them? I don't know what Resin would do in the case you mentioned below where two beans want to use the same JNDI path, but Resin was allowing global access to all of the session beans without <ejb-local-ref> tags.
Thanks for the reply.
-M@
On Monday, October 6, 2003, at 12:20 PM, Adrian Brock wrote:
Are you caching the java:comp/env context? If so, your locator is using the ENC (Enterpise Naming Context) from the first application to use it.
Some j2ee implementations re-resolve it to the application's ENC on every lookup.
JBoss (and at least Tomcat standalone as well) resolves it when you lookup the context (it is more efficient).
A global locator for java:comp/env won't work anyway. Consider what happens when two ejbs decide java:comp/env/jdbc/DataSource should be different databases.
Regards, Adrian
On Mon, 2003-10-06 at 20:02, Matthew Hixson wrote:We currently have an EJB app that we've migrated from Resin. We have a
SessionLocator class that looks up all of the session beans and caches
references to their local homes in a static initializer. This worked
great under Resin, but under JBoss this fails if the first call to
SessionLocator is from a bean that does not declare an <ejb-local-ref>
for all the other session beans and entity beans.
<ejb-local-ref > <ejb-ref-name>Category</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.company.ejb.entity.CategoryLocalHome</local-home> <local>com. company.ejb.entity.CategoryLocal</local> <ejb-link>Category</ejb-link> </ejb-local-ref>
I have added xdoclet tags to one of our SessionBeans so that the
<ejb-local-ref> tags like that above get put into ejb-jar.xml. This is
just duct tape until I find a better solution. The catch is that we
have to hit a specific servlet before anything else, otherwise we get a
NamingException that says:
10:59:21,852 ERROR [system] NamingExceptionjavax.naming.NameNotFoundException: Foo not bound
As far as I can tell I need to add <ejb-local-ref> tags to each of my session beans to declare what other beans it depends on. Is there a reason for this? It seemed that Resin made everything under com/env available to lookup. I've never had to use the <ejb-local-ref> tag until now. I'd rather not be troubled with doing that if I don't absolutely have to. Is there a way to configure JBoss to behave more like Resin in this regard? Or is there any way around having to add <ejb-local-ref>s to all of my session beans? -M@
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user-- xxxxxxxxxxxxxxxxxxxxxxxx Adrian Brock Director of Support Back Office JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
