tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rupp, Hans" <>
Subject NoInitialContextException
Date Tue, 22 Nov 2011 07:22:42 GMT
Hallo I have a legacy application which I want to make testable with OpenEJB (JEE5, target
platform is JBoss 4.3). Most things work so far. 

However I need to access EJBs from simple classes (Pojos WITHOUT any annotations) like

private void inject() {

      try {

                  Context initialContext = new InitialContext();


                  this.propertyAdapter = (PropertyAdapter) initialContext.lookup("propertyAdapter/local");

            } catch (NamingException e) {




(Yeah I know this is not nice and would have constitently used EJBs, but there are classes
with complicated constructors and many parameters which I have so far not refactored to EJBs
and the whole architecture is a complete mess ... At the moment I have something like EJBs
-> POJOs -> EJBs -> Entities)

When this code runs within OpenEJB


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


the façade EJBs are accessed by my tests, so I think I have at least the basics right. Is
there a way to avoid this Exception without converting all classes to EJBs.


Thanks for any hints,




40 Jahre DZBW
Herzlichen Dank unseren Kunden und Partnern. Wir freuen uns auf die gemeinsame Fortsetzung
der konstruktiven, vertrauensvollen Zusammenarbeit.
Ihre Datenzentrale Baden-Württemberg

Abonnieren Sie unseren Infobrief und erfahren Sie regelmäßig die neuesten Nachrichten über
unsere Lösungen, aktuellen Projekte und Entwicklungen. Melden sie sich an mit diesem Link

Datenzentrale Baden-Württemberg, Anstalt des öffentlichen Rechts
Krailenshaldenstr. 44, 70469 Stuttgart 
Telefon (0711) 8108-20, Telefax (0711) 8108-21350
E-Mail, Internet
Vorstand: Karl Tramer (Vors.) und Joachim Kischlat, Vorsitzender des Verwaltungsrats: Gunter
USt-Id-Nr. DE147794223 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message