开发者

Can I place server variable in my application.xml file,to create one ear file for all environments?

开发者 https://www.devze.com 2023-02-10 06:02 出处:网络
Earlier, I used to create 4 ear files based on various environment(QA,Dev,Prod,Etc) but now my requirement is such that I need to have only one ear file for all the environment.I have configured my co

Earlier, I used to create 4 ear files based on various environment(QA,Dev,Prod,Etc) but now my requirement is such that I need to have only one ear file for all the environment.I have configured my context-root in websphere server,by setting WebSphere Environment variable.But when I am acessing my application I am getting FileNotFoundException.I have even tried to set a variable in variable.xml file,but still I am getting the same exception.I want to know how I can overcome this problem.

My application.xml file EARLER was as follows :(The value of tag changes with the environment for QA projQA)

<?xml version="1.0" encoding="UTF-8"?>   
<application id="Application_ID" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">   
    <display-name>proj_2_1_DEV_001</display-name>   
    <module id="WebModule_1249062768099">   
        <web>   
            <web-uri>proj_2_1_DEV_001.war</web-uri>   
            <context-root>projDev<context-root>   
        </web>   
    </module>   
</application>  

After configuring Environment variable in websphere server with name ctx_path and value as projDev(for dev):: 

&开发者_开发技巧lt;?xml version="1.0" encoding="UTF-8"?>   
<application id="Application_ID" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">   
    <display-name>proj_2_1_DEV_001</display-name>   
    <module id="WebModule_1249062768099">   
        <web>   
            <web-uri>proj_2_1_DEV_001.war</web-uri>   
            <context-root>[b]${ctx_path}</[/b]context-root>   
        </web>   
    </module>   
</application>  


This is usually addressed by AppOverrides; Check out this example.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号