Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Tuesday, July 12, 2016

Overview of JSON Libraries and How to Choose a Library

Welcome

It's good to be back.  The blog had an expected hiatus while I moved to a new city, also around Seattle.

Intro

Many of my posts are about overcoming unexpected difficulties when using some software library or module or another.  I decided to take a step back and try to select a quality module in the first place.  This is my analysis of the JSON libraries I was able to find and can count as a how-to to select a library in general.

The short result is that if a Library is in Maven, you can look at Maven Central to see how popular a library is and how frequently it is updated.  Then you can use one of the most used and updated libraries out there.  You can also consult StackOverflow.  Here are some examples.

The List

  • JSR 353 - We have javax.json-api and org.glassfish/javax.json.  Out of these two the
    This could be you!  Image from http://blog.smartbear.com

    org.glassfish one has more users and more updates (version 1.0.4 vs 1.0), so it is the winner so far.
  • Fast-XML Json Parsing / Jackson has many more updates (version 2.8), is far more used and the updates are fresher.  That makes it the winner so far.
  • JSON-Simple is comparable to the JSR 353 libraries.  If not for the Jackson library you could choose based on how well prior Google libraries have worked vs Oracle libraries.
  • org.json falls between Jackson and the JSR 353 libraries with about 700 users and a release in Feb of 2016.
  • Google GSON has about 2000 users and was updated last month.  This puts it on par with Jackson.
  • quick-json has 0 users!  This would make it almost unqualified even if there were no alternatives.
  • JsonPath - Lastly, JsonPath has a couple of hundred users.

Conclusion

Now, you may be skeptical of the Wisdom of the Crowd (e.g. appeal to the people or groupthink) but more users means that there is a higher chance someone found the same problems that you have.  Even in this day and age Googling an error string can still produce 0 results.
Based off of this my project is using Jackson and hasn't had any problems with it for months.

Next Steps

Once you have your JSON library picked out, how do you manipulate it?  I've had good luck using  http://www.jsonschema2pojo.org/, although in the options you have have it add annotations... which makes it a non-POJO technically...

Monday, January 14, 2013

Adventures in Certification: The Journey Begins

At a certain point in your career you may realize that you've specialized on accident, so you may as well "cert up" and go with it.

That was my exact situation, so after a bit of study found out that the Java starting certification is currently (Jan 2013) the Java SE 7 Certification.  Achieving this bestows the title of Oracle Certified Associate (OCA) Java SE 7 (aka OCAJ).  The old Java 6 equivalent appears to still be called a Sun certification, so that caused me some confusion that I hope to spare the reader.  Achieving the cert involves passing the 1Z0-803 exam, and this goes for under $500 USD so it's relatively reasonable given how much the further certs go for.

Copyright belongs to respective
content owners.
How to prepare was a bit vexing as well; an initial Googling of the exam number revealed a few scammy websites at first, the following sites all have poor reviews or prominent ripoffreport rankings: selftestengine.com (self test engine review), actualtests.com(actualtests reviews), pass4sure.com (pass4sure reviews) & realtests.com (realtests reviews).  You DO want to pick up a book on it.  I'm going through the OCA Java SE 7 Programmer I Study Guide by McGraw Hill just to brush up on the basics again.

Lastly, on a different note I'm making the plunge into freelancing, so I finally had to break and put in AdSense ads.  I hope that people find this informative and thanks for reading!

Monday, December 19, 2011

Valhalla Koan: Logging Without Logging

OK, this isn't really a koan, because there is an answer.  The more mundane version of the question is, how do you make log statements to diagnose why your favorite logging framework isn't working.

Just as parents can learn from their children, those close to mastery can learn from the neophytes, System.out.println is usually acceptable (you're web-container may vary).

If you're using WebLogic 11g, their logging documentation can be just as confusing as a koan.  Fortunately, as a part-time hipster I'm really into their earlier work (i.e. their prior documentation actually makes sense).

So, to get to the point, if you want to use the WebLogic logging before you initialize your favorite like (like Log4j) you can:

  1. Use the simpler WebLogic APIs for logging until your main logger is working.
  2. You may have to have your WebLogic server use more logging statements (mine was set to only WARNs and above but all of my logging statements were INFO until I changed it).  You can do that by:
    1. Logging into the WebLogic Console.
    2. Going to Environment -> Servers.
    3. Select the server you want.
    4. Click on the Logging tab.
    5. Expand the Advanced section.
    6. Turning everything to DEBUG or TRACE. 
    7. Save your changes.
    8. Restart the server.
    9. Finally, redeploy your application.
  3. Then you can trigger the early logging statements and view them in the WebLogic Server Administration Console.
If you're familiar with Oracle and WebLogic products, you appreciate how this is as simple and straightforward as it gets.