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

Repository custom implementation + repository configuration CDI beans are not resolved in Weblogic 12c [DATACMNS-617] #1080

Closed
spring-projects-issues opened this issue Dec 17, 2014 · 3 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Dec 17, 2014

Gonçalo Marques opened DATACMNS-617 and commented

In the environment described above, each CDI module (library containing a beans.xml descriptor) will have its own BeanManager instance.

Apparently, all CDI extensions will have a shared (and distinct from the modules described above) BeanManager. I currently have 3 extensions deployed - Spring Data, Apache DeltaSpike and a custom made CDI extension - and I confirmed that they all share the same BeanManager instance that is distinct from the BeanManager instances that are assigned to each module. The extension's BeanManager instances are the ones that are injected into the extension listeners (e.g. void afterBeanDiscovery()).

Since org.springframework.data.repository.cdi.CdiRepositoryBean is holding a reference to the BeanManager that was injected into the extension, when it later tries to resolve an eventual custom repository implementation bean using this same BeanManager, the BeanManager will not be able to resolve the custom implementation bean because it is loaded by another BeanManager (the one that is assigned to the module (or JAR) where the custom implementation bean resides).

This is also valid for the custom configuration org.springframework.data.repository.cdi.CdiRepositoryConfiguration implementation. The CdiRepositoryBean will not be able to resolve an eventual CdiRepositoryConfiguration implementation because of the same reason.

Note that this affects the environment described at the beginning of the issue. I have tested it in another container - with a much more recent version of Weld - and the issue does not occur, but Weblogic 12c is a widely used application server. I'm attaching a sample project that demonstrates the issue.

In order to reproduce the problem just access the servlet http://[host]:[port]/[context-path]/test


Affects: 1.9.1 (Evans SR1), 1.10 M1 (Fowler)

Attachments:

Referenced from: pull request #109

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 17, 2014

Gonçalo Marques commented

I have sent a pull request that fixes the issue.

Basically we will fallback to the Bean Manager fetched though JNDI if the extension provided Bean Manager fails to resolve custom repository beans.

The same applies to an eventual custom repository configuration, ie. an application provided CdiRepositoryConfiguration implementation

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 18, 2014

Gonçalo Marques commented

Oliver,

I have updated the pull request in order to be fully compliant with java.util.Iterator contract, even if it's just used locally.

I've struggled a little bit with git while merging ongoing changes in my local repo, hence the awkward number of commits included in the pull request, but everything is fine now. Just wanted to share this info with you so you don't get scared off :-)

Cheers,
GM

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 26, 2017

Jens Schauder commented

I'm closing this for the following reasons:

  1. It's rather old and nobody reacted on it, indicating that it is not of much interest to the community.
  2. It seems to be fixed by newer versions of Weld and although the current version of Weblogic is still 12c there have been multiple releases and I'm just going to assume the updated Weld in the process as well, although I couldn't find definitive information on that
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.