193 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
Docker Quick Tips
Fri, Apr 28th 2017 86
Notes in 9: Dev Tools Grab Bg
Tue, Apr 4th 2017 8
Custom JSON Serialization With GSON
Mon, Jan 23rd 2017 10
Recapping 2016
Mon, Jan 16th 2017 9
Rebirth: An App of Ice and Fire
Wed, Dec 14th 2016 7
Scripting Server Upgrades
Fri, Nov 11th 2016 7
Everything Old is New Again
Mon, Oct 24th 2016 7
Top 10
Docker Quick Tips
Fri, Apr 28th 2017 86
Building Java Objects From JSON
Thu, Jan 22nd 2015 13
When You Need a Comparator
Thu, Jan 8th 2015 11
Notes in 9: Docker + SonarQube
Wed, Feb 24th 2016 11
Nerdy Yet Awesome
Fri, Feb 26th 2016 10
Custom JSON Serialization With GSON
Mon, Jan 23rd 2017 10
Recapping 2016
Mon, Jan 16th 2017 9
REST is Best
Wed, Sep 17th 2014 8
2015: A Year In Review
Tue, Jan 5th 2016 8
Git Squash
Thu, Oct 20th 2016 8


A Quick Note on JARs
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
   

[Edit] In the comments, Sven Petri pointed out the need to have the JAR in the same relative path in the Designer environment conducting any build of the NSF. This is absolutely worth noting, though my excitement on this topic was driven by the lack of need to edit the java.policy file. Ultimately, everyone ought to communicate with their customers and/or administrators as to the external dependencies, to avoid any build issues by customer admins or non-developers. Basically, make sure people know to drop a copy of the JARs from the server in their local /jvm/lib/ext/ path. [/Edit]

Preface

Either I just didn’t know that this was a viable option or we’ve all been living in the dark for too long. My suspicion is the former, but what follows is a quick run down of my preferred approach for using the com.google.gson library (or any JAR), server-wide (without OSGi deployment). TLDR; drop it in <install>/jvm/lib/ext/ and restart your Domino server (don’t forget to do it with your local/dev environment as well).

What?

While preparing for my impending blog series on servlets, I’ve been hammering out a couple of details regarding external dependencies (aka- JAR files). The short story is that I assumed things had to be a certain way (including the java.policy edit for granting all permissions), but that wasn’t the case. If you want to read the full circle of comments, go check them out.

Why?

It seems that setting up what I regard as server elements, even these add-on ones, is something I don’t do every day. Any developer can see quickly that re-importing the same JAR file you use across your application instances can become quite tedious, quickly. But it would seem that there is a better way of doing things than just importing your JAR to each NSF and needing to add a line on the server (in <install>/jvm/lib/security/java.policy) of grant { permission java.security.AllPermission; }

To rule out what I have going in my primarily development environment (something that doesn’t come up for me as a staff employee of an IBM customer, as my environment doesn’t change, unless I add a picture of my kid to my desk), I created a fresh install of Notes/Domino Designer. I took a look at the <install>/jvm/lib/security/java.policy file and noticed something that works to our advantage as developers.

So, without the need to edit the java.policy file, this makes things a much easier sell to your admins (even though I recommend just buying them their beverage of choice ), as adding an industry accepted library to your server stack has a whole different tone than potentially scaring them with words like “grant” and “java.security.AllPermission”. One still needs access to the file system, so it may not do some people a lot of good; which is why, going forward with this series, I’ll be making the effort to give every GSON specific task I perform a fair shake with the equivalent using the com.ibm.commons.util.io.json package.

See It In Action

Here's my import from my series demo code imported into my fresh DDE install via my Git repo. As expected, without any JAR to find, it's going to fail.
Having shut down Designer and placing the com.google.gson JAR into the <install>/jvm/lib/ext/ path and then starting it back up again, you can see that it's now resolved. All without touching the java.policy file.
Added Benefit

The plus side to this approach is that it’s now also available in Java agents.

Caveat

As is inevitable with such things, there is a caveat to the use of the <install>/jvm/lib/ext/ path for JAR inclusion, primarily revolving around any libraries which are already a part of Domino.

Ultimately, I’m aiming to get into OSGi plugins for a first go by including my hit list of usual JAR files, so I can import them on a per-project basis. For example, if I’m building out a RESTful end point with GSON, I’m also probably using a couple Apache Commons libraries. It makes sense to package accordingly. One day, I’ll have all the cool toys.



---------------------
//edm00se.github.io/DevBlog//xpages/a-quick-note-on-JARs
Feb 09, 2015
2 hits



