3 Replies Latest reply on Feb 2, 2002 7:54 PM by Luke Taylor

    Problem with method-permission

    Janis Newbie

      I'm using JBoss 2.4.4 with Tomcat 4.0.1.
      I have defined security domain in EJB. All works fine, but I always get SecurityException (no method permissions) when calling method if argument for the defined method is an array.
      For example, on method void setUserNames(String[] names);
      I changed method parameter to java.io.Serializable and all worked fine.
      What's the problem?

        • 1. Re: Problem with method-permission
          Luke Taylor Novice

          Hi,

          Dunno :). Why don't you post the XML for your method permissions and the server-side stack trace you get for the exception.

          Luke.

          • 2. Re: Problem with method-permission
            Janis Newbie

            Sorry :)
            method call print("bla") was OK, but printArray(new String[]{"bla"}) was not OK

            Here are stack trace
            java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.RemoteException: checkSecurityAssociation; nested exception is:
            java.lang.SecurityException: No method permissions assigned to method=printArray
            java.rmi.RemoteException: checkSecurityAssociation; nested exception is:
            java.lang.SecurityException: No method permissions assigned to method=printArray
            java.lang.SecurityException: No method permissions assigned to method=printArray
            at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
            at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
            at sun.rmi.server.UnicastRef.invoke(Unknown Source)
            at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invoke(Unknown Source)
            at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:357)
            at org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:123)
            at $Proxy1.printArray(Unknown Source)
            at test.Client.main(Client.java:66)

            - and configuration (ejb-jar):
            <ejb-jar>
            Print test
            <display-name>Ejbtest</display-name>
            <enterprise-beans>

            no description
            <display-name>PrintBean</display-name>
            <ejb-name>PrintBean</ejb-name>
            test.PrintHome
            test.Print
            <ejb-class>test.PrintEJB</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Bean</transaction-type>

            </enterprise-beans>

            <assembly-descriptor>
            <security-role>
            ODS Customer
            <role-name>customer</role-name>
            </security-role>
            <security-role>
            ODS Administrator
            <role-name>admin</role-name>
            </security-role>
            <method-permission>
            <role-name>testrole</role-name>

            <ejb-name>PrintBean</ejb-name>
            <method-intf>Home</method-intf>
            <method-name>remove</method-name>
            <method-params>
            <method-param>java.lang.Object</method-param>
            </method-params>


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Home</method-intf>
            <method-name>remove</method-name>
            <method-params>
            <method-param>javax.ejb.Handle</method-param>
            </method-params>


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>printArray</method-name>
            <method-params>
            <method-param>[Ljava.lang.String;</method-param>
            </method-params>


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>print</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            </method-params>


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Home</method-intf>
            <method-name>getHomeHandle</method-name>
            <method-params />


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>getPrimaryKey</method-name>
            <method-params />


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Home</method-intf>
            <method-name>getEJBMetaData</method-name>
            <method-params />


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>remove</method-name>
            <method-params />


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Home</method-intf>
            <method-name>create</method-name>
            <method-params />


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>isIdentical</method-name>
            <method-params>
            <method-param>javax.ejb.EJBObject</method-param>
            </method-params>


            <ejb-name>PrintBean</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>getEJBHome</method-name>
            <method-params />

            </method-permission>
            </assembly-descriptor>
            </ejb-jar>

            -jboss.xml

            <security-domain>java:/jaas/testdomain</security-domain>

            <enterprise-beans>

            <ejb-name>PrintBean</ejb-name>
            <jndi-name>ejb/test/PrintHome</jndi-name>

            </enterprise-beans>


            • 3. Re: Problem with method-permission
              Luke Taylor Novice

              Hi again,

              You've used the wrong syntax for arrays. It should be

              java.lang.String[]

              not

              [Ljava.lang.String

              Also, not that it matters now, but you've supplied the client side stack trace which is generally less useful for tracking problems. If you want to get useful feedback on a problem, please supply the server side stack from the log file (in the log directory).

              Luke.