Comments (13)
from cdi.
Thank you for the reply. I am checking that java project.
from cdi.
Thanks. It works like a charm ;)
The only one thing what I do not understand is why I need to have this fake TestBean? It is not used by anyone but if I delete it then I get a exception:
Could you please explain it to me?
[2017-02-15T16:26:35.641+0100] [Payara 4.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=32 _ThreadName=http-listener-1(5)] [timeMillis: 1487172395641] [levelValue: 900] [[
StandardWrapperValve[com.remal.mybatis.demo.web.servlet.DemoServlet]: Allocate exception for servlet com.remal.mybatis.demo.web.servlet.DemoServlet
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type EmployeeMapper with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject com.remal.mybatis.demo.web.servlet.DemoServlet.employeeMapper
at com.remal.mybatis.demo.web.servlet.DemoServlet.employeeMapper(DemoServlet.java:0)
from cdi.
from cdi.
I do not have any index page. I only have a servlet.
If I remove @dependent from Mapper class and delete completely this TestBean then CDI does not work.
from cdi.
from cdi.
Hi @zappee, I have tested this in payara with the TestBean removed and it worked. but you can't remove @dependent from the mapper unless you set bean discovery to all in the bean.xml.
from cdi.
Please find attached your modified project. You can see my modification on the "Version Controll" tab.
source-code-is-removed
from cdi.
Hi @zappee , I got it. Looks like Weld does not detect the mapper if not used by at least one proper CDI bean. (Servlets are not proper CDI beans). So a workaround is to annotate the servlet with @dependent by now.
from cdi.
Hi @mnesarco ,
Thank you for the workaround!
Do you think it is worth to rise an issue on Paraya / Weld website and ask the guys fix that?
from cdi.
from cdi.
Looks like an old Weld issue with JEE components, but seems that it was fixed long time ago. So I leave the link for reference: https://issues.jboss.org/browse/JBAS-8281?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel
Old, but maybe related: https://issues.jboss.org/browse/WELD-302
from cdi.
Ok, CDI Injection works well in Glassfish/Payara, there is a sample project ready to depoly and test here: https://github.com/mnesarco/mybatis-cdi-samples/
The special case of injecting mappers ONLY in JEE components that are not CDI aware is not related to mybatis-cdi but it is an issue in the CDI container.
The case is:
Scenario:
- Inject a mapper X in a Servlet
- Do not inject this mapper X in any valid CDI bean
Problem:
- CDI Dependency resolution fails
Cause:
- Payara (Weld) does not detect the InjectionTarget because there are no CDI beans requesting it.
Workaround:
- Annotate the servlet with @dependent or any stereotype, to allow Weld to mark it as a CDI aware bean and fire proper ProcessInjectionTarget event.
from cdi.
Related Issues (20)
- UnsatisfiedResolutionException: Api type [] is not found with the qualifiers... HOT 7
- Consider support JNDI obtain UserTransaction?
- Weld 3.1.7.Final Proxy changes has broken mybatis-cdi support HOT 1
- Create annotation to rollback exception by default HOT 1
- Upgrade to jakarta Namespace HOT 17
- UnsatisfiedResolutionException using aries-cdi 1.1.5 with karaf 4.3.7 HOT 1
- Dependency Dashboard
- Migrate from atomikos to narayana HOT 1
- Site plugin and 'clirr' usage issue with jakarta
- Clirr: Remove profile from maven.config file after no longer needing to compare to javax namespace
- missing @Any qualifier on MybatisBean if user provided qualifier is present
- Transactional (mybatis-cdi: org.mybatis.cdi.Transactional) annotation with rollbackOnly=true not rollbacking transactions inside a Weld / JUnit 5 test
- issue with micro profile standard HOT 1
- Release 1.0.3 HOT 4
- NoSuchElementException in test with Arquillian and embedded container HOT 10
- "WELD-001328: Unable to identify the correct BeanManager." occurs HOT 16
- Test issues - 8 of 13 can run concurrently / recent updates do not support oldest support revision of cdi/weld HOT 5
- github is behaving very strange... HOT 1
- mybatis-cdi-1.0.3 crashes in repeated requests HOT 2
- Release mybatis-cdi 1.1.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdi.