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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:54:27+00:00 2026-05-26T10:54:27+00:00

I am trying to pass a JVM parameter for a variable configured in web.xml

  • 0

I am trying to pass a JVM parameter for a variable configured in web.xml as a context-parameter using a -D notation when starting weblogic server. I have already tried this same configuration using Tomcat 7 and it works as expected, but it DOES NOT work in weblogic server 10.3.3. Any clues?

web.xml

<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
    <display-name>testeParWebXml</display-name>
    <context-param>
        <description>Habilita ou desabilita a configuração de debug do Facelets! Página de debug do Seam.</description>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>${habilitar.debug}</param-value>
    </context-param>
<welcome-file-list>

Then when starting the jvm I pass the parameter using:

-Dhabilitar.debug=true

And I built a Servlet to test:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter pw = response.getWriter();
        String valorParametro = getServletContext().getInitParameter("facelets.DEVELOPMENT");
        pw.write("Param value from web.xml ==>> " + valorParametro);
}

As I mentioned using Tomcat if I change the value to false or true in the -Dhabilitar.debug flag it correctly prints the value in the servlet.

Param value from web.xml ==>>  true

In weblogic I get the output like:

Param value from web.xml ==>>  ${habilitar.debug}

As noticed weblogic DOES NOT parse the value of the variable set in web.xml.

Is it possible to make this work properly in weblogic 10.3.3?

  • 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-26T10:54:28+00:00Added an answer on May 26, 2026 at 10:54 am

    Looks like there is not a consistent behavior across different containers. IMHO you should not do it that way. I have always used (and have always seen people using) web.xml containing default values (rather than parameterized values) for stuff.
    Please see these additional resources (including some not-so-elegant but working approaches to your problem):

    • Best practices for defining and initializing variables in web.xml and then accessing them from Java code
    • Referencing Environment Variables in web.xml
    • http://www.coderanch.com/t/79094/Websphere/environment-variable-referance-Web-xml
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass client certificate to a web service using JAX-RPC implementation. (the
Trying to pass data to the server but it keeps returning a Parameter Missing
I'm trying to pass a command parameter with my command. I have commands in
I'm trying to pass an int between two classes using a bundle. I have
I'm trying to pass in a Base64 string into a C#.Net web application via
I'm trying to pass one method to another in elisp, and then have that
I am trying to pass some Subsonic collections to a client via a web
I'm trying to pass a null value for the first parameter in the code
I am trying to pass a dataString to to an ajax call using JQuery.
Trying to pass the variable flickrurl to a PHP page with jQuery/ajax. It works

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.