mybatis / cdi

MyBatis CDI Extension
Apache License 2.0
24 stars 19 forks source link

UnsatisfiedResolutionException using aries-cdi 1.1.5 with karaf 4.3.7 #302

Closed znzlspt17 closed 1 year ago

znzlspt17 commented 2 years ago
ERROR [Aries CCR Thread (-2064156514)] CCR Failure in container activator open on org.apache.aries.cdi.container.internal.container.ContainerBootstrap@6aa6d745
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [com.myapp.dao.mapper.UserMapper] is not found with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  userMapper, Bean Owner : [UserDaoServiceImpl, WebBeansType:MANAGED, Name:null, API Types:[com.myapp.dao.service.impl.UserDaoServiceImpl,java.lang.Object,com.myapp.dao.service.UserDaoService], Qualifiers:[javax.enterprise.inject.Any,org.osgi.service.cdi.annotations.Service]]
        at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:335) ~[?:?]
        at org.apache.webbeans.lifecycle.AbstractLifeCycle.bootstrapApplication(AbstractLifeCycle.java:137) ~[?:?]
        at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:103) ~[?:?]
        at org.apache.aries.cdi.owb.core.OWBCDIContainerInitializer.initialize(OWBCDIContainerInitializer.java:212) ~[?:?]
        at org.apache.aries.cdi.owb.core.OWBCDIContainerInitializer.initialize(OWBCDIContainerInitializer.java:62) ~[?:?]
        at org.apache.aries.cdi.container.internal.container.ContainerBootstrap.open(ContainerBootstrap.java:149) ~[?:?]
        at org.apache.aries.cdi.container.internal.model.ContainerActivator$$Lambda$1206/0x0000000000000000.call(Unknown Source) ~[?:?]
        at org.osgi.util.promise.DeferredPromiseImpl$Submit.run(DeferredPromiseImpl.java:755) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:836) [?:?]
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [com.myapp.dao.mapper.UserMapper] is not found with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  userMapper, Bean Owner : [UserDaoServiceImpl, WebBeansType:MANAGED, Name:null, API Types:[com.myapp.dao.service.impl.UserDaoServiceImpl,java.lang.Object,com.myapp.dao.service.UserDaoService], Qualifiers:[javax.enterprise.inject.Any,org.osgi.service.cdi.annotations.Service]]
        at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60) ~[?:?]
        at org.apache.webbeans.container.InjectionResolver.checkInjectionPoint(InjectionResolver.java:252) ~[?:?]
        at org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1231) ~[?:?]
        at org.apache.webbeans.util.WebBeansUtil.validate(WebBeansUtil.java:1510) ~[?:?]
        at org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:1153) ~[?:?]
        at org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:1064) ~[?:?]
        at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:306) ~[?:?]
        ... 10 more

The stack is as above

Since we cannot disclose the code of the project, i will post the same sample code that reproduces the same error by tomorrow.

Added

sample code & kar : myapp_sample.zip

I've written a simple sample code as it is used in my existing project.

Environment Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.24.0, JRE 11 Windows 10 amd64-64-Bit 20210120_627 (JIT enabled, AOT enabled) Apache karaf 4.3.7

Whatever the implementation of usp_get_user, the result only needs to be 1 or 0.

Thank you in advance

hazendaz commented 1 year ago

While I think 1.1.x should have worked on websphere 8.5, I'm not sure the value for me to try to figure that math out without community assistance. Websphere 8.5 is super old and at least in my day job, we hardly run anything on it and even then bulk were moved to 9.x already and remainder are trying to move to tomcat or some other modernization track such as spring boot on the cloud. If its important enough, I'm sure you will come back given we didn't do anything in last year.

This might help which is on our readme but don't know for sure https://github.com/mnesarco/mybatis-cdi-samples/.

Do note that 'master' has moved onto Jakarta now making this super mute anyways. I don't have the time to support both honestly but if there is a need will cut a support line branch from here d76df7eb5d6085e4d38bbd7a5107d8903c3e0956 for any support related items. So, if you are able and still have such a need, try to see if you can figure out the actual issue if it is with this library by looking at the samples and then cutting branch from that point noted. In meantime, I'm closing this since its been shown many times in past and with assistance of those samples to get running in many older containers. If you do come up with something, certainly open new issue and ask that I get the branch out there so you can push against. I'd be happy to release but otherwise don't have time to look or even want to try to spin up really old containers as too much has changed.