1 2 Previous Next 15 Replies Latest reply on Feb 11, 2003 3:56 PM by njhy

    no security manager: RMI class loader disabled

    Trev Newbie

      I have a Session bean which calls a CMP 2.0 entity bean on JBoss 3.0.3 (using the local interface). I execute a local client to list the contents of the database and get the following exception. Any thoughts? I have all the jars in jboss\client in my classpath, so that shouldn't be a problem. Also, I have the bean reference tags in the ejb-jar.xml and the jboss.xml.

      Exception stack trace:
      java.lang.reflect.UndeclaredThrowableException
      at $Proxy1.listEmployees(Unknown Source)
      at employee.session.ejbproxy.EmployeeComp.listEmployees(EmployeeComp.jav
      a:133)
      at EBSessionNoProxyTest.main(EBSessionNoProxyTest.java:69)
      Caused by: java.lang.ClassNotFoundException: org.jboss.ejb.plugins.local.EntityP
      roxy (no security manager: RMI class loader disabled)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:368)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:159)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.jav
      a:200)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:151
      3)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
      626)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:18
      45)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
      646)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1603)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1271)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:18
      45)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
      646)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvo
      kerProxy.java:130)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
      a:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
      java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:8
      0)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessi
      onInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      ... 3 more

        • 1. Re: no security manager: RMI class loader disabled
          Christoph Grimm Newbie

          your client communicates with the server via rmi.
          the necessary stubs are downloaded to the client via the RMIClassloader at runtime. this happens even if you are running it on the same machine.

          to enable the RMIClassloader do the following:

          create a policy file like client.policy

          with at least this minimal content:

          grant {
          permission java.security.AllPermission;
          };

          start your client with the following option:
          -Djava.security.policy=client.policy

          • 2. Re: no security manager: RMI class loader disabled
            Adrian Brock Master

            You are not allowed to expose a CMR collection
            on a remote interface it is strictly for local use.

            > Caused by: java.lang.ClassNotFoundException:
            > org.jboss.ejb.plugins.local.EntityProxy

            You must change the collection into one that can go over
            the wire in your session bean.

            Regards,
            Adrian

            • 3. Re: no security manager: RMI class loader disabled
              Trev Newbie

              What you say makes sense. I added this file, though, and get the same exception "Caused by: java.lang.ClassNotFoundException: org.jboss.ejb.plugins.local.EntityProxy (no security manager: RMI class loader disabled)"

              My startup command was:
              java -Djava.security.policy=client.policy EBSessionNoProxyTest

              Any other thoughts as to why the RMI class loader is disabled, or how to enable it?

              • 4. Re: no security manager: RMI class loader disabled
                Adrian Brock Master

                System.setSecurityManager(new RMISecurityManager());

                or something like that?

                Regards,
                Adrian

                • 5. Re: no security manager: RMI class loader disabled
                  Christoph Grimm Newbie

                  Adrian is right,

                  i forgot to mention this step

                  Christoph

                  • 6. Re: no security manager: RMI class loader disabled
                    Juan Esteban Florez Newbie

                    Hi there,

                    Sorry for dropping in the middle of the discution.
                    but I´m having a similar problem here.

                    So, what would happen if the caller of the remote object is a servlet? how can i set up the RMISecurityManager in my jboss server to let me cownload some classes from other server?

                    pd:// please try to keep it "simple"

                    thanks

                    regards

                    • 7. Re: no security manager: RMI class loader disabled
                      Maokai Gong Newbie

                      Hi,

                      I think this is a popular problem for the people who start to use EJB local interface.

                      I have the same problem. I am using JBoss 3.0.3. I have a CMP bean with local interface only.

                      I have gone through some of the related threads in this forum. There are some suggestions. But it seems they don't work in my case.

                      I understand that my client (actually a junit code) may not be able to call the bean as they may be in separate VMs (I did set "fork="no"" in my build.xml for this juni test target). So I create a session bean with remote interface. I do add <ejb-local-ref> in ejb-jar.xml. Then my junit code accesses the CMP through the session bean. But I still get the same problem - (java.lang.ClassNotFoundException: org.jboss.ejb.plugins.local.LocalHomeProxy (no security manager: RMI class loader disabled).

                      When I lookup the CMP bean, I do use lookup("local/<my CMP bean name"). The name is the same as what is displayed in JBOSS console.

                      According to the suggestion here, I added: "
                      System.setSecurityManager(new RMISecurityManager());"in my code, created a client.policy file with full access granted. I also add "-Djava.security.policy=client.policy" in JAVA_OPTS in run.bat. But I got "access denied java.lang.RuntimePermission setContextClassLoader). JBoss enters infinitive loop, and I have to kill jboss by killing the terminal.

                      Someone suggested that the jboss.jar be in the JBOSS_CLASSPATH as jboss.jar contains the RMI classes.
                      but I got "java.lang.NoClassDefFoundError: org/jboss/system/ServiceMBeanSupport" problem when I did it.

                      I have the following jar files in my CLASSPATH: jboss-j2ee.jar, jaas.jar, jboss-client.jar,
                      jboss-common-client.jar, jbossmq-client.jar, jbosssx-client.jar, jnp-client.jar, log4j.jar, crimson.jar, $resource.dir which contains the cliemt.policy file.

                      By the way, the bean works fine if I changes local interface into remote interface.

                      Could anyone kindly point out what I did wrong and what happens behind the scene. It is really urgent.

                      Thank you very much in advance.

                      Regards,

                      Gong

                      • 8. Re: no security manager: RMI class loader disabled
                        Maokai Gong Newbie

                        Hi,

                        Well, nobody answers my question. Let me try to answer it myself so that other people know how to solve the same problem.

                        It seems that all solutions mentioned in my previous e-mail are not right for my problem. My understanding is that somehow JBoss mis-interprets my CMP bean and tries to access the bean in a remote way. As no remote interfaces are defined, such kind of exception is thrown.

                        Implementing local interfaces is strict comparing to remote interface implementation. You have to take care on the following things which may led JBoss mis-understands your beans although I don't know which one direct contribute to the "no security manager" problem:

                        1. The Bean implementation class must be 'abstract'

                        2. There must be a jboss.xml with your ejb-jar.xml under same META-INF

                        3. In jboss.xml, you must specify <local-jndi-name> instead of <jndi-name> for your beans with local interfaces

                        4. in ejb-jar.xml, you must specify the DTD version as followiing:
                        !DOCTYPE ejb-jar PUBLIC
                        <"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
                        "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
                        It sees that by default, JBoss uses CMP1.1.

                        5. All table fields' 'get' and 'set' abstract accessors must be defined in the Bean implementation class.

                        6. There should be a jbosscmp-jdbc.xml bundled with your ejb-jar.xml if you use a datasource other than defaultDS.

                        Regards,

                        Gong

                        • 9. Re: no security manager: RMI class loader disabled
                          Marian Gutica Newbie

                          Hi,
                          I have done all the steps described in the last post with no luck. I did not do the security stuff. Do I have to do that ? I am getting the same exception, LocalHomeProxy (no security manager: RMI class loader disabled). If I use remote interface works fine.
                          Does anybody has a definitive answer to this ?

                          • 10. Re: no security manager: RMI class loader disabled
                            Adrian Brock Master

                            Local means same JVM
                            You cannot send a local interface over RMI.

                            Regards,
                            Adrian

                            • 11. Re: no security manager: RMI class loader disabled
                              Marian Gutica Newbie

                              Ok. I did the client.policy and instantiate the SecurityManager in my client:
                              System.setSecurityManager(new RMISecurityManager());
                              I am using Jbuilder so I added to my application parameters:
                              -Djava.security.policy=C:\client.policy

                              This is the exception I get now in my client:
                              java.security.AccessControlException: access denied (java.net.SocketPermission 230.0.0.4 connect,accept,resolve)

                              This becomes highly frustrating as I bought the documentation for CMP 2.0 and follow exactly the book and the CrimePortal example.
                              This is the problem with Open Source projects ! as I've seen other posts stating that the examples provided should work !

                              Can somebody please shed some light into how is this supposed to work ?

                              • 12. Re: no security manager: RMI class loader disabled
                                Marian Gutica Newbie

                                Thank you.
                                Can you please confirm if I understand this correctly:

                                In my case the database is on a remote Unix server, I run JBoss in the same JVM with my client, and I have 2 java CMP entity beans with a one to many relation between them.

                                1. Because the database is on a remote server I have to use remote interface to access my beans ?

                                2. Because a relation between 2 beans can be implemented just in a local interface I can not use remote interface ?

                                So I have the following 2 possible solutions:

                                1. Implement the beans locally in the Unix server where the database is located.

                                OR

                                2. Explicitly implement the relation in the java beans through a query definition.

                                Cheers

                                • 13. Re: no security manager: RMI class loader disabled
                                  Adrian Brock Master

                                  Huh?

                                  The location of the database is irrelevant. Unless
                                  you are using something hypersonic in VM all data is
                                  serialized over the wire.

                                  The local interface is for use by a client in the same VM.
                                  CMR must be defined using local interfaces because
                                  the two beans in the relation have to talk locally.

                                  The remote interface can be used in the same VM or
                                  outside the VM.

                                  Regards,
                                  Adrian

                                  • 14. Re: no security manager: RMI class loader disabled
                                    Marian Gutica Newbie

                                    Thank you for your reply. I am new to this so I did more reading and I understand the remote versus local interfaces. I created a session bean that exposes it's interfaces remotely and calls the local interfaces for the entity beans. And it works fine processing (reading) data from the database.
                                    It will process part of the data and will throw an exception on the server:

                                    10:25:33,620 WARN [TxCapsule] Lock contention, tx=XidImpl [FormatId=257, Global
                                    Id=DDS47//1, BranchQual=]
                                    10:25:33,620 WARN [TxCapsule] Transaction XidImpl [FormatId=257, GlobalId=DDS47
                                    //1, BranchQual=] timed out. status=STATUS_ACTIVE
                                    10:25:33,670 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedB
                                    y:
                                    javax.transaction.RollbackException: Already marked for rollback
                                    at org.jboss.tm.TxCapsule.registerSynchronization(TxCapsule.java:786)
                                    at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.
                                    java:121)
                                    at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge$FieldState.g
                                    etRelationSet(JDBCCMRFieldBridge.java:1142)
                                    at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getInstanceV
                                    alue(JDBCCMRFieldBridge.java:495)
                                    at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getValue(JDB
                                    CCMRFieldBridge.java:465)
                                    at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke
                                    (EntityBridgeInvocationHandler.java:124)
                                    at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
                                    at adddbmerge.TT_StreetBean$Proxy.getBlocks()
                                    at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                    at java.lang.reflect.Method.invoke(Unknown Source)
                                    at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityConta
                                    iner.java:1194)
                                    at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRel
                                    ationInterceptor.java:95)
                                    at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntityS
                                    ynchronizationInterceptor.java:308)
                                    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
                                    ke(CachedConnectionInterceptor.java:186)
                                    at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentr
                                    anceInterceptor.java:90)
                                    at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
                                    Interceptor.java:152)
                                    at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
                                    tor.java:107)
                                    at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreation
                                    Interceptor.java:69)
                                    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
                                    rceptor.java:107)
                                    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
                                    torCMT.java:178)
                                    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:6
                                    0)
                                    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
                                    java:130)
                                    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
                                    at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
                                    at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLoca
                                    lContainerInvoker.java:301)
                                    at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
                                    at $Proxy51.getBlocks(Unknown Source)
                                    at adddbmerge.SessionStreetBean.createMergeSession(SessionStreetBean.jav
                                    a:74)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                    at java.lang.reflect.Method.invoke(Unknown Source)
                                    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
                                    tatelessSessionContainer.java:660)
                                    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
                                    ke(CachedConnectionInterceptor.java:186)
                                    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
                                    elessSessionInstanceInterceptor.java:77)
                                    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
                                    rceptor.java:107)
                                    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
                                    torCMT.java:178)
                                    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:6
                                    0)
                                    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
                                    java:130)
                                    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
                                    at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContai
                                    ner.java:313)
                                    at org.jboss.ejb.Container.invoke(Container.java:712)
                                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                                    at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
                                    381)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                    at java.lang.reflect.Method.invoke(Unknown Source)
                                    at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
                                    at sun.rmi.transport.Transport$1.run(Unknown Source)
                                    at java.security.AccessController.doPrivileged(Native Method)
                                    at sun.rmi.transport.Transport.serviceCall(Unknown Source)
                                    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
                                    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
                                    ce)
                                    at java.lang.Thread.run(Unknown Source)

                                    This is the exception I am getting currently.

                                    Before I was getting IllegalStateException sometimes or OutOfMemoryException other times.
                                    For the method of the session bean I was using RequiresNew
                                    in the container-transaction section.

                                    Here is my ejb-jar.xml container transaction section for the session bean currently:

                                    <container-transaction>

                                    <ejb-name>SessionStreetEJB</ejb-name>
                                    <method-name>createMergeSession</method-name>

                                    <trans-attribute>Required</trans-attribute>
                                    </container-transaction>
                                    </assembly-descriptor>

                                    I use Required instead of RequiresNew.

                                    And here is the container-transaction for my entity beans:
                                    <container-transaction>

                                    <ejb-name>TT_StreetEJB</ejb-name>
                                    <method-name>*</method-name>


                                    <ejb-name>TT_BlockEJB</ejb-name>
                                    <method-name>*</method-name>


                                    <ejb-name>TT_DistrictEJB</ejb-name>
                                    <method-name>*</method-name>

                                    <trans-attribute>Required</trans-attribute>
                                    Question:
                                    The exception I am getting is because I am not using the proper values for the container-transaction configuration ? or it's a JDBC issue ? or simply the server is running out of memory ?

                                    Really I don't understand why I get different exceptions ? Because of this I don't know what action to take ?

                                    Appreciate your help and patience
                                    Cheers

                                    1 2 Previous Next