[jboss-user] [JNDI/Naming/Network] - A question about dependency injection @EJB
thomas2008ch
do-not-reply at jboss.com
Fri May 9 03:17:24 EDT 2008
In the EJB3 there is a new feature called dependency injection. With this new feature one doesn't need using the JNDI lookup calls. I try use this but it doesn't work. I get NULL-Pointer Exception.
Here are my codes:
| @Remote
| public interface MyTestBeanRemote {
| public String test(String msg);
| }
|
| @Stateless
| public class MyTestBeanImpl implements MyTestBeanRemote {
| public String test(String msg) {
| return "Hello, " + msg;
| }
| }
|
|
| public class TestEJB3Client4 {
| @EJB
| private static MyTestBeanRemote beanRemote;
|
| public static void main(String[] args) {
| System.out.println(beanRemote.test("I am here."));
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149663#4149663
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149663
More information about the jboss-user
mailing list