简体   繁体   中英

IBM websphere application server is giving me a null value from getinitparameter() and I cant figure out why

I have been tasked at work with fixing some other teams deployment into IBM Websphere

They use javax servletcontext to get values out of web.xml

I have read so many articles

sc is ServletContext passed in as a parameter

( I'm new to IBM websphere )

     Enumeration<String> testParam = sc.getInitParameterNames();

    while(testParam.hasMoreElements()) {


        String value = testParam.nextElement();
        sc.getInitParameter(value);
        
        
    }

but I can do anything to web.xml and it sees no changes

I have tried adding

 <Context-param>

and i have tried adding

 <init-param>

and then searching by that param name directly which returns a null

also I have queried all the params using the pasted code example and it shows none of my test params

yet also it has found a param by the name of "WELD_CONTEXT_ID_KEY" which translates to the value of the war but I used

Findstr /s /i "WELD_CONTEXT_ID_KEY" .

at the server root and that string only exists in the log from the code I created

I Have no idea what to do because I cant seem to affect change and I cant find that param name

PLEASE HELP***

For the benefit of anyone who comes across this problem in the future

I learned that the solution is to fix the web_merged.xml inside a different folder

as it turns out Websphere takes the war and creates multiple iterations it looks like

leaving web.xml inside

[server name 1]\profiles[server name]\config\cells[cell name]\applications[\deployments\[application war]\[application war]\WEB-INF\

there you can find web_merged.xml web.xml

and then you can find a copy of web.xml inside

[server name 1]\profiles[server name 1]\installedApps[cell name][application war][application war]\WEB-INF\

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM