no security manager: RMI class loader disabled
tdzierza Nov 21, 2014 2:20 PMI have EAR with following structure:
application.xml
backend.jar
commons.jar
jboss-service.xml
log4j.jar
MANIFEST.MF
mybatis-3.2.8.jar
permissions.xml
Inside backend.jar simple mbean to test operation connected with user.
public class UserService implements UserServiceMBean {
public void printResults()
{
SqlSessionFactory sqlSessionFactory = ConnectionFactory.getSession();
SqlSession session = sqlSessionFactory.openSession();
try {
UserMapper mapper = session.getMapper(UserMapper.class);
mapper.selectByPrimaryKey(1); // throws exception
} finally {
session.close();
}
System.out.println(message);
}
// The lifecycle
public void start() throws Exception
{
System.out.println(">>>>Starting with message=" + message);
}
public void stop() throws Exception
{
System.out.println(">>>>Stopping with message=" + message);
}
}
How I run tests:
jconsole -debug
firstly I get Exception:
java.lang.SecurityException: Expecting a javax.rmi.ssl.SslRMIClientSocketFactory RMI client socket factory in stub!
but if I understand well it is depend with unsecure transmission, and I'am working only inside localhost so it shouldn't be reason of my next exception (bolded in code)
java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
java.lang.ClassNotFoundException: org.apache.ibatis.binding.BindingException (no security manager: RMI class loader disabled)
In very beginnig i tried to use JNDI to implementation of DataSource for MyBatis, but with similar result - RMI class loader disabled. So i switched to xml configuration for MyBatis.
What I did to resolve my problem:
added permissions.xml
<permissions xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/permissions_7.xsd"
version="7">
<permission>
<classname>java.security.AllPermission</classname>
</permission>
</permissions>
without positive result