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

javax.naming.NameNotFoundException thrown at application startup #130

Closed
luciano-fiandesio opened this issue Sep 4, 2019 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@luciano-fiandesio
Copy link

When creating a cache via Cache2kBuilder, the Cache2kCoreProviderImpl tries to register org.cache2k.CacheManager.defaultName through JNDI and it fails with javax.naming.NameNotFoundException: Name [org.cache2k.CacheManager.defaultName] is not bound in this Context. Unable to find [org.cache2k.CacheManager.defaultName].

The application is running within Tomcat.
The application starts up without issues, but I would like to avoid having a stack trace at start time. Is there a way to disable this behaviour?

@cruftex
Copy link
Member

cruftex commented Sep 4, 2019

The purpose of the JNDI property is to set a different cache manager name, in case you run multiple applications with cache2k within one tomcat instance.

When nothing is set, this should be ignored. Seems like you found a bug. Sorry for that. Will correct that ASAP.

@cruftex cruftex self-assigned this Sep 4, 2019
@cruftex cruftex added the bug label Sep 4, 2019
@cruftex
Copy link
Member

cruftex commented Sep 4, 2019

The application starts up without issues, but I would like to avoid having a stack trace at start time. Is there a way to disable this behaviour?

You could simply set the JNDI property org.cache2k.CacheManager.defaultName to default.

I will do an update, so this gets silently ignored. Maybe I drop JNDI in the futures, since I think not many are using this.

@cruftex cruftex added this to the v1.2.4 milestone Sep 4, 2019
@luciano-fiandesio
Copy link
Author

Ok, thanks. Yeah, I think you can simply catch javax.naming.NameNotFoundException in JndiDefaultNameProvider.registerCache2kExtension and ignore

@cruftex cruftex closed this as completed in bb5cb48 Sep 4, 2019
cruftex added a commit that referenced this issue Sep 4, 2019
@cruftex
Copy link
Member

cruftex commented Sep 4, 2019

Trying to release but unfortunately, I am getting timeouts from Sonatype for the Maven central upload at the moment.

@cruftex
Copy link
Member

cruftex commented Sep 4, 2019

Verison 1.2.4.Final is released now with this fix.

@luciano-fiandesio
Copy link
Author

Verison 1.2.4.Final is released now with this fix.

Excellent, thanks for the crazy fast response

luciano-fiandesio pushed a commit to dhis2/dhis2-core that referenced this issue Sep 5, 2019
  Bumped cache2k to latest version to avoid stacktrace at application
startup (bug fixed in 1.2.4)

  cache2k/cache2k#130
larshelge pushed a commit to dhis2/dhis2-core that referenced this issue Sep 9, 2019
Bumped cache2k to latest version to avoid stacktrace at application
startup (bug fixed in 1.2.4)

  cache2k/cache2k#130
luciano-fiandesio pushed a commit to dhis2/dhis2-core that referenced this issue Sep 16, 2019
  Bumped cache2k to latest version to avoid stacktrace at application
startup (bug fixed in 1.2.4)

  cache2k/cache2k#130

(cherry picked from commit 2260eff)
larshelge pushed a commit to dhis2/dhis2-core that referenced this issue Sep 16, 2019
Bumped cache2k to latest version to avoid stacktrace at application
startup (bug fixed in 1.2.4)

  cache2k/cache2k#130

(cherry picked from commit 2260eff)
vietnguyen pushed a commit to vietnguyen/dhis2-core that referenced this issue Sep 20, 2019
Bumped cache2k to latest version to avoid stacktrace at application
startup (bug fixed in 1.2.4)

  cache2k/cache2k#130

(cherry picked from commit 2260eff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants