Updates from January, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • tuxdna 11:00 am on January 27, 2012 Permalink | Reply
    Tags: , packaging,   

    Packaging Java JARs as RPM packages 

    At JUDCon 2012, I had a discussion and argument with Jaikiran Pai and Ravi Maurya on “Packaging Java JARs as RPM packages”.

    Well it is not just RPM, it could be any package management system ( eg. dpkg, protage etc. ), doesn’t matter as long as it serves the purpose of:

    • automatic dependency resolution
    • installation of dependencies
    • rollback an install step
    • install multiple versions of a (JAR) package
    • ensure the packages are authentic ( for security )

    How is all this achieved in Java world? Simple. Just package all the required JARs in a single JAR or WAR or an EAR for that matter. And trust the packager for its security. But:

    • Is this a good practice?
    • What happens when you want to install the same package on multiple systems?
    • Can you roll back changes easily on multiple installations?
    • How are JARs shared across different kind of projects, some which use the same version of the same JAR package?

    Consider the case of Maven, with which you can easily specify the dependencies and Maven does all the work of dependency resolution.
    However, it solves the problem only at the developer’s level. JARs are still bundled inside the output application package (JAR / WAR / EAR). And everytime this application is distributed, it will contain “ALL” the dependencies. That is clearly an overhead.

    That makes me think, why JARs don’t work like Shared Libraries, which can be shared across applications. Every classloader / JVM instance has its own version of the same JAR file on-disk! Can’t they be shared? That too is clearly an overhead. I am not aware of the reasons why it is so, which I would definitely like to know.

    The point is, since a package manager has all the functionality, why not just leverage it? Java community is either unaware of it, or doesn’t care.

    No problem. There are efforts already in place.

    Anyway, of other things Jaikiran told me that, JBoss AS7 has how better and modular class loading which is based on JBoss Modules. This appears to me similar to how Maven structures it JAR repositories.

    Here are some resources:

    Thats it folks!

     
    • Matěj Cepl 12:14 pm on January 27, 2012 Permalink | Reply

      Would it be possible to create Project Jigsaw packages with some external tools even before the arrival of Java 8?

    • Chaitannya Mahatme 12:53 pm on January 27, 2012 Permalink | Reply

      Yup, I think the Java world doesn’t care, since they have a full-fledged packaging utility. I typically face this issue when working with Eclipse. We are working on debugger. So it’s like I would first launch 2 instance of eclipse, and then in the second instance I would launch another debugger. In this case JVM consumes 1 GB of Ram, otherwise which is normally in the range of 250-300 mb.

      If you look at the plugins (jar packages) which I am using, 90-95% are the same ones. But in this case they have to be launched thrice.

      • Chaitannya Mahatme 12:56 pm on January 27, 2012 Permalink | Reply

        One more thing … I guess Java would lose it’s reputation of build once, run it everywhere if we have a packing system which is native to the OS.

        • tuxdna 12:58 pm on January 27, 2012 Permalink

          Thats a good point. Therefore the packaging mechanism should be platform / OS agnostic.

        • Mohd Asif 9:04 am on February 24, 2012 Permalink

          Lumping all classes in a jar/war/ear is not a packaging utility. java sucks in this regard.
          Its not the reputation which is stopping you to share jars between two running instances. its about security. Java and many other languages runs in a Virtual machine. Each VM is its own world. They dont share anything outside VMs just like a native OS does not share anything with other OS running on other or same hardware.
          To be able to share jars, you should have a common address space where shared data will reside, which is not possible in programs running in different VMs as each VM creates its own address space. In a single JVM, classes are shared between all the threads in most cases which is what should happen.

    • Mohd Asif 8:43 am on February 24, 2012 Permalink | Reply

      Sun microsystems did a shoddy job in creating a dependency specification at jar level. Class is the only unit of functionality. JAR is nothing but a zip of a set of classes. Jar does not declare what all classes/functionality it provides; what is its version; JAR is not annotated with information with what all other jars it need. we get ClassNotFoundException in java and not JarNotFoundException.

      Eclipse foundation’s OSGi/JCP’s Project Jigsaw are trying to solve this problem. Idea is to annotate JARs with all the above information in META-INF so that while loading a JAR you can search all the other supporting jars of right version. That’s what eclipse plugins does. You can install JDT which uses one version of say pluginx.1.0 and than install PDE with pluginx.1.1 Both runs fine.

      Eclipse install new software also resolves all the dependent jars/plugins as well.

      • Matěj Cepl 5:48 am on March 28, 2012 Permalink | Reply

        @Mohd Asif … it is nice and handy, but why Eclipse still asks about restart when OSGI modules should loaded/unloaded while the system is running? And just call all plugin writers idiots, that’s just easy … I suspect OSGI API has some deep warts when nobody is able to use it properly.

        (disclaimer: I am not a Java programmer by any stretch of imagination)

        • Chaitannya Mahatme 6:39 am on March 28, 2012 Permalink

          @Matěj Cepl The Eclipse architecture has a lazy loading feature, i.e. the plugins are loaded only when they are required but all their dependency & contribution related information is collected before hand from the plugin.xml file.

          All the plugin.xml files for all the plugins are loaded only once by equinox when eclipse starts. Hence you need to restart eclipse everytime you add a new plugin.

        • Matěj Cepl 6:44 am on March 28, 2012 Permalink

          OK, so help me … where is the bug?

        • Mohd Asif 7:31 am on March 28, 2012 Permalink

          @Metej : i did not called plugin writers or sunmicrosystems idiots.
          I think you are mixing two different requirements. One is specifying dependency on other so that a package installer pulls dependency jar when dependent jar is installed. Saleem was talking about building such utility in apt/yum etc. OSGi built it in java world.
          The issue you pointed in yours comment is in runtime replacing class from memory so that a newer version of class can be used without a need to restart application. OSGi is not the solution for that.

        • Matěj Cepl 7:40 am on March 28, 2012 Permalink

          I know that the Wikipedia is not the source of The Only Truth, but still I think that “Applications or components (coming in the form of bundles for deployment) can be remotely installed, started, stopped, updated and uninstalled without requiring a reboot; ” (the first paragraph of https://en.wikipedia.org/wiki/OSGI) seems like a pretty good advertising of the capability I am missing in Eclipse. But OK, taking your point … owls are not what they seem.

  • tuxdna 7:21 am on January 27, 2012 Permalink | Reply
    Tags: drools, , jboss, judcon, redhat   

    JUDCon 2012 – an experience! 

    My first Java exclusive conference!

    I arrived at the venue right on time. Surprize, there were a lot of people already holding their welcome kits. Conference was already running quite smoothly. Wifi worked most of the time. The sessions, lunch, tea were always on time. Actually, there were people assigned to ring bells, just like in schools, to notify timeout during lunch and tea breaks :)

    The whole confenence was revolving around four major topics: JBoss AS7, Infinispan, Drools and OpenShift.

    Opening talk was given by Harish Pillay, Red Hat Global Community Architecture Team.

    The Keynote of the day was by Bruno Georges. He mentioned some interesting trends of which are:

    • There are about 4 times the processors compared to the number or people in United States alone and growing. Meaning that the processing power is available in abundance.
    • There is a significant growth in Ad-Hoc Social Networks for businesses

    Now where is the industry heading? In perspective of Java, Java ME/EC is going to be merged with Java SE/EE. SQL based data is moving towards NoSQL which is now leading us to NewSQL. The software stacks are moving towards ubiquitous computing i.e. even smaller handheld devices, are capable of running these software stacks. To sum it up, it was a very factual and a visionary talk by Bruno.

    I will defer the other topics till later. Let me talk about the topics I liked the most:

    JPA – Painless Persistence

    Painless Persistence by Greg Kable was a very engaging talk. It was kind of an OOPS/ORM primer. The concepts were explained in a very general terms like “why/when to use ORM and when not to”, Skinny Objects and their pitfalls. Why to avoid optimization? Such concepts could be applied to any kind of ORM in practice. Even if you didn’t know anything about JPA or Hibernate, you could understand the point Greg was trying to make. And by the way, there are 3 rules of optimization: don’t do it, don’t do it, don’t do it. Before deciding on optimizing part(s) of your application always think of these 3 rules. It is just as a reminder that it might not make sense to put efforts on optimizing your applications first of all.

    Future of Seam Framework

    Seam 3 is final release of Seam project. That’s it. All future efforts are directed towards Apache DeltaSpike from now on. So, do think twice before using Seam for your new projects. However, Seam being a widely used framework, the bugfixes and mainitainence will still be available. And contributes, checkout the DeltaSpike project now!

    Polyglot Revolution

    This was an intersting topic. What it means is that many JVM based languages (ceylon, scala, clojure, ruby, python) and their frameworks ( like Ruby On Rails ) will be available integrated with JBoss AS. TorqueBox is a unique example of this. With this effort, you can use all the power and features of Java EE stack right into your other language frameworks. Same argument applies for Immutant.

    JBoss Application Server

    In the recent years, JBoss has seen a lot of increase in the number of hits on its project sites from the Indian region. Most of these hits are by the users who use JBoss. But what about the size of contributers? What is the plan ahead for community engagement? Well that is the question I asked the panel. JBoss Heroes is project that is supposed to address this issue. Lets see when it is going to actually materialize. JBoss AS7, the latest release, is fully EE6 compliant, is very lightweight and is blazing fast with a boot time less that 3 seconds!

    Infinispan

    I don’t know why but there were just too many talks on Infinispan alone ( over 6 talks ! ). Inifinispan is a data grid platform based on the design of Amazon Dynamo ( has many implementation including Apache Cassandra ). Infinispan spans a very broad set of usecases. It can act as an in memory cache, persistent cache, distributed cache, replicated cache for high availablity. Also it provides plugins for different backends like Arjuna TM, BDB, JDB, JDBC etc.

    Essentially it acts a key/value store. Its real power comes from its flexibility, which allows it to be adapted for many many use cases.

    Becoming an Open Source developer

    “When in fight, I start to fear that if I get hit by my oppnent, worse is going to happen, and I will lose.” Well, dont! Believe in how good things are going to be if you succeed. Always think that you are going to bring the opponent down no matter what. Never fear of failure. Fear the fear itself, and put your best. That is the mantra of successful Open Source developers, quite well explained by Dmitris in his talk Becoming an Open Source developer. Fight the problem until you solve it. Isn’t that straight forward ;-)

    Drools – Rules Engine and Complex Event Processing

    In the talk “Declarative Rules” by Mark Proctor ( co-creator and founder of Drools ), he explained that Drools is Declarative Rules based engine. He demonstrated a simple game Wumpus World, that can be completely created using only rules. No other code required, which simplifies the whole process. Of the other things in his talk, there qere queries regarding Fuzzy logic support in Drools. Rules reduction or compaction process in Drools. Also rules processing on distributed and unstructured data, which is an inherently hard nut to crack.

    In a subsequent talk “Demystifying Complex Event Processing” by Mark Proctor again, he explained how CEP works. How Complex Event Processing (CEP), Event Stream Processing (ESP) and Event Drive Architecture (EDA) are closely related. Drools Fusion is the CEP tool by JBoss. To learn more about Drools / CEP there are many books available: The Power of Events, Event Drive Architecture, Drools JBoss Rules 6.0 Developer’s Guide, JBoss Drools Business Rules

    I am happy to have met a lot of people Jaikiran Pai, Sachin Patil, Ray Ploski, Radoslav Husar, Ales Justin, Dmitris Andreadis, and many other whom I only listened to ;-)

    However, I also missed a few things that would have made this conference even better in my opinion. There could have been an inclusion of activities like Hackathon, Bug Squadding or Workshop ( hands-on sessions ).

    It has been a great learning experience. Keep them coming – the events – JUDCon 2012, you rock!

    PS: I don’t see any slides nor the videos from JUDCon 2012 on their website yet. When are they coming?

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
Follow

Get every new post delivered to your Inbox.