Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7520379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:03:38+00:00 2026-05-30T02:03:38+00:00

I am using jboss-as-7.1.0.Final-SNAPSHOT and trying to set up custom login module that uses

  • 0

I am using jboss-as-7.1.0.Final-SNAPSHOT and trying to set up custom login module that uses a database. I followed the instructions in the AS7 documentation to configure a new security domain in standalone.xml, security-domain in jboss-security.xml and security-constraint in web.xml and I set JBoss’ logging to TRACE so I can see that my custom login module methods are being successfully invoked (e.g. login(), authenticate()).

I don’t want to use manual transaction demarcation in my login module, so it would be great if my login module could be e a stateful ejb.

Taking a look at the JBoss AS7 : Security Domain Model article, which says:

Just write the FQCN in the code attribute and it should work out of the box.

To place the custom login module class files, you can place them in a jar and put it either:

application classpath of your web archive (war) or ejb jar or enterprise archive (ear) OR
separate module under the modules directory.

It looks like the sky’s the limit on where I can place my login module, including within the EJB module of my application. Does this mean that my custom login module can be a stateful ejb? I haven’t read anything that says, “No.” However when I deploy my login module as stateful ejb injected managed beans and injected EntityManager do not appear to be injected; I get NullPointerException when I try to invoke methods on them.

I took a look at org.jboss.security.auth.spi.DatabaseServerLoginModule, which is provided as one of JBoss’ default login modules. I wanted to see how database access is handled there. DataSource lookup is via InitialContext e.g.

InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(dsJndiName);
conn = ds.getConnection();

and transactions are all handled manually. I don’t want to use this approach if possible.

Can I use stateful ejb? Or am I way off base in my approach to this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:03:40+00:00Added an answer on May 30, 2026 at 2:03 am

    The question was answered on JBoss Community as follows:

    • Custom login module cannot be a stateful ejb because “the respective lifecycles of a stateful EJB and a login module are quite different,” and “login modules are created and used for the duration of a single authentication step and then left to be garbage collected.”

    • Custom login module can’t use CDI, so one cannot inject a managed bean. One person said that it would be pretty cool if JAAS provided a means to inject a managed bean, and that someone needs to propose an update the JAAS spec. to allow this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While using a database server login module for authentication in jboss 6, I found
I'm using jboss 7.1.1.final and i have a logging module i wrote that extends
I'm using Jboss AS 7.1.1.final and I'm trying to add an oracle Datasource: <datasource
I'm trying to implement an ejb-call by using JNDI-naming. Setup: JBoss-6.1.0.Final ear-deploy: gwt.war ejb.jar
I'm trying to install Jboss 7.1.0-Final as a service using the Java service wrapper
JBoss AS7.1.1.Final with Spring 3.1.0 We are using the Spring MVC framework generated by
I'm using Jboss 7.1.1.final and I need to define 2 different DLQ's so that
Running JBoss 4.2.3.GA and trying to deploy a WAR that is using Spring/Hibernate/JPA. I'm
Using JBoss AS 6.1.0 Final with default deployment profile. I like to send a
I'm using Jboss 7.1.1.final and i have an application with heavy use of JMS.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.