Can I Use WAR With Java EE 6 Full Profile?

Java EE 6 brings a lot new features. Among the others there is the concept of profiles. Java EE starts with the definition of two: Full and Web Profile.

The idea is to create separate and more specialized set of services that better suits your job. E.g. if you only want to use Servlets, JSP and add some EJB’s – do you really need full-blown application server with JMS, JMX, CORBA, JAX-WS and a lot of other abbreviations?

If not, then perhaps the Web Profile is enough for you. If you need those additional services like remote EJB, JAX-RS (this one is a bit awkward and it’s possible it’ll be moved to the Web Profile in EE 7), Timers, etc. – then you probably should go with the Full Profile.

The point is – you have the choice. Moreover, the application server vendors can create their software to support only the particular profile – it’s supposed to lower the barrier for introducing new application severs to the market.

So, if we have Full and Web Profile, we should now be able to deploy our applications using not only EAR (Enterprise Archive) as in pre Java EE 6 days but we should also be able to use WAR (Web Archive). And in fact it is possible – you can deploy your Java EE 6 application using WAR.

Now, you might think that because the WAR is for Web Archives, it’s mainly for the Web Profile. At the same time EAR is for Enterprise Application Archive, so for Full Profile.

And there is nothing wrong with this thinking – it’s intuitive and it’s right.

However, it’s worth realizing that the EAR and WAR are just a matter of packaging. It’s not the definition of what profile am I using. In other words, e.g. I can use all Full Java EE Profile services with the WAR packaging format. You can deploy your application that uses Timers, Remote EJBs and others, wrap it in the WAR and deploy it – and that’s perfectly fine.

The bottom line is: the Web and Full Profile are for definition of what services need to be provided; the packaging of your application doesn’t declare what services you’ll be using.