Skip to content

NoSuchElementException in test with Arquillian and embedded container #86

Closed
@FuoriDiTesta

Description

@FuoriDiTesta

Hi,

i'm trying to run a junit test of a Mybatis sample, with CDI injection, with arquillian and an embedded container (both TomEE and GlassFIsh).

THe sample seems not working, even if the logs show correct behavoir:

Aug 14, 2018 12:01:03 PM org.mybatis.cdi.MybatisExtension processAnnotatedType
INFO: MyBatis CDI Module - Found class with @Mapper-annotation: QueryMapper
Aug 14, 2018 12:01:03 PM org.mybatis.cdi.MybatisExtension processProducer
INFO: MyBatis CDI Module - SqlSessionFactory producer MybatisFactoryProducers.buildFactory
Aug 14, 2018 12:01:03 PM org.mybatis.cdi.MybatisExtension afterBeanDiscovery
INFO: MyBatis CDI Module - Activated
Aug 14, 2018 12:01:03 PM org.mybatis.cdi.MybatisExtension afterBeanDiscovery
INFO: MyBatis CDI Module - Found a bean, which needs a Mapper interface org.example.code.impl.QueryMapper
Aug 14, 2018 12:01:03 PM org.mybatis.cdi.MybatisExtension afterBeanDiscovery
INFO: MyBatis CDI Module - Managed Mapper dependency: org.example.code.impl.QueryMapper, org.example.code.impl.QueryMapper
Aug 14, 2018 12:01:03 PM org.mybatis.cdi.MybatisExtension afterBeanDiscovery
INFO: MyBatis CDI Module - Managed SqlSession: org.apache.ibatis.session.SqlSession, org.apache.ibatis.session.SqlSession
Aug 14, 2018 12:01:03 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints

Caused by: java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1455)
at java.util.HashMap$KeyIterator.next(HashMap.java:1477)
at org.mybatis.cdi.CDIUtils.getRegistry(CDIUtils.java:120)
at org.mybatis.cdi.SerializableMapperProxy.getMapper(SerializableMapperProxy.java:68)
at org.mybatis.cdi.SerializableMapperProxy.(SerializableMapperProxy.java:53)
at org.mybatis.cdi.MyBatisBean.create(MyBatisBean.java:127)

I prepare a sample that replicate the problem:
sample.zip

There is a possibity to resolve the problem and been able to use Mybatis + CDi even in an embedded container?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions