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 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

Ask A Question

Stats

  • Questions 225k
  • Answers 225k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer in the addcar method, you try to create a new… May 13, 2026 at 12:57 am
  • Editorial Team
    Editorial Team added an answer Q1. Does closing a database link invalidate the package? Not… May 13, 2026 at 12:57 am
  • Editorial Team
    Editorial Team added an answer It's not obvious that your friendship model is associative. Is… May 13, 2026 at 12:57 am

Related Questions

Does anyone have experience using the URL Rewrite Module (see here )? Can it
Does anyone have experience using makefiles for Visual Studio C++ builds (under VS 2005)
Does anyone have experience with LLVM , llvm-gcc , or Clang ? The whole
Does anyone have experience with algorithms for evaluating hypergeometric functions? I would be interested

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.