wood burning stoves 2.0*
The moose likes Websphere and the fly likes Can I place server variable in my application.xml file,to create one ear file for all environments? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Can I place server variable in my application.xml file,to create one ear file for all environments?" Watch "Can I place server variable in my application.xml file,to create one ear file for all environments?" New topic
Author

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

mudassir syed
Greenhorn

Joined: Jan 18, 2011
Posts: 8
Hi

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,the value of <context-root> tag changes with the environment for QA projQA.


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

Joined: Feb 13, 2004
Posts: 443
I don't think it is possible. I would be interested in knowing the answer as well.

Why would you keep different context root for different environment? I am sure you already have different IP/Port for diff environment.

Generally I use ant to replace the environment name is such deployment descriptor files using <REPLACE> task before making the file(s).
mudassir syed
Greenhorn

Joined: Jan 18, 2011
Posts: 8
Thanks Deepak for the reply.Actually the user would key-in different URL based on the environment.
A typical URL would look like this :


For QA it would be projQA.

The thing is we are only changing the

of application.xml file for creating 4 ear files,for 4 different environment.Now our requirement is to create only one ear file which can be accessed by all the environment.

Actually I am new to websphere,any help would be greatly appreciated.I want to know is there any other way to achieve this?

I am sure you already have different IP/Port for diff environment.


I think for uniformity/simplicity they'll go with same port(9080) for all the environment.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
So if I am getting this correctly, both your dev and qa will be hosted by the same JVM (or java) process. As the only thing different is the context root. Typically the IP address/port number of the machine hosting the application is different.
mudassir syed
Greenhorn

Joined: Jan 18, 2011
Posts: 8
Dev and QA maybe or may not be running in the same JVM.I want to know if we can use the same ear file for both the environment but with different URL.Like,is there a way wherein we can change the <context-root> in the websphere server.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
Yes you can change the context root of the web application after you have installed it. You go into the Console->Applications->Web Modules-> Look for session context. Change it and probably you need to re-start the app server process.

This will need to be done every time you install the new version of the application ear file. You can try to automate this whole process by scripting this as a Jython script, which will execute after you have installed the application ear file.
Mickey Mouse
Greenhorn

Joined: Feb 17, 2011
Posts: 1
hello

you can simply install the application by command line, AdminApp.install command is here for that and precise the -contextroot option with whatever you want.

Regards
mudassir syed
Greenhorn

Joined: Jan 18, 2011
Posts: 8
Still, I am unable to solve my problem as,I am unable to acess my application if I change the context-root ,while installing the ear file using the admin console.I want to know if the value in the <context-root> of application.xml file will be overridden by the context-root we specify while installing the ear file.


Here's my application.xml file:


I have tried with various combination for <context-root> like "/","anyName",etc.

when I install this ear file I have specified the path of this ear file and in the context-root text box, I have given /DEV.But when I tried to access the application using DEV as the context root I am getting this exception.



 
Don't get me started about those stupid light bulbs.
 
subject: Can I place server variable in my application.xml file,to create one ear file for all environments?