Friday, 6 February 2009

Configuring separate dev-test-prod URLs for your ADF Faces RC application

I was asked the other day how to go about having different context-root URL paths for different deployments of a single JDeveloper 11g ADF Faces RC application, such that we have:

http://www.sagecomputing.com.au/bookingsDev
http://www.sagecomputing.com.au/bookingsTest
http://www.sagecomputing.com.au/bookings

While it would be fairly unusual to have all 3 environments on the same box (well, at least not recommended), in the case of a development and test environment it's quite common to have them on the same box separate from production. As such when developers and testers logon to the combo dev-test box, it's helpful to have different URLs to assist the developers and testers understand which environment they're working on.

As readers will be aware you configure the context-root URL for your application via the default WAR deployment profile for your ViewController project. The profile can be accessed by selecting your ViewController project in the Application Navigator, from the right mouse menu selecting Project Properties, then the Deployment tab:



Selecting the Edit button reveals:



From here you can select the "Specify Java EE Web Context Root" and enter a custom root of your choosing such as:



Note how we've also chaned the Enterprise Application Name. This is necessary to uniquely identify the 3 different deployment profiles if all are deployed to the same application server.

In order to provide 3 separate context roots, simply return to the Project Properties screen and create 2 additional WAR deployment profiles by selecting the New button. This will present the Create Deployment Profile dialog where you can configure another WAR with a unique name:



From there you modify each WAR deployment profile such that you have unique context roots for each, and you'll end up with something like this under the deployment profile in the Project Properties:



(Okay, I admit it, my deployment profile names are uninspired, but it's been a loooooooong week)

From here the preferred way to deploy Fusion Apps in JDev 11g is to select the default EAR deploy option from the Application Navigator's Application Menu:



However this is configured to use the original ViewConroller WAR deployment profile. What we really want is 3 EAR deployment profiles at the Application level.

To view the EAR deployment profiles we select the Application Properties option from the Application Menu above, then the Deployments node:



As you can see we have a default EAR deployment profile. If we select the Edit button and select the Application Assembly node we can see that the EAR deployment profile is configured to use the original WAR deployment profile:



As you can guess all we need to do now is create 2 additional separate EAR deployment profiles that use the different ViewController WAR deployment profiles.

Once we've done this and then select the Application Menu's deploy option we'll see all three EAR deployment profiles available to deploy to our application server:



And once deployed to your application server each separate EAR deployment will use a different URL to access the dev, test and prod applications.

3 comments:

John Stegeman said...

Hi Chris,

Thanks for documenting this procedure - a question for you - assuming you're using different database schemas for each of the 3 environments, have you done anything to deal with changing the Application Module configuration to point to the different environments as well? We've done something like this with ANT, but I'm curious if you've discovered anything to do this natively in 11g?

John

Chris Muir said...

Hi John

Good question and that question is in fact what prompted me to post this post. I haven't yet figured your question out, but the answer doesn't seem to be in the deployment profile settings as far as I can see.

CM.

Simon Haslam said...

Hi John/Chris

I would normally do this kind of thing from the app server end using different deployment plans - then you can have different context roots and JDBC connection pools for each environment (and lots more stuff if necessary). Then the dev team supplies an EAR file and the middleware admin deploys it to the appropriate environment.

Simon