[JBoss] ejb injection within package

Discussão em 'StackOverflow' iniciado por Stack, Novembro 19, 2024.

  1. Stack

    Stack Membro Participativo

    I've got an ejb

    @Stateless
    @LocalBinding(jndiBinding = DmsExportExecutor.DEFAULT)
    public class InjectedBean implements BeanInterface {
    }


    that implements interface

    @Local
    public interface BeanInterface {

    public static final String DEFAULT = "package.InjectedBean";
    }


    And i'm trying to inject this into a bean, that's in exactly the same project and package. by @jndiinject annotation

    public class AnotherBean {
    @JndiInject(jndiName = BeanInterface.DEFAULT)
    BeanInterface bean;
    }


    If i do that, a runtime exception is thrown.

    java.lang.RuntimeException: Unable to inject jndi dependency: env/package.InjectedBean/bean into property package.InjectedBean. AnotherBean.bean: package.InjectedBean not bound
    Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: package.InjectedBean not bound]
    Caused by: javax.naming.NameNotFoundException: package.InjectedBean not bound


    After refactoring my InjectedBean into another package that is even located inside of the same maven project, it starts working.

    Could anyone explain why this happens?

    Continue reading...

Compartilhe esta Página