Vorstellung Des Referenten: Frank Pientka
Total Page:16
File Type:pdf, Size:1020Kb
© MATERNA GmbH 2013 www.materna.de 1 Vorstellung des Referenten: Frank Pientka Dipl.-Informatiker (TH Karlsruhe) Senior Architekt in Dortmund iSAQB-Gründungsmitglied heise.de/developer/Federlesen-Kolumne Über 15 Jahre Erfahrung mit Java und Middleware Veröffentlichungen und Vorträge zu: Datenbanken, Applikations- und Portalservern © MATERNA GmbH 2013 www.materna.de 2 Inhalt . Java-Webentwicklung heute . Darf ich vorstellen: Tomcat, TomEE . Beispiel . Warum wechseln? . Ausblick © MATERNA GmbH 2013 www.materna.de 3 Historie von Webframeworks https://github.com/mraible/history-of-web-frameworks-timeline © MATERNA GmbH 2013 www.materna.de 4 Was ist das wichtigste an JavaEE7? JavaMagazin MAY/JUNE 2013 © MATERNA GmbH 2013 www.materna.de 6 Primary Application Server What is the primary application server you typically use to deploy 29,9% 33,6% Apache Tomcat 32,1% 33,8% 8,2% 8,6% JBoss 9,0% 10,5% 4,3% 6,6% Jetty 3,5% 3,6% 2013 4,0% 5,1% 2012 IBM WebSphere 4,0% 5,1% 2011 4,3% 2010 4,9% Other (specify) 4,3% 5,2% 3,9% 3,6% Glassfish 3,0% 2,9% 2,5% 2,5% Oracle WebLogic 2,6% 3,3% Eclipse Open Source Developer Report 2013 © MATERNA GmbH 2013 www.materna.de 7 Apache Tomcat . Am weitesten verbreiteter Servlet-Container . Niemals JavaEE-zertifiziert . Spartanische GUI, Doku . Lange Release-Zyklen, kein Support . Mit Heraku, Jelastic, Elastic Beanstalk in die Cloud http://tomee.apache.org/comparison.html © MATERNA GmbH 2013 www.materna.de 8 Tomcat Historie: Meilensteine . 2002 Tomcat 4 wird zu beliebtesten Web Container . 2004 Tomcat 5 mit Unterstützung von Servlet API 2.4 und JSP 2.0 . 2005 Tomcat wird Top Level Projekt der Apache Foundation . 2006 Tomcat 5.5 EOL Oktober 2012 . 2007 Tomcat 6.0.37 . 2010 Tomcat 7.0.46 . 2013 Tomcat 8 http://tomcat.apache.org/whichversion.html http://wiki.apache.org/tomcat/TomcatVersions http://tomcat.apache.org/migration-8.html © MATERNA GmbH 2013 www.materna.de 9 Apache Tomcat Versionen Servlet/ JSP Tomcat Version JDK, EL Version Spec 3.1 2.3 8.0.x JDK 1.7+, EL 3.0 3.0 2.2 7.0.x JDK 1.6+, EL 2.2 2.5 2.1 6.0.x JDK 1.5+, EL 2.1 2.4 2.0 5.0.x, 5.5.x JDK 1.4+, EL 1.0 2.3 1.2 4.1.x JDK 1.3+, EL 1.0 2.2 1.1 3.3.x JDK 1.2+ © MATERNA GmbH 2013 www.materna.de 10 Tomcat 8 RC4 . catalina-storeconfig.jar (Generation of XML configuration from current state) . el-api.jar (EL 3.0 API) . jasper-el.jar (Jasper 2 EL implementation) . jsp-api.jar (JSP 2.3 API) . servlet-api.jar (Servlet 3.1 API) . tomcat-jdbc.jar (Tomcat's database connection pooling solution) . tomcat-jni.jar (Interface to the native component of the APR/native connector) . tomcat-spdy.jar (SPDY implementation) . tomcat-util.jar (Various utilities) . tomcat-websocket.jar (WebSocket 1.0 implementation) . websocket-api.jar (WebSocket 1.0 API) . tomcat-spdy.jar (SPDY implementation) . tomcat-util.jar (Various utilities) . tomcat-websocket.jar (WebSocket 1.0 implementation) . websocket-api.jar (WebSocket 1.0 API) . http://ci.apache.org/projects/tomcat/tomcat8/docs/RELEASE-NOTES.txt © MATERNA GmbH 2013 www.materna.de 11 Was kostet Tomcat ? . Kostenlose Online Manuals und Tutorials verfügbar . Mailinglisten und Foren für alle Niveaus . Wenig Einarbeitungsaufwand . Angebote für Coaching und Consulting / Support . Der “Rest“ kostet NICHTS !!! . Apache Software Licence Version 2.0 http://www.apache.org/LICENSE © MATERNA GmbH 2013 www.materna.de 12 Tomcat-Überblick Benutzer DB http/s LDAP Tomcat http/s, file, rmi, jmx File http/s, file ADMIN Konfiguration Entwickler Mail logging: catalina.log Rollen: manager-gui config: catalina.policy localhost.log manager-script Catalina.properties logging properties manager-jmx context.xml Manager-status tomcat-users.xml web,xml © MATERNA GmbH 2013 www.materna.de 13 Tomcat Deploymentarten War Deployment Tomcat Unpacked Deployer Deployment Tomcat Deployer Using Tomcat Scripts Manager © MATERNA GmbH 2013 www.materna.de 14 Architektur - Tomcat Komponenten Tomcat Server Service Engine (Catalina) Realm Connector (Coyote) Valve Host Connector (AJP) ContextContext Valve Context Connector (SSL) Valve LoggerLoggerLogger LoggerLoggerLogger LoggerLoggerLogger © MATERNA GmbH 2013 www.materna.de 15 Authentifizierungsverfahren bei Webanwendungen Zugriffsmethoden: Tomcat Server Engine (Catalina) BASIC Host FORM - based Context • JNDI • File DIGEST Realm Benutzer, Passwort • LDAP Realm • ... Realm Security Rolle CLIENT-CERT Benutzer Passwort Rolle container-managed security © MATERNA GmbH 2013 www.materna.de 16 Filter und Ventile Webserver Valve Engine (Catalina) Request Zugriff Host auf den Context Request Response Web Application Zugriff auf den Response © MATERNA GmbH 2013 www.materna.de 18 Arten von Valve Komponenten Access Logging Single Sign-On Request Filtering Request Dumping Ermöglicht Authentifizierung Zugriffssteuerung Schreibt sämtliche erweitertes Logging erfolgt nur einmal im auf Basis von IP / Daten aus dem (vgl. Logger) Host Hostnamen Request weitere Valves: z.B. FormAuthenticatorValve, JDBCRemoteAccessValve, ... © MATERNA GmbH 2013 www.materna.de 19 Tomcat JNDI Konfiguration Innerhalb folgender Elemente: Tomcat Server . <GlobalNamingResources> . global innerhalb von Tomcat Global JNDI . <DefaultContext> Engine . global innerhalb des Hosts Host . <Context> DefaultContext . nur für Applikation Für Globale Ressourcen Context . <ResourceLink> . Für globale Elemente © MATERNA GmbH 2013 www.materna.de 20 Monitoring via JXM . JAVA_OPTS für Remote JMX . -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false . optional: Verwendung von Security, Definition von Rollen . JMX Client für Monitoring und Administration der MBeans JAVA_HOME\bin - JConsole.exe . Open Source JMX Clients, z.B. MC4J (http://www.mc4j.org) . via HTTP Commands Höhere Sicherheit mit SSL-Verschlüsselung: . -Dcom.sun.management.jmxremote.ssl=true . -Djavax.net.ssl.keyStore=keystore . -Djavax.net.ssl.keyStorePassword=password © MATERNA GmbH 2013 www.materna.de 21 Farbige Logdateien http://code.google.com/p/jlibs import java.util.logging.ConsoleHandler; import jlibs.core.util.logging.AnsiFormatter; public class ColorConsoleHandler extends ConsoleHandler { public ColorConsoleHandler() { setFormatter(new AnsiFormatter()); } } © MATERNA GmbH 2013 www.materna.de 22 Apache Loadbalancer Apache Web Server mod_jk LB Worker Worker Worker tom1 tom2 tom3 AJP AJP TomEE Cluster AppServer AppServer AppServer DB Standby DB © MATERNA GmbH 2013 www.materna.de 25 Tomcat Sicherheit http://tomcat.apache.org http://tomcat.apache.org/security.html http://tomcat.apache.org/tomcat-8.0-doc/security-howto.html http://docs.oracle.com/javase/7/docs/technotes/guides/security/ BSI Sicherheitsuntersuchung des Apache Jakarta Tomcat Servlet Containers © MATERNA GmbH 2013 www.materna.de 27 http://www.cvedetails.com/vulnerability-list/vendor_id-45/product_id- 887/Apache-Tomcat.html © MATERNA GmbH 2013 www.materna.de 29 TomEE/OpenEJB . Dezember 1999: OpenEJB 0.01 Richard Monson-Haefel, David Blevins . Januar 2002 OpenEJB 0.8 SourceForge.net . March 2004 OpenEJB 0.9 Codehaus.org . September 2006 OpenEJB 2.0 Apache Incubator, Geronimo 1.x . Juni 2007 Apache OpenEJB 3.0 TLP, Geronimo 2.x . April 2012 TomEE 1.0 TLP, OpenEJB 3.1.3, Java EE 6, , Geronimo 3.x . Oktober 2012 TomEE 1.5.0 , OpenEJB 4.5.1 . April 2013 TomEE 1.5.2, OpenEJB 4.5.2 . Q4/2013 TomEE 1.6.0 (OpenJPA 2.3, OpenEJB 4.6.0 (JavaEE 6)) . http://tomee.apache.org/download/index.html © MATERNA GmbH 2013 www.materna.de 30 TomEE Varianten . TomEE Web Profile certification . TomEE JAXRS . CDI - Apache OpenWebBeans . JAX-RS - Apache CXF . EJB - Apache OpenEJB . TomEE+ . JPA - Apache OpenJPA . JAX-WS - Apache CXF . JSF - Apache MyFaces . JMS - Apache ActiveMQ . JSP - Apache Tomcat . Connector - Apache Geronimo . JSTL - Apache Tomcat Connector . JTA - Apache Geronimo . KarafEE Multicontainer OSGI runtime Transaction . BatchEE (JSR-352) . Servlet - Apache Tomcat . Javamail - Apache Geronimo JavaMail . Bean Validation - Apache BVal © MATERNA GmbH 2013 www.materna.de 31 TomEE ist im Kommen: InfoWorld 2013-03-21 Can TomEE save Java EE? [email protected] [email protected] © MATERNA GmbH 2013 www.materna.de 32 Tomcat, TomEE, OpenEJB Vergleich TomEE Tomcat TomEE TomEE+ OpenEJB JAXRS Servlets XX X X JSP XX X X JSF XX X JTA XX XX JPA XX XX CDI XX XX JAAS XX XX JACC XX XX JavaMail XX XX Bean Validation XX XX Enterprise JavaBeans XX XX JAX-RS XXX JAX-WS XX Connector Architecture XX JMS XX © MATERNA GmbH 2013 www.materna.de 33 Meet TomEE in the Cloud! Jelastic © MATERNA GmbH 2013 www.materna.de 34 TomEE-Aufbau Tomcat JMS MQ JSP Translator JVM Client JDBC DB JSP Bean Web server EJB-Light RMI App Bean Servlet Security Servlet FS Manager Conn. Pool Error Log Servlet Engine © MATERNA GmbH 2013 www.materna.de 35 OpenEJB openejb-jar.xml in META-INF oder WEB-INF Application Server OpenEJB CPI OpenEJB Stateful Bean Stateless Bean Entity Bean Containers Containers Containers OpenEJB SPI JTA Transaction Manager Security Manager Resource Managers © MATERNA GmbH 2013 www.materna.de 36 TomEE-Werkzeuge . configtest.bat . shutdown.bat . startup.bat . tomee.bat . mvn tomee:help . IDE Eclipse, NetBeans, IDEA, ANT … . Webkonsole . Arquillian Adapters © MATERNA GmbH 2013 www.materna.de 37 TomEE Maven-Plugin . tomee:run: run and wait for the server . tomee:debug: run in debug mode and wait for the server . tomee:start: run the server . tomee:stop: stop the server (to use with start) . tomee:configtest: run configtest tomcat command . tomee:deploy <path>: deploy path archive . tomee:undeploy <path>: undeploy path archive . tomee:list: list ejbs deployed . tomee:build: build tomee but does not start it . tomee:help: this © MATERNA GmbH 2013 www.materna.de 38 Apache TomEE wichtigste Verzeichnisse . bin – unveränderte Skripte . conf – server.xml, tomee.xml, system.properties mit einem extra Listener (ports, hosts, engines, threadpools Konfiguration etc). Extra file openejb.xml (global resources). tomcat-users.xml für Rollen, Rechteverwaltung, exclusions.list um jars von Scannen auszuschließen . logs – Extra-Datei openejb.log .