3 Replies Latest reply on Oct 28, 2006 1:36 AM by Xiang Qinxian

    Best way to deply an XML file with an ear?

    Frank LaRosa Newbie

      Hi,

      I'm looking for some advice as to the best way to deploy XML files with EARs.

      In the past, I have deployed XML files in the WEB-INF directory of Web applications. This allows me to read the XML from servlets by using the servletContext.getRealPath() method to determine the path to the document root.

      This works OK for servlets but it doesn't work for EJBs, since an EJB has no servletContext. When I need an EJB method to read an XML file I've been resorting to passing it the real path as a parameter, but this is getting tedious.

      I've considered using ejb-jar.xml to specify the path of the XML file as a env-entry, but I deploy my application on several different machines with different directory structures, so this would be difficult to manage.

      I'm sure there are better ways to solve this problem - any recommendations? Is there a way an EJB can get the path to the root of the EAR deployment?

      Thanks.