Search code examples
openejb

How to force openEJB to ignore mappedName and use openejb.jndiname.format instead


I have an EJB:

@Stateless(mappedName = "MetadataFacade")
public class MetadataFacade implements MetadataFacadeRemote {

and openEJB configured using:

-Dopenejb.jndiname.format={ejbClass.simpleName}#{interfaceClass}

When embedded openEJB is starting it ignores the openejb.jndiname.format option and creates incorrect JNDI name:

INFO   info, Jndi(name=MetadataFacade) --> Ejb(deployment-id=MetadataFacade)

How can I configure it to use the openejb.jndiname.format option and create JNDI name similar to:

MetadataFacade#my.package.MetadataFacadeRemote

?

If openEJB can not do it, I would be thankful for any workaround.


Solution

  • Since the described use case is not supported, I have created a patch

    mappedName.patch

    which disables the original behaviour and instead adds a new variable ejbClass.mappedName which can be used in openejb.jndiname.format.


    The patch is for the head (revision 1034599) of:

     http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.4
    

    Apply it to sources root using:

    patch -p0 -i mappedName.patch
    

    then build openEJB using:

    mvn -Dmaven.{test,itest}.skip -Dassemble clean install
    

    and add

    container/openejb-core/target/openejb-core-3.1.4.jar

    to your classpath as the first entry.