pablosz
pablosz

Reputation: 55

@EJB injection into standalone main client

I'm trying to run this simple example which fails becose MyEJBRemote is not injected. So, it's throws NullPointerException. The server is TomEE 1.5.1.

public class Test
{
    @EJB
    private static MyEJBRemote ejb;

    public static void main(String[] args)
    {
        System.out.println(ejb.anMethod());
    }
}

However, if instead of using @EJB I use the traditional JNDI lookup then the example works perfectly.

I've read similar questions but I did not understand the answers.

How can I achieve the EJB injection into an standalone main client?

Thanks.

Upvotes: 0

Views: 218

Answers (1)

Puce
Puce

Reputation: 38132

@EJB is only supported on client side if you're using an ACC (Application Client Container),

Upvotes: 1

Related Questions