Publishing the local bean interface in weblogic

Is there a way to search EJB in weblogic if it only implements a local interface?

If i use this

@Remote public interface TestSessionRemote { public void businessMethod(); } @Stateless(mappedName = "A") public class TestSessionBean implements TestSessionRemote { public void businessMethod() { } } 

EJB can be found using this name:

 "A#" + TestSessionRemote.class.getName() 

If I change the annotation for TestSessionRemote from @Remote to @Local, the EJB will disappear from the JNDI. Is there any way around this?

EDIT: At the time, I was working with Weblogic 10.3.x (aka 11g).

+1
source share
3 answers

No, It is Immpossible. I ran into the same issue in the context of deploying an EJB 3.0 application on WebLogic 10.3.x.

The application runs on Oracle Application Server 10.1.3 and GlassFish 3.x.

  • Oracle AS (OC4J) has its own mechanism for locating the local EJB using JNDI.
  • GlassFish 3.x implements EJB 3.1 using the portable JNDI name syntax.

Our application uses a search engine for the current application server, which is determined at run time.

In WebLogic Server 10.3, the local EJB interface:

  • can be injected into managed classes in the servlet container (servlets, filters, etc.) and other EJBs using @EJB annotations
  • searchable from JNDI only if it was declared in the ejb-local-ref element in web.xml or ejb-jar.xml

It is not possible for us to declare all watched EJBs. We have 192 stateless EJBs, mostly injected, but many were looking from JNDI because we need them for unmanaged classes.

The source of this information, in addition to trial and error, is WebLogic 10.3 EJB3 Local Lookup Sample . Almost everything I found, including the Oracle documentation, describes the syntax of the JNDI lookup using mappedName#fullInterface , but it doesn't make it clear that only the remote interface name is specified in the JNDI tree.

Update: We set off with declarations in web.xml and ejb-jar.xml (yes, there are EJBs that use utility classes that look for other EJBs in JNDI). Started with a script to generate them from sources, and then manually edited them until they were correct. Not nice, but necessary.

+6
source

It should still be in the java: comp / env namespace.

0
source

For more details, check the check in Ejb3SessionBinder # bindToJNDI () will skip code binding using the jndi and Home interface, this means: no local beans can be called from the jndi tree because they were not registered. As already mentioned, it is only searchable from JNDI when it was declared in the ejb-local-ref element in the web.xml or ejb-jar.xml file.

(This information applies to wls 10.3.5).

0
source

All Articles