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

  • SEARCH
  • Home
  • 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 179155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:21:25+00:00 2026-05-11T14:21:25+00:00

Does anyone have experience bundling a datasource (-ds.xml) definition + login-config.xml as a service

  • 0

Does anyone have experience bundling a datasource (-ds.xml) definition + login-config.xml as a service archive in jboss? I’ve been fighting with this for awhile to no avail. I’m just looking for some pointers on how I should be laying the .sar out. I want the .sar to ultimately live in a .ear. Any pointers greatly appreciated!

  • 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. 2026-05-11T14:21:26+00:00Added an answer on May 11, 2026 at 2:21 pm

    This is relatively straightforward task.

    Your EAR file needs to have following layout:

    my-app.ear     |+ META-INF        |+ applications.xml and jboss-app.xml     |+ myapp.war     |+ myapp.jar     |+ lib     |+ my-ds.xml     |+ my-login-module-service.xml 

    where my-ds.xml contains datasource definition as usual. my-login-module-service.xml defines MBean based on the DynamicLoginConfig class. These modules are then referenced within jboss-app.xml (custom JBoss deployment descriptor) as demostrated here:

    <jboss-app> <module>     <service>my-login-module-service.xml</service> </module>  <module>     <service>my-ds.xml</service> </module> </jboss-app> 

    Easiest way how to create Login Module definition is to use support for embedded XML documents as attributes values. Such a config (my-login-module-service.xml) will looks like this:

    <server>     <mbean code='org.jboss.security.auth.login.DynamicLoginConfig'         name='jboss:service=DynamicLoginConfig'>         <attribute name='PolicyConfig' serialDataType='jbxb'>         <jaas:policy xsi:schemaLocation='urn:jboss:security-config:4.1 resource:security-config_4_1.xsd' xmlns:jaas='urn:jboss:security-config:4.1' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>         <jaas:application-policy name='userinrole'>             <jaas:authentication>                 <jaas:login-module code='org.jboss.security.auth.spi.XMLLoginModule' flag='required'>                 <jaas:module-option name='my-policy-123'>                 <ur:users xsi:schemaLocation='urn:jboss:user-roles:1.0 resource:user-roles_1_0.xsd' xmlns:ur='urn:jboss:user-roles:1.0'>                     <ur:user name='admin' password='admin123'>                         <ur:role name='MyUserRole'></ur:role>                         <ur:role name='AdminUser'></ur:role                     </ur:user>                 </ur:users>                 </jaas:module-option>                 <jaas:module-option name='unauthenticatedIdentity'>guest</jaas:module-option>                 </jaas:login-module>         </jaas:authentication>         </jaas:application-policy>         </jaas:policy>     </attribute>         <depends optional-attribute-name='LoginConfigService'>jboss.security:service=XMLLoginConfig</depends>         <depends optional-attribute-name='SecurityManagerService'>jboss.security:service=JaasSecurityManager</depends>     </mbean> </server> 

    You can verify successful deployment using JNDIVIew bean (java:/jaas/my-policy-123 in this example).

    For deployment including custom classes it’s better to choose SAR archive deployment together with custom code. In such a case you can separate MBean definition and Login Module config (META-INF/jboss-service.xml) :

    <server> <mbean code='org.jboss.security.auth.login.DynamicLoginConfig' name='jboss:service=DynamicLoginConfig'>     <attribute name='AuthConfig'>META-INF/login-config.xml</attribute>     <depends optional-attribute-name='LoginConfigService'>jboss.security:service=XMLLoginConfig</depends>     <depends optional-attribute-name='SecurityManagerService'>jboss.security:service=JaasSecurityManager</depends> </mbean> </server> 

    META-INF/login-config.xml will then contain your policy configuration.

    I’m using this approach on JBoss AS 4.x.

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

Sidebar

Related Questions

Does anyone have experience with / can anyone suggest best practices for storing quantities
I have a requirement where I have to add computer name to the pre-defined
Does any one know of any cross platform c/c++ libraries which will utilise the
I have a C# application and I would like to be able to read
Possible Duplicate: PhpMailer vs. Swiftmailer? I have always used PHP's built in mail() function
I am looking for a way to enable Google Chrome's Tab to search feature
For a new (Python) web application with the Pyramid web framework, I'd like to
I'm a C# developer looking to get into home automation as a hobby. I
Hoping someone can help me out. If I'm developing a Rails 3 app, but
I created an iphone application, and now I am consigned to do the same

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.