Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermitent NameNotFoundException for java:global JNDI name during application start #28911

Closed
tkburroughs opened this issue Jun 26, 2024 · 0 comments · Fixed by #28914
Closed
Assignees
Labels
in:Java EE Platform release bug This bug is present in a released version of Open Liberty team:Zombie Apocalypse

Comments

@tkburroughs
Copy link
Member

Describe the bug
A NameNotFoundException may occur intermittently during application start if the application initialization has multiple threads that may concurrently perform a JNDI lookup of something in the java:global and/or java:app name contexts. The failure appears as follows:

Caused by: javax.naming.NameNotFoundException: javax.naming.NameNotFoundException: java:global/jdbc/DataSourceDef
at com.ibm.ws.jndi.url.contexts.javacolon.internal.JavaURLContext.lookup(JavaURLContext.java:357)
at com.ibm.ws.jndi.url.contexts.javacolon.internal.JavaURLContext.lookup(JavaURLContext.java:372)
at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:149)
at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409)
at java.naming/javax.naming.InitialContext.doLookup(InitialContext.java:282)
at io.openliberty.data.internal.persistence.service.DelegatingResourceFactory.createResource(DelegatingResourceFactory.java:59)
at com.ibm.wsspi.persistence.internal.DatabaseStoreImpl.createPersistenceServiceUnit(DatabaseStoreImpl.java:286)

Steps to Reproduce
Not easily reproducible. An application must have initialization that runs concurrent threads that perform JNDI lookups in java:global and/or java:app.

Expected behavior
JNDI lookups of java:global and java:app should work consistently every time an application starts.

Diagnostic information:

  • OpenLiberty Version: [24.0.03]
  • Affected feature(s) [jndi-1.0]
  • Java Version: [all]

Additional context
None

@tkburroughs tkburroughs added team:Zombie Apocalypse in:Java EE Platform release bug This bug is present in a released version of Open Liberty labels Jun 26, 2024
@tkburroughs tkburroughs self-assigned this Jun 26, 2024
tkburroughs added a commit to tkburroughs/open-liberty that referenced this issue Jun 26, 2024
Update injection scope code that handles deferred processing for java:global and java:app
to properly handle concurrent threads looking up JNDI names in these contexts.

Previously, the first thread would begin processing the deferred metadata and the second thread
would then assume it was already complete and fail. The change will now result in the second
thread waiting on a Future for the first thread to complete.

Also updated Jakart Data code to report this failure immediately, rather than ignoring it
until the failure potentially occurs at a later time.
tkburroughs added a commit that referenced this issue Jun 28, 2024
…otFound

Issue #28911: Intermittent java:global NameNotFoundException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:Java EE Platform release bug This bug is present in a released version of Open Liberty team:Zombie Apocalypse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant