Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » JNDI Values not accessible on Gemini blueprint Spring Configuration running on Tomcat(javax.naming.NameNotFoundException: Name [java:comp/env/xxx] is not bound in this Context. Unable to find [java:comp].)
JNDI Values not accessible on Gemini blueprint Spring Configuration running on Tomcat [message #1854189] Fri, 05 August 2022 09:21 Go to next message
Christian Meister is currently offline Christian MeisterFriend
Messages: 3
Registered: November 2015
Junior Member
I am trying to access JNDI values from SpringConfiguration class invoked by Gemini Blueprint.
This application runs on Apache Tomcat with Equinox OSGI.
It is old Application that uses Gemini Blueprint 1.0.2.

I can define my JDNI Values in server.xml link them in context.xml and use them in my web.xml.

In my launch.ini i use the parent classloader fwk so the JNDI configuration is passed to the OSGI-Container.

My Application-Bundles can read those values for example in Bundle-Activator:

String xxx= InitialContext.doLookup("java:comp/env/xxx"); or
String xxx= new InitialContext().lookup("java:comp/env/xxx");

Invoked from Gemini in BlueprintExtenderThread i can't access those values.
<jee:jndi-lookup id="xxx" jndi-name="java:comp/env/xxx" />
fails.

The classloaders are different in Bundle-Activator and BlueprintExtenderThread.
How can i access my JNDI configuration with gemini blueprint?

[Updated on: Fri, 05 August 2022 10:47]

Report message to a moderator

Re: JNDI Values not accessible on Gemini blueprint Spring Configuration running on Tomcat [message #1854216 is a reply to message #1854189] Mon, 08 August 2022 09:04 Go to previous message
Christian Meister is currently offline Christian MeisterFriend
Messages: 3
Registered: November 2015
Junior Member
I found a Solution that i can use.

If i Move my JNDI-Lookups from xml into my Spring-Configuration-class then i can change the clasloader in init like this:
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

After that i my Lookups work fine.

i found that solution in Stackoverflow
https://stackoverflow.com/questions/30881786/can-spring-boot-be-used-with-osgi-if-not-any-plans-to-have-an-osgi-spring-boot.
Previous Topic:How can you expose a bean as an osgi service via java config annotation?
Next Topic:Will Gemini Blueprint release a new version in the near future
Goto Forum:
  


Current Time: Tue Apr 16 18:45:34 GMT 2024

Powered by FUDForum. Page generated in 0.13008 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top