4 Replies Latest reply on Jun 22, 2005 2:22 AM by dumbledore

    Second Call fails

    dumbledore

      A struts-action makes these 2 calls in its execute-method:


      bd.executeRegistration(playerRegistrationForm);
      ...
      bd.getInstructionsAfterRegistration();
      



      bd is a business-delegate. Between these 2 calls, no other method of the bd is called by the action. bd is a normal (not static) class, holding a local reference to a stateful session-bean as instance-variable called session. The 2 methods called from the action are:

       public String executeRegistration(PlayerRegistrationForm form) throws DuplicatePKException {
       instructionsAfterRegistration = session.getInstructionsAfterRegistration();
       return session.executeRegistration(form);
       }
      
       public String getInstructionsAfterRegistration() {
       return session.getInstructionsAfterRegistration();
       }
      


      The method bd.executePlayerRegistration() is first called. In this method, both calls on the stateful sessionbean

      session.getInstructionsAfterRegistration();
      session.executeRegistration(form);
      


      work greatly. But when the action calls (second call) the bd.getInstructionsAfterRegistration() - method, the bd can't call session.getInstructionsAfterRegistration() again . Here is the Exception, that is thrown:

      17:00:30,805 DEBUG [PlayerRegistrationBD] getInstructionsAfterRegistration() entered
      17:00:30,825 WARN [RequestProcessor] Unhandled Exception thrown: class javax.ejb.AccessLocalException
      17:00:30,827 ERROR [Engine] StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
      javax.ejb.AccessLocalException: SecurityException; CausedByException is:
      No matching username found in Principals
      at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:366)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:196)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
      at org.jboss.ejb.Container.invoke(Container.java:870)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
      at org.jboss.ejb.plugins.local.StatefulSessionProxy.invoke(StatefulSessionProxy.java:58)
      at $Proxy239.getInstructionsAfterRegistration(Unknown Source)
      .....

      javax.security.auth.login.FailedLoginException: No matching username found in Principals
      at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:103)


      in the EJB-JAR.XML:
      for the session-bean:
       <method-permission >
       <description><![CDATA[description not supported yet by ejbdoclet]]></description>
       <unchecked/>
       <method >
       <description><![CDATA[Default create method]]></description>
       <ejb-name>PlayerRegistration</ejb-name>
       <method-intf>LocalHome</method-intf>
       <method-name>create</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       </method-params>
       </method>
       </method-permission>
       <method-permission >
       <description><![CDATA[description not supported yet by ejbdoclet]]></description>
       <unchecked/>
       <method >
       <description><![CDATA[Default create method]]></description>
       <ejb-name>PlayerRegistration</ejb-name>
       <method-intf>Home</method-intf>
       <method-name>create</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       </method-params>
       </method>
       </method-permission>
       <method-permission >
       <description><![CDATA[description not supported yet by ejbdoclet]]></description>
       <unchecked/>
       <method >
       <description><![CDATA[]]></description>
       <ejb-name>PlayerRegistration</ejb-name>
       <method-intf>Local</method-intf>
       <method-name>getInstructionsAfterRegistration</method-name>
       <method-params>
       </method-params>
       </method>
       </method-permission>
       <method-permission >
       <description><![CDATA[description not supported yet by ejbdoclet]]></description>
       <unchecked/>
       <method >
       <description><![CDATA[]]></description>
       <ejb-name>PlayerRegistration</ejb-name>
       <method-intf>Local</method-intf>
       <method-name>getInitializedPlayerRegistrationForm</method-name>
       <method-params>
       </method-params>
       </method>
       </method-permission>
       <method-permission >
       <description><![CDATA[description not supported yet by ejbdoclet]]></description>
       <unchecked/>
       <method >
       <description><![CDATA[]]></description>
       <ejb-name>PlayerRegistration</ejb-name>
       <method-intf>Local</method-intf>
       <method-name>executeRegistration</method-name>
       <method-params>
       <method-param>control.actionForm.PlayerRegistrationForm</method-param>
       </method-params>
       </method>
       </method-permission>
      
      
      


      So: Why fails the second call, while the first works?