Simplest way to modify properties from web.xml

I'm testing a very small Web application which uses init-params in web.xml for configuration. For manual testing purposes, I need to be able to change the values of these as easily as possible, preferably from the WebLogic admin console. (I can do it from the console on Websphere App Server, and on Tomcat by editing a file which is immediately re-read.) We don't currently use deployment descriptors in any way and this is only a test of basic code functionality, not of deployment mechanisms, so the change can be as quick-and-dirty as you like. I'm using WebLogic v10 on Linux.
Thanks,
Pete

Another option for you may be to deploy the application in exploded format and use weblogic.Deployer or WLST to redeploy the application :
http://edocs.bea.com/wls/docs100/deployment/autodeploy.html
This would be slightly more similar to your Tomcat deployment, but requires a few more steps.

Similar Messages

  • Move env-entry from web.xml into deployment plan

    I have:
    <env-entry>
    <env-entry-name>USERNAME</env-entry-name>
    <env-entry-value>someUser</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
    and I'd like to move it from web.xml into my_app_plan.dat. Is it possible? How?
    Thank you in advance!

    Let me describe my case in few more words...
    I have some kind of client-server app. Clients have OC4J installed and they download myApp.ear and myApp_plan.dat files and by using script (Windows CMD batch file) clients install those files with admin_client.jar, OC4J's admin utility. The problem is that I have 2 different types of clients and I have client specific settings set in web.xml file and each time I compile myApp.ear I have to uncomment/comment some lines in web.xml.
    So, to make a long story short, I need a way to deploy those settings separated from (outside of) myApp.ear. By following you link, I have read that orion-web.xml should reside inside WEB-INF folder of myApp.ear, which is not good for me.

  • Exception while loading properties from an xml file

    Hi all,
    I've got a problem while loading properties from an XML file:
    java.lang.ClassCastException: org.apache.xerces.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
    ERROR - Cannot load properties from the specified file <./conf/login.prop> java.lang.ClassCastException: org.apache.xerces.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
         at java.util.XMLUtils.importProperties(XMLUtils.java:97)
         at java.util.XMLUtils.load(XMLUtils.java:69)
         at java.util.Properties.loadFromXML(Properties.java:852)
         at g2.utility.HRPMProperties.<init>(HRPMProperties.java:78)
         at g2.utility.HRPMProperties.getInstance(HRPMProperties.java:94)
         at g2.gui.workers.ApplicationSwingWorker.<init>(ApplicationSwingWorker.java:36)
         at g2.main.Main.main(Main.java:37)but this code worked before, and I've got the xerces and xercesImpl packages in the classpath, anyone can give me an hint on how to fix the problem?

    Here there's the code that instantiates the HRPMProperties object loading the property file:
    public class HRPMProperties extends Properties {
         * A reference to myself.
        protected static HRPMProperties mySelf = null;
         * The property file to which load the configuration.
        protected static String propertyFile = "./conf/login.prop";
          * A set of static strings used as keys in the properties file.
         public final static String DATABASE_URL = "database_url";
         public final static String DATABASE_USERNAME = "database_username";
         public final static String DATABASE_PASSWORD = "database_password";
         public final static String REAL_USERNAME = "real_username";
         public final static String REAL_PASSWORD = "real_password";
         public final static String PHANTOM_LOGIN = "login_thru_phantom_user";
         public final static String AUTOCONNECT = "autoconnect";
         public final static String TRANSLATION_FILE = "translation_file";
         * Builds up an empty properties map.
        protected HRPMProperties(){
         super();
         this.reload();
         * Builds up the property map from the specified input file. <B> The file must be in XML format</B>.
         * In case of exception and/or problems reading from the specified file, an empty property map is returned.
         * @param fileName the path and the name of the file with the XML representation of the properties.
        protected HRPMProperties(String fileName){
         super();
         try{
             this.loadFromXML(new FileInputStream(fileName));        
         }catch(Exception e){
             Logger.error("Cannot load properties from the specified file <"+fileName+"> " + e);
             e.printStackTrace();
         * Provides an instance of the property class loaded from the default configuration file.
         * @return the property instance
        public static final HRPMProperties getInstance(){
         if( HRPMProperties.mySelf != null )
             return HRPMProperties.mySelf;
         else{
             HRPMProperties.mySelf = new HRPMProperties(HRPMProperties.propertyFile);
             return HRPMProperties.mySelf;
    }The constructor is the one triggering the exception, so there's a problem loading the XML property file.

  • APIs  for Retrieving properties from portalapp.xml

    Hi all,
    Can anyone tell me Is there any Java/Portal APIs for retrieving properties from portalapp.xml as well as from manifest.mf.
    Help wud be highly appreciated.
    Regards,
    Karthick

    Hi Karthick,
    If you want to access the manifest file, you could do something like this:
    import java.io.File;
    import java.io.FileInputStream;
    import java.util.jar.Manifest;
    import com.sapportals.portal.prt.runtime.IPortalRuntimeResources;
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    File privateResoucePath = PortalRuntime.getRuntimeResources().getLocation(IPortalRuntimeResources.LT_PRIVATE_RESOURCES);
    File parPath = new File ( privateResoucePath, "HelloWorldProject" );  // name - par file name without the ".par" extension);       
    if ( parPath.exists()!=false ) {
        try {
            File manifestPath = new File ( parPath, "META-INF" );
            FileInputStream fis = null;
            fis = new FileInputStream(new File(manifestPath, "MANIFEST.MF"));
            Manifest mf = new Manifest(fis);
            java.util.jar.Attributes attr =  mf.getMainAttributes();
            if (attr!=null) {
                return attr.getValue("Specification-Title");
            else {return null;}
        } catch (Exception e) {
            e.printStackTrace();
            return "ERROR"+e.toString();
    META-INF is top level folder.
    Hope this helps.
    Daniel

  • Env-entry from web.xml not in generated plan.xml

    Hello,
    Recently I migrated a JDeveloper 10.1.3.4 project to 11.1.1.3 and from there to 11.1.2.4. When I deploy this project to an 10.3.5. weblogic server then the 'env-entry' entires in the web.xml are not available on the application server.
    Even when i use weblogic.PlanGenerator with the -all option to create a plan.xml from the WAR-file the env-enties are not found.
    The web.xml is like this:
    <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">
    <listener>
    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
    </listener>
    <servlet>
    <servlet-name>jaxrpc</servlet-name>
    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>VersionServlet</servlet-name>
    <servlet-class>nl.deltalloyd.alfa.keten.version.VersionServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>VersionServlet</servlet-name>
    <url-pattern>/version</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>jaxrpc</servlet-name>
    <url-pattern>/RelatieSoapHttpPort</url-pattern>
    </servlet-mapping>
    <jsp-config/>
    <security-role>
    <role-name>Administrators</role-name>
    </security-role>
    <resource-ref>
    <res-ref-name>jdbc/AlfaDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <env-entry>
    <env-entry-name>appl/version</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>2013.06</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>appl/releasedate</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>13-06-2013</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>appl/loglevel</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>INFO</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>appl/omgeving</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
    <env-entry>
    <env-entry-name>service/case</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>http://test.services.intranet.company.nl/GixoCaseWeb/services/CaseServiceHttp</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>mqueue/rc/host</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>nl001wwavm058.ad.intra</env-entry-value>
    </env-entry>
    <env-entry>
    <env-entry-name>mqueue/rc/port</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>1414</env-entry-value>
    </env-entry>
    </web-app>
    Maybe I missed something in the migration path. Can someone please help me.
    With kind regard,
    Martin

    Let me describe my case in few more words...
    I have some kind of client-server app. Clients have OC4J installed and they download myApp.ear and myApp_plan.dat files and by using script (Windows CMD batch file) clients install those files with admin_client.jar, OC4J's admin utility. The problem is that I have 2 different types of clients and I have client specific settings set in web.xml file and each time I compile myApp.ear I have to uncomment/comment some lines in web.xml.
    So, to make a long story short, I need a way to deploy those settings separated from (outside of) myApp.ear. By following you link, I have read that orion-web.xml should reside inside WEB-INF folder of myApp.ear, which is not good for me.

  • Need help to set values from web.xml in a jsp class

    Hey :-)
    I`m trying to get value from my web.xml file into a jsp class. The problem is that the value always retur null. My web.xml file is replaced in the WEB-INF directory where should be. Here is my web.xml
    <servlet>
    <servlet-name>Html</servlet-name>
    <servlet-class>Html</servlet-class>
    <init-param>
    <param-name>html_test</param-name>
    <param-value>Value I want have in my jsp class
    </param-value>
    </init-param>
    </servlet>
    And her i my java class who don`t work:
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import javax.servlet.ServletConfig;
    public class Html extends BodyTagSupport
    String title="";
    String html_test;
    ServletConfig config;
    public void doInitBody() throws JspException
    html_test = config.getInitParameter("html_test");
    }//End of method doInitBody()
    public int doStartTag() throws JspException
    try
    JspWriter out = pageContext.getOut();
    out.print( "<HTML>\n" );
    out.print( "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" );
    out.print( "<BODY>\n" );
    out.print( "<BR><H1>" + html_test + "</H1>" );
    And here are my html_test variable return null.
    I hope somone can help me, duke dollars will be given away for the solution answer.
    paulsep

    Nothing seems to work, have change the string and rewritten the web.xml file to:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
              <context-param>
                   <param-name>html_test</param-name>
                   <param-value>Value I want have in my jsp class</param-value>
              </context-param>
    </web-app>

  • How to initialized a variable in java file by taking the value from web.xml

    suppose i declare parameter in web.xml file
    i want to access if from a java file .
    how can i do this . plz help me its urgent...............

    In your Servlet class you can use the getInitParameter("configfile") method.

  • How to get parms from web.xml?

    Hello,
    I want to store some config parms in web.xml and read them from within JSP.
    What is the syntax for the web.xml and the code needed in JSP to read it?
    Thanks
    Frank

    Global parameters:
    <context-param>
        <param-name>myParam</param-name>
        <param-value>1</param-value>
      </context-param>
    //Accessing in a servlet
    getServletContext().getInitParameter("myParam");
    // in a JSP
    <%
    application.getInitParameter("myParam");
    %>
    // using JSTL
    ${initParam.myParam}

  • Getting Email Value from web.xml and displaying in JSF

    HI,
    I have a web.xml with the entry:
    <env-entry>
            <description>The email address for the Support Team.</description>
            <env-entry-name>support</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>[email protected]</env-entry-value>
    </env-entry>I want to display on the JSF the value *"[email protected]"*. I dont want to Hard Code the Email Id on the JSF hence I am looking for this solution.
    One way would be to get the value of the email in a backing bean and then setting a managedBeanValue which will be accessed in the JSF Display page.
    My question is how do I get the email value in my backing bean ?
    Thanks in advance !!!

    I tried using this code:
        FacesContext context = FacesContext.getCurrentInstance();
        ServletContext servletContext = (ServletContext)context.getExternalContext().getContext();
        String value = (String)(servletContext.getAttribute("support");But when I do a System Out on value I get null
    Please Help.
    Thanks in advance

  • What is the simplest way to get video from mini DV tapes into computer

    My computer has no firewire connection. What is the simplest way to get the video from my camera (JVC GR-D340EK) ?

    Mikeathome
    Thanks for the reply.
    The reason that I asked if this was a one time thing or not was related to my thoughts about asking you to look at the relative costs of have the DV data capture firewire done professional or by a friend versus going through looking for slots on your computer for a firewire card or purchasing a computer that still comes with a firewire port.
    We will be watching for further developments.
    Thanks.
    ATR

  • Is there any way to call 'Action' in web.xml ?

    Dear All,
    My requirement is like, in my Deployement descriptior (web.xml) I would like to call "action" instead of calling welcome page(*.jsp).
    Iam using JBOSS with Jetty5.0 Servlet Container.Is there any way to call action in my deployment descriptor?
    Thanx in advance

    You can, but you have change your server configuration file. I am using Sun App server where we have a default-web.xml file in the config directory where it specifies which default file will be loaded, instead of calling the welcome.jsp. In Sun App server there is a parameter called <welcome-file-list> where you can specifiy which one to be loaded. I strongly believe there must be something like that in JBoss. Check out all the xml files in the JBoss config directory where you can find a solution to it.

  • Access parameter from web.xml

    <servlet>
    <servlet-name>serverText</servlet-name>
    <servlet-class>abc</servlet-class>
    <init-param>
    <param-name>serverParam</param-name>
    <param-value>parameter</param-value>
    </init-param>
    </servlet>
    Hi, above is what i defined in my web.xml.
    i want to know how to get the serverParam from my jsp file.
    i tried to use String param = pageContext.getServletConfig().getInitParameter("serverParam");
    but i got null.
    please help me.
    thanks

    hi,
    well all jsps are compiled to servlets before running anyway, well if you using a jsp you can still do the
    String param = getInitParameter("serverParam");
    you could do this in the jspInit method
    public void jspInit()
    String param = config.getInitParameter("serverParam");
    // config is the implicit ServletConfig object
    The getInitParameter method is actually defined in the javax.servlet.ServletConfig class, the ServetConfig object is available as an implicit object by name config in a jsp page with page-level scope). well hope this was useful.
    Cheerz

  • Edit env-entry values from web.xml in the WLS console.

    Hi guys!
    Is it possible to define JNDI variables of type java.lang.String using WLS Console?
    Thanks

    I think this would require the use of a deployment plan, which you can learn about here: [http://e-docs.bea.com/wls/docs103/deployment/config.html] . This won't be as convenient as just editing the value directly in the admin console. In fact, it won't even prevent the requirement of redeploying the webapp. It will only allow you to make the change without rebuilding and repackaging the webapp.
    It's questionable whether it's practical or meaningful to change env-entry values in a web.xml without redeployment, because even if you could change the values without redeploying, you'd have to reinitialize the servlet/filter with the changed environment parameter.
    If you really need this dynamic reconfiguration ability, you might have to design the facility into your application, using some sort of polling or event handling capability.

  • How to access properties from portallapp.xml in jsp file

    <b>portalapp.xml</b>
    <property name="SupportUrl" value="http://sapdp1ci.zrh.swissre.com:53000/irj/portal?navigationtarget=navurl://8f7e974723098424468c8ae903228c0e">
              <property name="personalization" value="dialog"/>
              <property name="plainDescription" value="Support Desk Link URL"/>
              <property name="category" value="Navigation"/>
            </property>
    <b>jsp code</b>
    private String getSupportUrl(IPortalComponentRequest request)
         IPortalComponentContext myContext = request.getComponentContext();
         IPortalComponentProfile profile = myContext.getProfile();
         String supportDeskLocation = profile.getProperty("SupportUrl");
         //String supportDeskLocation = (String)request.getNode().getValue(SUPPORT_URL);
         return supportDeskLocation;
    but supportDeskLocation is coming as null.
    Please help me in solving the issue.
    Points will be awarded
    thanks
    bala

    Hi Michal,
    How are you?
    I´m trying to access a property from portalapp.xml and I have in the right place according to your post and here is my code to retrieve it:
    String value = (String)request.getNode().getValue("MyLogoffUrl");
    Did you activated something or did something else so your property could be reached by the JSP?
    It is just returning null in my case.
    Thanx in Advanced!
    Kind Regards,
    Gerardo j

  • Is there any way to generate pdf from an xml file using single java class

    i m working on generating a pdf file from an xml file. i want to use only a single java class to do so. if theres any such code available please help me to find out.
    Thanks
    Gurpreet Singh

    exactly,
    here are some libraries which are open sources;
    http://java-source.net/open-source/pdf-libraries hope it's useful. :D

Maybe you are looking for

  • How to config the digital write-to-line so it would independent when more than one is being used

    when one digital wirte-to-line is used in the labview vi, a good logic high(5v) can be read using a voltmeter,but when two or more digital write-to-lines are being using at the same time,the logic high seemed to have split voltages and thus having a

  • How to export a flash project to iPhone

    Hi - I'm trying to find a way to publish an interactive flash project to an iPhone using flash CS6. I'm been using Flash for years, but never published a project for a mobile device. I can design the project using the mobile templates, but my main co

  • HRMD_A05 idoc issue

    hi i am wokring to insert the new records in infotype 0008,while delimiting the previous records,according to the diff years. i hav econfigured the HRMD_A05 idoc & whcn I process it,its shows me success mesg,but when i chek the enty in PA30,for the p

  • Want the load date/time show in a web template

    hi! Is there an easy way getting the date and time when data was last updated in a cube, and showing this in Web template?

  • Does spotlight display in date order?

    So when spotlight displays deleted text messages, are these in any particular order?