No error with datasource when starting . It works because I tried to make it wrong and I had an error message.
It works within OEP but not via java classes, that's right.
It seems that I am not using the right name/namespace for datasource with initialContext but I can't find any solution.
the described above approach works exactly in 12c.(just checked it again)
It's important that you have to use datasource name but not datasource jndi name here.
What jdk version are you using?
What OS are you using?
Are there any errors/warnings during OEP server startup?
Can you check with a new simple scenario not migrated code but completely new one?
I just started from scratch to test different use case.
In fact, the @resource work when the class is the one from the bean itself. My case was that I used another subclass to make the connection. This is the reason why the @resource was not ok with me.
The jndi mode using initialcontext does not work at all for me. You need to adapt the documentation if we could not use this anymore.
I will send you my project via email using a simple use case.
1. Using an event bean, initial context is not working (in constructor), but @resource works and I can use my connection in a thread (after the initialisation of the bean).
2. Using an bean used to load a specific context and cache, initial context is not working (in constructor), but @resource works, but I need to have the connection when my bean start (in the constructor). I does not work due to initialisation mode of the bean. I also tried init-method in bean definition but nothing works. A good option would be to use initial context, but not working.
What do you think about point 2? How do I have access to datasource in a constructor of a standard bean?
PS: The code I had was working in 11g, it seems that 12c changes some rules. But this is always the case when migrating...