4

I have a question similar to Application Deployment Descriptor in Java EE 6 where the answerer explains that if you want to use custom (non-default) context-root, one must define the application.xml which should contain all the information for the project.

If I have an EJB, is there any such specific condition/situation for an EJB, where I must define an application.xml?

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
adbdkb
  • 1,897
  • 6
  • 37
  • 66
  • Last time I checked, application.xml was meant to be defined for EAR projects. For an EJB module you'd have to define an ejb-jar.xml, but as of EJB 3.0 this file is not even mandatory anymore. – Henrique Ordine May 31 '13 at 06:48
  • @Henrique Ordine - Thank you. I realise application.xml is for EAR. The question really is, when using JavaEE 5.0 or later, are there any conditions where I MUST define an application.xml for ejb. The example in link above is - you MUST define the application.xml if your context root is going to be different from your web project name, otherwise it can be omitted – adbdkb Jun 01 '13 at 11:36

2 Answers2

2

The application.xml is not required, and I cannot think of a situation where you would be forced to do it because of an EJB.

ZeusSelerim
  • 935
  • 8
  • 12
  • As mentioned above, I know application.xml is not required as of JavaEE 5.0 or later. But is there a situation for EJB ( as there is for web ) project, where it MUST be defined for the application to work correctly after deployment. – adbdkb Jun 01 '13 at 11:39
  • 1
    @adbdkb I can't think of any situation for an EJB, but it's often a must for war modules, where you want to specify a context path. – ymajoros Sep 05 '17 at 06:20
0

The previous answer is correct, only a few additions:

  • In general, the deployment descriptor gives you the possibility to overwrite settings done by component defaults or annotations.
  • In Java EE there is for most use cases no need to create an EAR deployment, since EJBs can also resist in the WAR.
  • Thus, application.xml is optional, so as per se there is no situation where you must have it, but there are those were you may want to have it. Also checkout Pascal's cite.
Community
  • 1
  • 1
Alexander Rühl
  • 6,769
  • 9
  • 53
  • 96
  • 1
    An ear deployment allows you to have multiple web modules that share libs and ejb modules. If you package everything in a war, all war deployments have their own copy of everything, their own persistence (and related caches), etc. A lot of times, I'm using ear deployments rather than war. – ymajoros Sep 05 '17 at 06:18