I followed some tutorials on EJB 3.1 and those were using the following dependency for EJB-API.
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<version>1.0.2.Final</version>
</dependency>
My problem is, this is only for jboss or can I used this in any other application servers. If not why there are dependency like these which are not independent from the application server it gets deployed. And also I found this reference for ejb 3.1 api. Therefore please elaborate what are these and why those are there.
You can use it on any server you like. Just remember to put add the <scope>provided</scope>
tag to the dependency like this:
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<version>1.0.2.Final</version>
<scope>provided</scope>
</dependency>
The provided
scope means that this dependency is only used to compile your code and not included in the resulting EAR/WAR/JAR. In the runtime this dependency is provided by your application server (JBoss, Websphere, whatever). If you omit the scope specification section very bad things may happen.