= JEE = Java Platform, Enterprise Edition == JEE 7 Tutorial == https://docs.oracle.com/javaee/7/tutorial/index.html Key features: https://blogs.oracle.com/arungupta/entry/java_ee_7_key_features Reference implementation: https://glassfish.java.net/getstarted.html Java EE7 APIs: https://docs.oracle.com/javaee/7/tutorial/overview007.htm === Install Glassfish 4.1 === https://glassfish.java.net/download.html JDK 8 u20 or above is recommended for GlassFish 4.1. * cd /tmp * wget http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz * wget http://dlc.sun.com.edgesuite.net/glassfish/4.1/release/glassfish-4.1.zip * unzip glassfish-4.1.zip * tar xvzf jdk-8u25-linux-x64.tar.gz * mv jdk1.8.0_25/ /usr/java * mv glassfish4/ /opt/appsrv/ * cd /usr/java/jdk1.8.0_25 * chmod 555 * -R * /usr/java/jdk1.8.0_25/bin/java -version * cd /opt/appsrv/glassfish4/bin * JAVA_HOME=/usr/java/jdk1.8.0_25 AS_JAVA=/usr/java/jdk1.8.0_25 asadmin start-domain * http://localhost:4848/ * asadmin change-admin-password * asadmin enable-secure-admin * asadmin stop-domain * asadmin start-domain == Docker Ubuntu image install == * docker pull ubuntu * docker create --name containerx -p 1022:22 -p 1848:4848 -p 1080:8080 ubuntu * docker start containerx * docker exec -t -i containerx * apt-get update * apt-get install tzdata-java openjdk-7-jdk wget unzip * java * java -version * apt-get install * cd /tmp * wget http://dlc.sun.com.edgesuite.net/glassfish/4.1/release/glassfish-4.1.zip * unzip glassfish-4.1.zip * mkdir -p /opt/appsrv * mv glassfish4/ /opt/appsrv/ * cd /opt/appsrv/glassfish4/ * bin/asadmin start-domain * bin/asadmin change-admin-password * bin/asadmin enable-secure-admin * bin/asadmin stop-domain * bin/asadmin start-domain * exit https://github.com/sebsto/docker-glassfish4/blob/master/Dockerfile == JEE6 EJB 3.1 sample for Glassfish 3.1.2.2 and JBoss 7.1.1 == '''Structure:''' {{{ . |-- pom.xml |-- src | `-- main | |-- java | | `-- org | | `-- allowed | | `-- bitarus | | |-- ScheduleRemote.java | | |-- ScheduleWS.java | | `-- Scheduler.java | `-- resources | `-- META-INF | `-- ejb-jar.xml }}} '''pom.xml''' {{{#!highlight xml 4.0.0 org.allowed.bitarus ejbjee6 0.0.1 ejb javax javaee-api 6.0 provided }}} '''ejb-jar.xml''' {{{#!highlight xml }}} '''Scheduler.java''' {{{#!highlight java package org.allowed.bitarus; import javax.ejb.Singleton; import javax.ejb.Schedule; import javax.ejb.ScheduleExpression; import javax.annotation.Resource; import javax.ejb.Timeout; import javax.ejb.TimerConfig; import javax.ejb.TimerService; import javax.ejb.Timer; import javax.annotation.PostConstruct; import javax.ejb.Startup; @Singleton @Startup public class Scheduler { @Resource private TimerService timerService; @PostConstruct private void postConstruct() { TimerConfig config = new TimerConfig("OneMinutePassed", false); ScheduleExpression se = new ScheduleExpression(); se.minute("*"); se.hour("*"); timerService.createCalendarTimer(se, config); } public String addSchedule(String second,String minute,String hour,String info){ TimerConfig config = new TimerConfig(info, false); ScheduleExpression se = new ScheduleExpression(); se.second(second); se.minute(minute); se.hour(hour); timerService.createCalendarTimer(se, config); return "Added " + info; } @Schedule(minute="*/5", hour="*") private void eachFiveMinutes(){ System.out.println("Called each five minute"); } @Timeout public void timeout(Timer timer) { if ("OneMinutePassed".equals(timer.getInfo())) { System.out.println("OneMinutePassed !!!"); /*for(Timer t : timerService.getTimers() ){ System.out.println(">>> "+ t.getInfo() ); }*/ }else{ System.out.println("!!! "+ timer.getInfo() ); } } } }}} '''ScheduleRemote.java''' {{{#!highlight java package org.allowed.bitarus; import javax.ejb.Remote; @Remote public interface ScheduleRemote{ String addSchedule(String second,String minute,String hour,String info); } }}} '''ScheduleWS.java''' {{{#!highlight java package org.allowed.bitarus; import javax.ejb.Stateless; import javax.jws.WebMethod; import javax.jws.WebService; import javax.ejb.ScheduleExpression; import javax.annotation.Resource; import javax.ejb.TimerService; import javax.ejb.TimerConfig; import javax.ejb.EJB; @Stateless @WebService public class ScheduleWS implements ScheduleRemote{ @Resource private TimerService timerService; @EJB Scheduler sc; @WebMethod public String addSchedule(String second,String minute,String hour,String info){ return sc.addSchedule(second, minute, hour, info); } } }}}