> Hi Jean-Louis,
>
> Thank you for your answers.
> The line duplication did it.
> But that's a really strange behaviour that I have to call "new
> InitialContext" twice :-(
>
> Thanks,
> Marco
>
>
> -----Ursprüngliche Nachricht-----
> Von:
[hidden email] [mailto:
[hidden email]
> ]
> Gesendet: Dienstag, 3. März 2009 16:45
> An: Huber Marco, (
[hidden email])
> Betreff: InitialContext does not contains UserTransaction
>
> Hi Marco,
>
> Can you duplicate the line
>
> context = new InitialContext(startupProperties);
>
> I already found such a behavior but I'm currently not able to know
> it's sometimes necessary.
>
> Regards,
> JLouis
>
> Marco.Huber wrote:
>>
>> Hi experts,
>>
>> I try since days to obtain the UserTransaction from the
>> InitialContext. I found the following message suggesting that there
>> is
>> a UserTransaction in the context of the application :
>>
http://www.nabble.com/UserTransaction-in-openejb-td19313741.html>>
>> I always get a NameNotFoundException, if I want to do something
>> like :
>>
>> context.lookup("java:comp/UserTransaction");
>>
>> We initialize the InitialContext as followed:
>>
>> Properties startupProperties = new Properties(); Context context =
>> null; startupProperties.put(Context.INITIAL_CONTEXT_FACTORY,
>> "org.apache.openejb.client.LocalInitialContextFactory");
>> startupProperties.put("openejb.deployments.classpath.ear", "true");
>> startupProperties.put("openejb.jndiname.format","{deploymentId}/
>> {inter
>> faceType.annotationName}");
>> startupProperties.put("openejb.altdd.prefix", "test");
>> startupProperties.put("openejb.validation.output.level", "VERBOSE");
>> context = new InitialContext(startupProperties);
>>
>> Now I have debugged the openEjb source (version 3.1) and saw that the
>> UserTransaction is set correctly at start up in the
>> Assembler.createTransactionManager(TransactionServiceInfo
>> serviceInfo)
>> method into the JNDI context, but later the LocalInitialContext class
>> is initialized with the Context getContainerSystemEjbContext()
>> method,
>> obtaining the "java:openejb/ejb" context inside the JNDI context:
>>
>> private static Context getContainerSystemEjbContext() throws
>> NamingException {
>> ContainerSystem containerSystem =
>> SystemInstance.get().getComponent(ContainerSystem.class);
>> (1) Context context = containerSystem.getJNDIContext();
>> (2) context = (Context) context.lookup("java:openejb/ejb");
>> return context;
>> }
>>
>> I found out that the context of the SystemInstance (1) contains a
>> UserTransaction, the lookup openejb/ejb context (2) not.
>>
>> Did I miss a start up property? Or why will the InitialContext is
>> initialized with "java:openejb/ejb" context from JNDI that does not
>> contains the java:comp namespace.
>>
>> Any help would be appreciated.
>>
>> Regards
>> Marco
>>
>>
> Quoted from:
>
http://www.nabble.com/InitialContext-does-not-contains-UserTransaction-tp22310648p22310648.html>
>
>