Search code examples
javajakarta-eejbossglassfishapplication-server

Java EE - who implement the specification?


I have some experience in core Java and Java EE. I read the various question on SO to understand what exactly Java EE is? And few answers in SO are: what-exactly-is-java-ee , what-is-java-ee

I have some doubts:

1) If Java EE is just a specification, who does implement them? Do Application Servers (like JBOSS, GlassFish) implement these specifications?

2) If I am correct the EJB specification is implemented by EJB container, and I believe EJB Container is part of Application Server. Now, when we as developers write an EJB code, what are we actually doing? The doubt I have is, EJB container implements the EJB specification, so are we overriding some "specification part" of the EJB? How come, some part of EJB is implemented by the EJB container and some thing which developers are writing? OR is it that some part of the EJB have to be provided by EJB container and some part to be developed by developers? I am having difficulty in undestanding this.

Please can anyone help in understanding this?


Solution

  • Anybody can implement the java ee specification (JSR342), or any jsr that's part of it. When they do, they can (after buying and passing Compatibility Test Suite) claim to be compatible with the specification. There is a number of vendors with their application servers which are compatible with java ee, but no vendor implement full java ee specification. For instance, glassfish (the java ee reference implementation) uses Red Hat's CDI implementation. Sometimes, the vendor does not implement any part of the java ee specification, they grab glassfish, add their vendor specific libraries, and release it under their name. To claim compatibility, they still need to go through the certification process and run CTS.

    To find out all the vendors who implement the specification is not so easy, since not all of them go through the certification process. For instance, Apache CXF is not certified on its own, rather it gets certified as part of Red Hat's JBoss.

    Each specification has an API and a written pdf, both of which define the mandatory behaviour of each implementation. That is what you use when write EJB code. For instance, when you create an ejb:

    import javax.ejb.Singleton;
    @Singleton
    public class MySingleton{
       ... 
    }
    

    @Singleton annotation is part of the specification, but MySingleton class is your EJB code, it's not part of the specification. The EJB container then knows what to do with the class.