Environment:
JBoss embedded Alpha 7
Java 1.5.0_06
Eclipse 3.1.2
JUnit 4.0 (but writing old school test since Maven doesn?t understand 
annotations tests)

The Case
I have written a unit test that behaves ?funny? because it correctly throws a 
EJBAccessException: Authentication failure when I use a wrong password or 
unknown user ? but throws a NullPointerException when I use the correct 
user/password.

Is this a known problem or have I done an environment setup error? All help is 
more then welcome.


Details:
The exception
javax.ejb.EJBException: java.lang.NullPointerException
        at 
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
        at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
        at 
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
        at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
        at 
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
        at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

The test class (ripe)

  | public class MpSupportBeanTest extends TestCase {
  | 
  | protected void setUp () {
  | EJB3StandaloneBootstrap.boot(null);
  | EJB3StandaloneBootstrap.deployXmlResource("security-beans.xml");
  |     EJB3StandaloneBootstrap.scanClasspath();
  |     }
  | 
  | public static InitialContext getInitialContext() throws Exception {
  |     Hashtable props = getInitialContextProperties();
  |     return new InitialContext(props);
  |     }
  | 
  | private static Properties getInitialContextProperties() {
  |     Properties props = new Properties();
  |     props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
  |     "org.jboss.security.jndi.JndiLoginInitialContextFactory");
  |     props.setProperty(Context.SECURITY_PRINCIPAL, "firstuser");
  |     props.setProperty(Context.SECURITY_CREDENTIALS, "validpassword");
  |     return props;
  |     }
  | 
  | public void testGetSubscriberDetails() throws Exception {
  |     InitialContext ctx = getInitialContext();
  |     MpSupport support = (MpSupportLocal) ctx.lookup("MpSupport/locale");
  |     Subscriber s = support.getSubscriberDetails();
  |     assertNotNull(s);
  |     }
  | }

The session bean (ripe)


  | @Stateless
  | @SecurityDomain("other")
  | public class MpSupportBean implements MpSupport{
  | 
  | @RolesAllowed("subsciber")
  | public Subscriber getSubscriberDetails() {
  | }

Besides that I have copied default.persistence.properties
ejb3-interceptors-aop.xml
embedded-jboss-beans.xml
jboss-jms-beans.xml
log4j.xml
login-config.xml
roles.properties
security-beans.xml
users.properties

and modifed the user and roles files so they contain a subscriber role and a 
firstuser with password validpassword

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3947696#3947696

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3947696


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to