Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to dynamically pass parameters in web.xml using weblogic 10.3.x?
    text
    copied!<p>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?</p> <p><strong>web.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;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"&gt; &lt;display-name&gt;testeParWebXml&lt;/display-name&gt; &lt;context-param&gt; &lt;description&gt;Habilita ou desabilita a configuração de debug do Facelets! Página de debug do Seam.&lt;/description&gt; &lt;param-name&gt;facelets.DEVELOPMENT&lt;/param-name&gt; &lt;param-value&gt;${habilitar.debug}&lt;/param-value&gt; &lt;/context-param&gt; &lt;welcome-file-list&gt; </code></pre> <p>Then when starting the jvm I pass the parameter using: </p> <pre><code>-Dhabilitar.debug=true </code></pre> <p>And I built a Servlet to test: </p> <pre><code>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 ==&gt;&gt; " + valorParametro); } </code></pre> <p>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.</p> <pre><code>Param value from web.xml ==&gt;&gt; true </code></pre> <p>In weblogic I get the output like:</p> <pre><code>Param value from web.xml ==&gt;&gt; ${habilitar.debug} </code></pre> <p>As noticed weblogic DOES NOT parse the value of the variable set in web.xml.</p> <p>Is it possible to make this work properly in weblogic 10.3.3?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload