1 Reply Latest reply on Nov 25, 2014 8:46 AM by Tomasz Dzierzawski

    no security manager: RMI class loader disabled

    Tomasz Dzierzawski Newbie

      I have EAR with following structure:











      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 {






      // 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"


          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/permissions_7.xsd"







      without positive result

        • 1. Re: no security manager: RMI class loader disabled
          Tomasz Dzierzawski Newbie

          This is case with JNDI to implementation of DataSource


          public class UserService implements UserServiceMBean {


                 public void printResults()


                    JndiDataSourceFactory JndiDataSource = new JndiDataSourceFactory();


                   Properties properties = new Properties();

                   Thread currentThread = Thread.currentThread();

                   ClassLoader contextClassLoader = currentThread.getContextClassLoader();

                   InputStream propertiesStream = contextClassLoader.getResourceAsStream("app.properties");

                   if (propertiesStream != null) {

                     try {



                 } catch (IOException e) {




              } else {

                   System.out.println("Properties file not found!");




                   JndiDataSource.setProperties(properties); // this line





          public class JndiDataSourceFactory implements DataSourceFactory {



            public void setProperties(Properties properties) {

            try {

                 InitialContext initCtx = null;

                 Hashtable env = getEnvProperties(properties);

                 if (env == null) {

                   initCtx = new InitialContext();

                 } else {

                   initCtx = new InitialContext(env);




                 if (properties.containsKey(INITIAL_CONTEXT)

                     && properties.containsKey(DATA_SOURCE)) {

                 Context ctx = (Context) initCtx.lookup(properties.getProperty(INITIAL_CONTEXT));

                 dataSource = (DataSource) ctx.lookup(properties.getProperty(DATA_SOURCE));

                 } else if (properties.containsKey(DATA_SOURCE)) {

                      dataSource = (DataSource) initCtx.lookup(properties.getProperty(DATA_SOURCE)); // here is exception




               } catch (NamingException e) {

                 throw new DataSourceException("There was an error configuring JndiDataSourceTransactionPool. Cause: " + e, e);






          AND EXCEPTION:


          Caused by: java.lang.ClassNotFoundException: org.apache.ibatis.datasource.DataSourceException (no security manager: RMI class loader disabled)


          My mybatis-config.xml



              <!-- properties resource="app.properties"/-->

              <environments default="development">

                  <environment id="development">

                      <transactionManager type="MANAGED">

               <property name="closeConnection" value="false"/>


                      <dataSource type="JNDI">

                          <property name="data_source" value="java:jboss/datasources/MyDBName"/>





                  <mapper resource="UserMapper.xml" />




          Similar exception no security manager: RMI class loader disabled) , no matter what i will try to do it's failed, connected with security i guess


          It could be possible that jconsole is reason ? I think that something is wrong with my wildfly configuration ... maybe something with my mbean service ...