Image by UniqueOo Mania via FlickrAfter deploying a Java Enterprise Archive (EAR) file to a few different Glassfish instances, I found that the context root of an Enterprise Java Bean (EJB) in the application varied from server to server. It took awhile to determine how Netbeans and Glassfish set this part of the URL - although I still don't know why the (default?) paths varied.It turns out that when using an EAR file, it doesn't matter what you put in the WSDL, in web.xml, or in sun-web.xml. The context root is controled instead by application.xml. In Netbeans, right-click on the enterprise application (EA) project, and select new and “Standard Deployment Descriptor”. This will create an application.xml file, in the project, based on your current web.xml. This application.xml file can be edited to set the context root.
When using a WAR file, the context root is controled by the usual deployment descriptor, as one might expect. An easy why to set a WAR file's context root, after deployment, is through the Glassfish server administration console. Go to "Applications" and "WebApplications" (on the left side of the administration page), click on the name of your application and you’ll be able to change the "Context Root" option. Then click “Save”.
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=fdeabcf9-5bfa-46a1-a25d-255256170b55)
No comments:
Post a Comment