Hi there, im having problem getting a JDBC connection from a EJB SessionBean.The error which is being throwing is: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings.
i thought it might be because i already have a opened connection with different datasource, so i configured a XA datasource to avoid transaction problems, but i doesn't work at all, so i don't know if im doing something wrong in my code. here it is.
try
{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL,"jnp://localhost:11099");
p.put("java.naming.factory.url.pkgs", "org.jboss.naming");
InitialContext ic = new InitialContext(p);
DataSource dataSource = (DataSource)ic.lookup("java:/jdbc/etlreportservices");
return dataSource.getConnection();
}
catch(Exception e)
{
e.printStackTrace();
}
the problem is calling dataSource.getConnection().
any help i'll appreciate.