-
Notifications
You must be signed in to change notification settings - Fork 19
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
Unable to use MyBatis-CDI with GlassFish 4 and 4.1 #11
Comments
Try adding @ApplicationScoped to your SqlSessionFactoryProvider. |
I've just tried adding |
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. |
I've tried adding 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. |
Normally, using 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. |
I've copied the various classes that make up mybatis-cdi directly into my program and have registered the extension in 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. |
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. |
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? |
I'm running WildFly 8.2.1 and I've the same problem. Any updates? |
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 |
Hello, Severe: Error Rendering View[/index.xhtml] However, some lines before I get: Regards. |
Hi, I have tested the beta5 against Payara 4.1 (Glassfish 4.1) and TomEE-Plus 7.0.1. |
I'm unable to get MyBatis-CDI working with GlassFish 4 and GlassFish 4.1 due to a
MybatisCdiConfigurationException
exception being thrown with the description "There are no SqlSessionFactory producers properly configured."The code for the SqlSessionFactory I'm using is as follow:
I've stepped through the code of the MyBatis-CDI module and have found that when the follow line of code in
CDIUtils findSqlSessionFactory(...)
is executed it fails find any beans that returnSqlSessionFactory.class
.beans = beanManager.getBeans(SqlSessionFactory.class, qualifiers.toArray(new Annotation[]{}));
I've tried running my program on GlassFish 4 and 4.1 and they both have the same problem, but it works fine if I run my program on WildFly 8.1. My first thought was that it might be a problem with the version of Weld shipped with Glassfish but it turns out that GlassFish 4.1 is running Weld version 2.2.2 whereas WildFly is running Weld version 2.1.2.
Is there anything I can do in GlassFish, my code or in the MyBatis-CDI module to overcome this problem when running in GlassFish?
The text was updated successfully, but these errors were encountered: