New to EJB world… Null pointer exception in EJB client

后端 未结 2 1772
小鲜肉
小鲜肉 2020-12-09 14:44

I am learning EJB and I am trying to execute the Helloworld example given in EJB In Action book.

My app server is JBoss, I created the Jar file for the bean class an

2条回答
  •  隐瞒了意图╮
    2020-12-09 14:57

    You would have to make two changes:

    Replace the @EJB dependency injection with JNDI lookup. Dependency Injection is not supported for POJOs in EJB 3 (Don't know about EJB 3.1 though )

    Then, the interface has to be a remote interface. The reason is that, the client here is a standalone java program - It would be running in JVM different from the web-app JVM.

    Both dependency injection through @EJB and having the interface as @Local should work if the client was a servlet in the same server.

提交回复
热议问题