Comments (12)
Try adding @ApplicationScoped to your SqlSessionFactoryProvider.
from cdi.
I've just tried adding @ApplicationScoped
to the SqlSessionFactoryProvider
class but I'm still getting a MybatisCdiConfigurationException
thrown with the description "There are no SqlSessionFactory producers properly configured."
from cdi.
I guess it will be difficult to find the reason why Weld behaves differently in 2.2.2 compared to 2.1.2.
My only other suggestion would be to force the declaration of the bean in beans.xml and see if that helps.
You could also try to add the Default and/or Any annotation to qualifiers.
beans = beanManager.getBeans(SqlSessionFactory.class, new AnnotationLiteral() {});
from cdi.
I've tried adding @Default
and @Any
to the method but the problem still remains.
I've also found out that there seems to be a GlassFish specific release of Weld, although I don't know what is different between the standard release and the GlassFish release, and there doesn't appear to be a GlassFish specific release of Weld 2.1.2 in Maven Central. I tried downloading the GlassFish release of Weld 2.2.10.SP1 from Maven Central (https://repo1.maven.org/maven2/org/jboss/weld/weld-osgi-bundle/2.2.10.SP1/) but that didn't fix the problem either.
Any idea how I would force the declaration of SqlSessionFactoryProvider in beans.xml? I've taken a look on Google but the only examples I can find are for declaring interceptors and decorators.
from cdi.
Normally, using
beans = beanManager.getBeans(SqlSessionFactory.class, new AnnotationLiteral() {});
CDI should return all SqlSessionFactory beans. To test this, you will need to create your own copy of mybatis-cdi.
After checking, it is not possible to force the declaration of a bean in beans.xml. You can only force the use of alternatives. I am not a CDI expert, sorry.
from cdi.
I've copied the various classes that make up mybatis-cdi directly into my program and have registered the extension in META-INF/services/javax.enterprise.inject.spi.Extension
, and I can now successfully inject mappers into my program and run queries using MyBatis.
Given that this works in Weld without any changes and also in GlassFish when I copy the mybatis-cdi classes into my program, I'm wondering whether this is either a bug in GlassFish itself or the GlassFish specific release of Weld.
from cdi.
Thanks. That's an interesting bit of information. I'll have a look into it and see if there is anything to do to solve the issue.
from cdi.
Just a few ideas...
Could this have something to do with beans.xml not being setup for 2.2.x? While it is not required in glassfish 4.1, if I recall correctly, what it does changed. Annotations are default now.
Other possible issue is the fact that newer CDI no longer just injects things for sake of injection. It requires a scope regardless. @dependent is the scope that should be set on anything that is performing injection if no scope is to be listed meaning it is going to be part of some other scope. So lets us say the piece you didn't show where you are @Inject on the producer you have, does that class have a scope itself?
from cdi.
I'm running WildFly 8.2.1 and I've the same problem. Any updates?
from cdi.
hello ,I run glassfish 4.1 or payrar, the same and you have the same problem. You do not know the problem has been solved? I am very anxious to solve this problem.My weld-osgi-bundle upgrade to 2.3.2.final. Can not solve the problem.
I suspect that
beans = beanManager.getBeans(SqlSessionFactory.class, qualifiers.toArray(new Annotation[]{}));.
Can not find an instance
from cdi.
Hello,
I'm having a difficult time with glassfish 4.1. Does anyone have a working example? Currently, when I try to inject a mapper I get this message in the log:
Severe: Error Rendering View[/index.xhtml]
org.mybatis.cdi.MybatisCdiConfigurationException: There are no SqlSessionFactory producers properly configured.
However, some lines before I get:
Info: MyBatis CDI Module - Activated
Info: MyBatis CDI Module - Mapper dependency discovered: org.jayasoft.mapper.PersonaMapper
Regards.
from cdi.
Hi, I have tested the beta5 against Payara 4.1 (Glassfish 4.1) and TomEE-Plus 7.0.1.
The test code can be found here: https://github.com/mnesarco/mybatis-cdi-samples
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
- How to modify java:comp/BeanManager to java:comp/env/BeanManager? HOT 13
- 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.