tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: NoInitialContextException
Date Tue, 22 Nov 2011 07:25:11 GMT
Hi,

try to pass this properties as your initial context parameter:

 p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");

- Romain


2011/11/22 Rupp, Hans <H.Rupp@dzbw.de>

> 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) {
>
>                  log.error(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,
>
>
>
> Hans
>
>
>
>
>
> 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 http://www.datenzentrale.de/Info-Brief
>
> _______________________________________________________________________________
>
> Datenzentrale Baden-Württemberg, Anstalt des öffentlichen Rechts
> Krailenshaldenstr. 44, 70469 Stuttgart
> Telefon (0711) 8108-20, Telefax (0711) 8108-21350
> E-Mail info@dzbw.de, Internet www.datenzentrale.de
> Vorstand: Karl Tramer (Vors.) und Joachim Kischlat, Vorsitzender des
> Verwaltungsrats: Gunter Czisch
> USt-Id-Nr. DE147794223
>
> _______________________________________________________________________________
>
>
>

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