Harmonic Carbon Api Manual For Xml Sql

 
Harmonic Carbon Api Manual For Xml Sql 3,7/5 6187 votes

I am wondering how people manage maintaining JNDI resources across multiple instances of their Tomcat Application server. Lets take, for example, my database JNDI resource.

  1. Api
  2. Harmonic Carbon Api Manual For Xml Sql Tutorial
  3. Harmonic Carbon Api Manual For Xml Sql Tutorial

Api

It is declared within my /conf/context.xml file and references from my apps web.xml file.That JNDI resource has to be independently defined on my development box, staging box, and production box. What if I want to set up a new instance of a developer/staging/production box? That means I have to recreate the resource name inside the context.xml for each new instance I bring up? From a setup perspective this is a place where there could be some human error that could cause a app server to start pointing to the wrong DB.I am finding this to be cumbersome and confusing as I scale up both the number of developers on my project as well as eventually the number of production servers I might use.Do you just make it part of your setup or create a setup script that deals with this for you every time you re-install tomcat and setup a box? Or is there some other level of indirection that could make this easier? I'm assuming that for a given resource, you using the same JNDI name in each environment. Otherwise you'd have to edit your code to point to the new resource(JNDI) name.Setting up the environment the first time can be almost impossible to test ahead of time.

Harmonic Carbon Api Manual For Xml Sql Tutorial

Harmonic carbon api manual for xml sql free

There is no way to verify that some string, like the production database connection string, didn't get fat-fingered until you actually have to use it. It's the nature of environment configuration. With that said, if you want to reduce the likely-hood of mistakes, first you need to make sure that each resource is given a name that is used regardless on which environment it is hosted. Create a dbConnectionString resource name in a properties file that points to jndi:/jdbc/myproject/resources/dbConnectionString and make sure all environments declare that same resource. Below is how we kept the code isolated from these types of environmental dependencies.

Harmonic carbon api manual for xml sql tutorial

Harmonic Carbon Api Manual For Xml Sql Tutorial

That being said, you will always have to manually verify that the configuration of a specific server is using the appropriate values for the defined resources.NOTE: never create resource names like ' dbProdConnectionString', ' dbQAConnectionString', ' dbDevConnectionString'. You will be defeating the purpose of trying to eliminate manual intervention because then you've added an indirection step that will need a code change (to point the code to the correct resource name) and build (to package the changes into your.war file) when moving between environments.What we did was create a folder structure for the properties that were environment specific. Under that folder we created folders for each specific environment targeted for deployment, including local development. It looked like this: Project-Properties-Local (your PC)-Dev (shared dev server)-Test (pre-production)-Prod (Production)In each folder we put parallel copies of the properties/config files and put the different configurations only in the file in the appropriate folder.

The secret was to control the classpath of the deployment environment. We defined a PROPERTIES classpath entry on every server. On Prod, it would be set to '$ProjectDir/Properties/Prod' while on Test the same variable would be set to '$ProjectDir/Properties/Test'.This way we could have database connection strings for the dev/test/prod database preconfigured and not have to checkout/in the property file each time we wanted to build for a different environment.This also meant that we could deploy the exact same.war/.ear file to Test and Prod without rebuilding. Any properties that weren't declared in the properties file we handled in a similar way by using the same JNDI name in each environment but using values that were specific to that environment. Are you deploying multiple web applications that must use shared resources?If not, there's absolutely NO reason to declare your resources in /conf/context.xml. They should instead be declared in a separate, private to your web application context.xml file that will be deployed as /META-INF/context.xml inside your WAR. That file, along with your web.xml should be checked into your source control system and be deployed as part of your build - no manual intervention whatsoever.If you are deploying multiple web apps with shared resources you can either write a custom resource factory that would expose the same resource to multiple webapps (see, at the bottom of the page) and use the above approach or - for development environment at least - you can automatically change (or even replace as default does nothing) /conf/context.xml as part of your build.

Harmonic carbon api manual for xml sql server

For production deployment that's not advisable, of course. @Maurice - you are absolutely correct about resources being properties of the environment. However, I don't agree that the same WAR has to be deployed on dev box, qa and production - decision to include / exclude context.xml in WAR file canbe triggered by build property, for example. The original question was 'how to automate this for multiple developers' - doing it in context.xml is extremely straightforward. Should you 'automate' multiple production / staging deployments the same way? Of course not.–Jul 21 '09 at 17:59. The point of JNDI is to have environment specific resources defined independently.

Your development, staging and production environments should not be sharing the same database (or at any rate, JNDI was designed to allow separate databases for each environment).If on the other hand you're trying to load balance multiple Tomcat servers, and you want all instances to share the same configuration, I'd think you could always split up your context.xml and have the common bits in a shared file. Here's the.How you manage these is up to you. It can be simple, like having a 'template' context.xml files that you start with each time you create a new Tomcat instance (having these in a source control system, especially a distributed one, can be helpful). Or you could write a script to do this.If you want more, I believe there are products out there that puts a nice UI around the whole process. One that I believe does this is.

BirdEye drives business growth by getting new reviews and improving customer experience. More than 50,000 businesses use BirdEye to manage their reviews, be found online, collect customer feedback, interact with potential customers, ask customers to refer friends and family, improve operations and increase revenue.BirdEye’s all-in-one software includes review monitoring, review generation, review marketing, customer surveys, social listening, social publishing, social engagement, customer support ticketing, listings, webchat, customer referrals, business insights, and competitive benchmarking.