Tomee/CDI SEVERE: Type interface ke.chege.accounts.mybatis.OauthRepository is not known to the MapperRegistry

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Tomee/CDI SEVERE: Type interface ke.chege.accounts.mybatis.OauthRepository is not known to the MapperRegistry

Chege Kĩnũthia
Hi,

I have a web application being developed on Apache Tomee 8.0.1 whose config looks as follows.

pom.xml

       <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-cdi</artifactId>
            <version>1.1.1</version>
            <scope>provided</scope>
        </dependency>

mybatis.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <environments default="development">
        <environment id="development">
            <transactionManager type="MANAGED" >
                <!--<property-->
            </transactionManager>
            <dataSource type="JNDI">
                <property name="data_source" value="java:openejb/Resource/marketPlace" />
            </dataSource>
        </environment>
    </environments>
    <mappers>
        <mapper resource="oauth.xml"/>
    </mappers>
</configuration>

oauth.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="ke.chege.accounts.mybatis.OauthRepository">
.
.
.
</mapper>

CDI Producer

    @Produces
    @ApplicationScoped
    @SessionFactoryProvider
    public SqlSessionFactory produceFactory() throws Exception {
        InputStream inputStream = Resources.getResourceAsStream("mybatis.xml");
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        return sqlSessionFactory;
    }


OauthRepository

import org.mybatis.cdi.Mapper;
@Mapper
public interface OauthRepository {
...
}

This setup works most of the time. The problem arises when netbeans reloads/redeploys which makes development painfully slow.

Stacktrace.

SEVERE: Type interface ke.chege.accounts.mybatis.OauthRepository is not known to the MapperRegistry.
org.apache.ibatis.binding.BindingException: Type interface ke.chege.accounts.mybatis.OauthRepository is not known to the MapperRegistry.
    at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:47)
    at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:823)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:291)
    at ke.chege.accounts.JdbcDataProvider.doGetClient(JdbcDataProvider.java:104)

Is there a workaround to this issue?

Thanks,
Chege.




--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/65697879-570f-4e0d-8ea2-01be434367ceo%40googlegroups.com.