6 Replies Latest reply on May 20, 2003 9:15 AM by Adrian Brock

    Principal = null calling secured EJB from java client

    Mauricio Spinetti Newbie

      I'm trying to do a very simple sample of calling a secured EJB from a Java client, but when I try to get the home of the EJB Jboss gives "SecurityInterceptor -> Authentication exception, principal = null.

      Can somebody help me about that?? What's wrong??

      I've tried with a Java client that uses JAAS to authenticate a user and I get the same error.

      I'm using Jboss-Tomcat 3.2.0 over Win2000 professional with JDK1.4.1_02.

      Thanks for help. Sorry for my english, I hope you understand.


      Login-config.xml entry.
      -------------------------------

      <application-policy name = "ejb">

      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
      flag = "required" />

      </application-policy>


      ejb-jar.xml
      ------------------

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <display-name>Comp1</display-name>
      <ejb-name>Comp1</ejb-name>
      jboss1.Comp1Home
      jboss1.Comp1
      <ejb-class>jboss1.Comp1Bean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <display-name>First</display-name>
      <ejb-name>First</ejb-name>
      jboss1.FirstHome
      jboss1.First
      <ejb-class>jboss1.FirstBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>
      <assembly-descriptor>
      <security-role>

      <role-name>teller</role-name>
      </security-role>
      <method-permission>
      <role-name>teller</role-name>


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

      </method-permission>
      <container-transaction>

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


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

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


      jboss.xml
      -------------.


      <security-domain>java:/jaas/ejb</security-domain>
      <enterprise-beans>

      <ejb-name>Comp1</ejb-name>
      <jndi-name>ejb/Comp1</jndi-name>


      <ejb-name>First</ejb-name>
      <jndi-name>First</jndi-name>

      </enterprise-beans>