[jboss-user] [EJB 3.0] - JUnit testing EJBs: NoInitialContextException
humm
do-not-reply at jboss.com
Thu Sep 7 13:32:58 EDT 2006
Dear all,
I want to write JUnit Tests for my EJB3.0 SessionBeans. How do I access the application server?
InitialContext ctx = new InitialContext();
bean = (BeanInterface) ctx.lookup("...");
does not work since the initial context cannot be resolved (javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial).
Obvoiusly, for the same reason, dependency injection doesn't work either:
@EJB
BeanInterface bean;
What do I have to do?
Best regards
Bernhard
--
Prof. Dr. Bernhard Humm
Darmstadt University of Applied Sciences
b.humm at fbi.h-da.de
www.fbi.h-da.de/~b.humm
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970146#3970146
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970146
More information about the jboss-user
mailing list