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 6688817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:26:50+00:00 2026-05-26T05:26:50+00:00

Fairly new to Spring, so I’m having some trouble with this. I’m trying to

  • 0

Fairly new to Spring, so I’m having some trouble with this. I’m trying to use LDAP security with Spring. I can use a properties file I created inside the webapp itself. But what I would like to do is load and read the context.xml file of the server (it has all the values I need for this and other applications).

This is what I have:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
    </bean>   
    <bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
        <property name="searchContextAttributes" value="true"/>
        <property name="contextOverride" value="true"/>
        <property name="ignoreResourceNotFound" value="true"/>
        <property name="locations">
            <list>

                <value>/WEB-INF/properties/dataUploadProperties.properties</value>
                <value>/WEB-INF/properties/globalProperties.properties</value>
                <value>context.xml</value>

            </list>
        </property>
    </bean>

I’m able to load and read the 2 properties files, but the context.xml is not found. Does it need to be the absolute path on the server?

Thanks
Chris

  • 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-26T05:26:51+00:00Added an answer on May 26, 2026 at 5:26 am

    So the first thing I would recommend is to use Spring Security. It has an already build in LDAP support.


    but the context.xml is not found

    Normally this (reading the context.xml directly) is not the way you should go.
    Instead, define some properties and or JNDI resources in the context.xml and then use them in the spring configuration.

    For example:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
                   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                   http://www.springframework.org/schema/jee
                   http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
    
        <!-- access via jndi -->
        <jee:jndi-lookup id="jndiEmailSession"
            jndi-name="java:comp/env/email/session/myEmailSession" />
    
        <!-- direct access for properties required the SERVLET contect property
             place older configurer, then it works like properties from normal
             property files -->
        <bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">      <property name="locations" value="classpath*:META-INF/spring/*.properties" />   </bean>
    
       <bean class=Demo>
          <property name="someString" value="${simpleValue}" />
       </bean>
    </beans>
    

    context.xml:

    <Resource name="email/session/myEmailSession"
              type="javax.mail.Session"
              auth="Container"                          
        password="secret"
        mail.debug="false"
        mail.transport.protocol="smtp"  
        mail.smtp.auth="true"
        mail.smtp.user="test@example.com"
        mail.smtp.host="mail.example.com"
        mail.smtp.from="test@example.com"/>
    
     <Parameter name="simpleValue" value="any" override="false" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new Akka world and was trying to use akka-spring integration. I
I'm fairly new to Spring and I need a bean that has two properties
I'm fairly new to C#, and trying to figure out string insertions (i.e. some
Being fairly new to programming, I am having trouble understanding exactly what Homebrew does...
I'm fairly new to C programming and having some difficulties wrapping my brain around
I'm sure this is a fairly common situation. I'm using the Spring Security Core
Fairly new to programming. I just can't wrap my head around how to get
Fairly new to Objective C and trying to work within Storyboards given it's the
I fairly new to JQuery and perhaps trying to achieve something that might be
I'm trying to wire up Spring Data JPA objects manually so that I can

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.