Do inferno ao céu com fugindo do JAR e do Classloader Hell Do inferno ao céu com OSGi @steppat Nico Steppat github.com/steppat [email protected] OSGi - Desde 1999 … define um sistema dinâmico de componentes para plataforma Java … http://www.osgi.org/ OSGi - Mercado sem osgi osgi, mas escondido osgi e visível http://underlap.blogspot.com.br/2013/02/virgo-survey-results.html solução própria OSGi - Bundles e Runtime JAR + Meta-Informações Eclipse Equinox, Apache Felix http://pt.slideshare.net/bjhargrave/why-osgi OSGi - Environment Apache Karaf Apache Karaf, Eclipse Virgo Console, Maven, Provisioning… Apache Aries, Eclipse Gemini Apache Felix, Eclipse Equinox OSGi Enterprise OSGi Runtime JRE http://stackoverflow.com/questions/17350281/what-exactly-is-apache-karaf Visibilidade e Encapsulamento http://java.dzone.com/articles/why-osgi-important Visibilidade VRaptor 4.0.0 - 335 classes publicas Guava 18.0 - 1157 classes publicas Granularidade JAR? http://java.dzone.com/articles/granularity-architectures Visibilidade e Isolamento com.sun.org.apache.xerces.internal.parsers.* ! jersey.repackaged.com.google.common.base.* http://docs.oracle.com/javase/7/docs/technotes/guides/xml/jaxp/JAXP-Compatibility_160.html Versionamento 1.0.0 1.0.0 Financeiro Cobrança <<service>> <<modelo>> 4.3.6 1.2.16 Hibernate log4j <<infra>> <<infra>> Versionamento Demo 1 - JAR Hell JAR Hell - Classpath 1.0.0 Financeiro <<service>> 1.1.0 Cobrança 1.1.0 Comercial <<service>> <<modelo>> JAR Hell - o classpath 1.0.0 1.0.0 Financeiro Cobrança <<service>> <<modelo>> 1.1.0 1.1.0 Comercial Cobrança <<service>> <<modelo>> NoSuchMethodError, ClassNotFoundException, NoClassDefFoundError http://en.wikipedia.org/wiki/Java_Classloader#JAR_hell JAR Hell - o classpath http://tech.puredanger.com/2009/06/04/javaone-jigsaw/ OSGi - Bundle Loader, Runtime Versioning JAR META-INF/MANIFEST Bundle-Name: Caelum - Serviço Financeiro 1.0.0 Bundle-SymbolicName: br.com.caelum.financeiro Bundle-Version: 1.0.0 Import-Package: br.com.caelum.modelo;version=1.0.0 Export-Package: br.com.caelum.financeiro;version=1.0.0 OSGi Runtime (Eclipse Equinox, Apache Felix, …) http://spring.io/blog/2008/02/18/creating-osgi-bundles/ OSGi - Bundles Demo 2 - Bundles Lifecycle OSGi - Bundle Lifecycle http://eclipsesource.com/blogs/2013/01/23/how-to-track-lifecycle-changes-of-osgi-bundles/ OSGi - Bundle Lifecycle http://eclipsesource.com/blogs/2013/01/23/how-to-track-lifecycle-changes-of-osgi-bundles/ OSGi - Services OSGi Runtime spring-mvc <<ui>> service JPA Interface http://karaf.apache.org/manual/latest/users-guide/enterprise.html DS OSGi - Services OSGi Runtime spring-mvc <<ui>> service JPA Interface http://blog.nanthrax.net/2011/12/do-you-know-the-apache-karaf-maven-plugins/ DS OSGi - Services Demo 3 - Spring MVC e JPA OSGi - Conclusão http://stackoverflow.com/questions/106222/what-does-osgi-solve