Recent Blog Posts
86
Docker Quick Tips
Fri, Apr 28th 2017 3:00p   Eric McCormick
Docker If you have been living under a rock, Docker is pretty much amazing. If you haven’t been living under a rock, you may be getting used to the idea of Docker, but still have the occasional question. I’ve found myself using Docker in increasing amounts and complexity over the last year or so. I’ve recently decided to start recording some of the tasks I’ve found useful, some of which may be less familiar to a beginner. If you’re so inclined, check out the playlist, embedded here.
8
Notes in 9: Dev Tools Grab Bg
Tue, Apr 4th 2017 1:00p   Eric McCormick
Intro I’m on Notes in 9 again, with a “grab bag” of a couple of tools I’ve put together recently that may be of a varying degree of useful for other Domino + XPages developers. You don’t need these to do development, but for the right person, they may help with their development workflow. Also of note, with the upgrade to Swiper with the FP8 release of Notes + Domino Designer, the limitations previously mentioned are no longer there! This means that my second tool I talked about, node-
10
Custom JSON Serialization With GSON
Mon, Jan 23rd 2017 2:00p   Eric McCormick
Intro Here’s a curious one, in which I found myself with a limitation of not being able to output JSON with scientific notation values. wait, what? If you’re wondering why that is, since both JSON and JavaScript allow scientific notation of number values, you are absolutely correct and that’s a great question. The strange thing was that I found myself outputting perfectly valid JSON to be consumed by something specific which didn’t allow scientific notation. I’m not entirely sure wh
9
Recapping 2016
Mon, Jan 16th 2017 3:00p   Eric McCormick
Intro Per usual, I’ve had a little break between things and decided to catch up with a bit of a summary of some recent things that each didn’t necessitate their own post. 2017 IBM Champion For starters, I’m honored to be named an IBM Champion in Collaboration Solutions (/ Social Business) for the third time. This would be a hat trick in (ice) hockey 🏒. I’m happy to be recognized with a group of people, developers and more, who are passionate about both their work and the plat
7
Rebirth: An App of Ice and Fire
Wed, Dec 14th 2016 4:00p   Eric McCormick
Intro If you read my blog for any of the Saga of Servlets series, then I hope that you’re excited I’m returning to the application I put together for it. This time, it’s as a conversation piece in regards to some of the build process modernization I engaged in recently, in order to unify the code base in its git repository. In any case, it’s helping pave the way forward before I update some of the back-end elements, when it will again be a talking point for some additional rework and
7
Scripting Server Upgrades
Fri, Nov 11th 2016 2:00p   Eric McCormick
Intro This one might be slight departure from my usual, but those that have followed my blogging this past year will have noticed a bit more of a leaning towards DevOps in some of my posts. This echoes a lot of what I’ve been concluding as increasingly a necessary part of development; that we need to consider a picture large enough to encompass the themes surrounding development functions and, like any good developer (DRY ~= “lazy”), automate the heck out of it. Overview I had p
7
Everything Old is New Again
Mon, Oct 24th 2016 8:00p   Eric McCormick
Intro Every so often, it’s good to reassess one’s position. This is good from both a standpoint of being inquisitive and even interrogative, but when it comes to the ever changing landscape of the front-end development space, it’s not only inevitable, but must be embraced for what feels the need to “stay afloat”. I’m changing theme of my blog, hopefully for the better. The previous theme was good and did a great job of getting things started, but while I had forked a copy of a good
8
Git Squash
Thu, Oct 20th 2016 8:00a   Eric McCormick
Intro If you’re just here to learn a little about how to “squash” commits with git, skip down a ways. Otherwise, hold on, and I will catch you up on a couple of personal notes before we get there. On the Blog It’s been a little while since I blogged last. This has been due to a combination of reasons; specifically, I’ve been busy with: my family, it was the end of summer with lots of things going on a number of projects around the house (a deck removal and basement remodel
7
MWLUG Success
Wed, Aug 24th 2016 8:37a   Eric McCormick
Intro MWLUG was a great success as far as I’m concerned. Each time I’ve gone I’ve had the great enjoyment of being able to attend some high quality sessions, meet with lots of colleagues and friends from the community, and get a view into products and solutions many people are undertaking, over conversations and interactions outside of the sessions. This is always a great way of interacting with others who were able to make it. Unlike the IBM conference of Connect(EDsphere), this is purel
5
Manually Renewing HTTPS w/ Let's Encrypt
Wed, Jul 27th 2016 10:40a   Eric McCormick
Intro A while back, I rolled a personal project, which is a Node app, to Bluemix for lightweight use. I managed to make use of Let’s Encrypt for the HTTPS certificate, but only after realizing that there was a bit of a manual aspect to it that is the antithesis of an automated script for such things. Ultimately, after finding some information in a blog post form Marky Roden (of all people), I was able to get moving. The only downside wound up being that time passed, and it came time to renew




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition