views:

370

answers:

1

I basically want to be able to deploy multiple versions of the same EAR file to the same server (Glassfish instance?) , and have a unique path to each version separating them.

From my reading on this it appears that multiple EARs deploy to the root of the web server namespace so that they can coexist if they do not have colliding context-root's of WAR's.

In my case I'd rather have that instead of everything going under "/", I'd like to be able to brand a given EAR-file build to ALWAYS deploy under a given path like "/foo-20100319" or "/foo-CUSTOMER-20010101". This can easily be done with a single WAR file just by renaming it. I do not need or want them to disturb each other.

It is my understanding that this remapping is outside the scope of the application.xml file, so I found that http://docs.sun.com/app/docs/doc/820-7693/beayr?a=view says that I can specify web-uri and context-root, but I am not certain that what I wish to do, can be specified with these in Glassfish.

How should I approach this? I have full control over the build process.

(I have found http://stackoverflow.com/questions/877390/deploying-multiple-java-web-apps-to-glassfish-in-one-go but I am not certain how to apply this to what I need).

+1  A: 

The application.xml allows you to map a web app that is enclosed in an ear to the context root of your choice. You can also do this with the sun-application.xml.

Since you have full control over the build process, the choice is yours.

You may want to read about the --deploymentplan option of the deploy subcommand of GlassFish's asadmin utility. It allows you to mix additional files into the deployed archive before deployment processing... So, you can create a single 'generic' ear file and a number of shorter deploymentplan files, that 'mix-in' the sun-application.xml file necessary to create a customized deployment.

vkraemer
Ah, so instead of telling Glassfish to transparently add a new root like /foo-1235 for the webapp, you suggest I simply just tell it in the deployment descriptors that all web applications have a /foo-1235/foo path instead. I'll try.
Thorbjørn Ravn Andersen
There is no way to tell Glassfish to add a contextroot for an ear or webapp embedded into an ear other than the deployment descriptor. I opened an enhancement that might capture your idea. Please evaluate it and clarify it if I misunderstood your intent: https://glassfish.dev.java.net/issues/show_bug.cgi?id=11710
vkraemer