7

If I want EJB 3.0 support and want to run Java 7, do I need Java EE or can I stick with SE?

In the past (many JDK versions ago), one needed the "J2EE" version of the JDK to run EJB. It would appear this is no longer true. Please advise.

UPDATE: I should have mentioned that the application will be running inside Oracle WebLogic 10.3.6.

BestPractices
  • 12,738
  • 29
  • 96
  • 140
  • You don't need an J2EE version of the SDK. There's no such thing. JEE is a specification and there are several vendors who implement it like GlassFish 3.x and JBoss 6/7. Note that Tomcat is just a servlet container, so you can't run EJBs inside it. – Luiggi Mendoza Oct 02 '12 at 18:52
  • Java EE version of the SDK: http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-jdk-7u1-downloads-523391.html – BestPractices Oct 03 '12 at 02:27
  • 1
    Read BalusC's comments in [Confusion about Java SE and Java EE](http://stackoverflow.com/q/12773152/1065197) to understand what this means. Also, Java SE is also a specification, there are several vendors who implements it, like [Oracle HotSpot](http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136373.html) and [OpenJDK](http://openjdk.java.net/). – Luiggi Mendoza Oct 07 '12 at 22:16

5 Answers5

5

No, this is unchanged. EJBs are part of Java EE, not Java SE. This will probably never change as the infrastructure support for EJB is huge (and will not likely be included in Java SE).

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
jtahlborn
  • 52,909
  • 5
  • 76
  • 118
5

EJB is part of Java EE. But if what you want is JPA, even though the API is included within Java EE (here's the API documentation) you don't need a Java EE application server for JPA anymore (unlike the situation with EJB entity beans). JPA can be used with Java SE.

If you're running this in Weblogic then you have access to Java EE, so I don't get the point of the question.

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
  • The question, while not explicitly stated, was for whether I get access to the EJB libraries with Java SE. Based on the answers, options are to use the Java EE SDK and/or use the libraries that come with the application server to gain the Java EE functionality such as EJBs. I've accepted your answer as it is the closet to the right answer. – BestPractices Oct 03 '12 at 02:30
  • @BestPractices: if you just want to compile something in a build you could put your weblogic jar in your repository or use glassfish's jars. – Nathan Hughes Oct 03 '12 at 11:51
  • >But if what you want is JPA, that's not part of Java EE anymore - This is not entirely true. JPA is still within the Java EE umbrella spec. What changed is that CMP (Entity Beans, not to be confused with Entities) were deprecated in favor of JPA. JPA started as a sub-spec of EJB, but was later moved to its own spec, but as mentioned still within Java EE. All of this doesn't mean however that JPA can't be used outside Java EE, in fact it has explicit support for Java SE. – Arjan Tijms Oct 07 '12 at 15:49
  • @Arjan: good clarification, the situation is pretty confusing. – Nathan Hughes Oct 08 '12 at 01:45
1

In order to run EJB, you need an EJB container (such as Glassfish), which is not included with Java SE 7.

Jordan Denison
  • 2,649
  • 14
  • 14
1

I think you are wrong. EJB is still part of Java EE specification only, not Java SE. If you look at Java SE API, there is no reference to EJB.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
kosa
  • 65,990
  • 13
  • 130
  • 167
1

You can use EJBs in non Java EE application server with EJB's 3.1 Lite container - http://docs.oracle.com/javaee/6/api/javax/ejb/embeddable/EJBContainer.html.
All Java EE 6 compliant application servers must be able to run in embedded mode.

This, however, is not a Java SE 7 feature (it worked fine in Java SE 6) but Java EE 6 API, so if you're stick with EJB 3.0 than you'd need to use application server or some implementor-specific features.

Piotr Nowicki
  • 17,914
  • 8
  • 63
  • 82