Hi,
I have a problem with context managed transactions, I'm triying to
work with EJB3 and CMT and Mybatis in a GlassFish3 server
I'm using this configuration file
<?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="EXTERNAL">
<property name="SetAutoCommitAllowed" value="false" />
</transactionManager>
<dataSource type="JNDI">
<property name="data_source" value="jdbc/mytest" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="mybatis/Mapper.xml" />
</mappers>
</configuration>
But when I try to get a session a exception is raised..
[#|2011-10-31T12:39:46.393-0300|SEVERE|glassfish3.1.1|
javax.enterprise.system.std.com.sun.enterprise.server.logging|
_ThreadID=25;_ThreadName=http-thread-pool-8080(2);|
org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in SQL Mapper Configuration
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing
SQL Mapper Configuration. Cause:
org.apache.ibatis.builder.BuilderException: Error resolving class .
Cause: org.apache.ibatis.type.TypeException: Could not resolve type
alias 'EXTERNAL'. Cause: java.lang.ClassNotFoundException: Cannot
find class: EXTERNAL
at
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:
8)
at
org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:
32)
I have a static class who give the session
import java.io.IOException;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
public class ConnectionFactory {
private static SqlSessionFactory sqlMapper;
static{
try{
sqlMapper = new
SqlSessionFactoryBuilder().build(Resources.getResourceAsReader("mybatis/
Configuration.xml"));
}catch(Exception e){
//TODO correct this
e.printStackTrace();
}
}
public static SqlSession getSession() throws IOException{
return sqlMapper.openSession();
}
}
and I tried to get the session from a servlet, inside the ejb, in a
class inside a jar.. but not worked in any way...
with <transactionManager type="JDBC"/> I dont have problems
Any Idea???
Thanks in advance