Tuesday, May 3, 2016

JSF + Spring Integration, JavaConfig and the EL Resolver

One really great thing in Spring is the ability to configure your application inside the code itself using annotations, specifically with the @Configuration and @Bean annotations. And with the introduction of JSF 2 you no longer need the faces-config.xml for configuration either.  Annotations, yay!

Except that's not entirely true. You do need faces-config.xml when you want to integrate JSF and Spring.

As an experiment I created a JSF managed bean that utilized a Spring bean.  Spring happily created the bean and tried to inject it... but when I tried to run the code the bean was null.  This is because Spring and JSF are stepping all over each other; and this makes sense, because how would they know about one another if you don't tell them?  Fortunately the way to resolve this is to use create a faces-config.xml and add this one simple entry:

    <application>
        <el-resolver>
            org.springframework.web.jsf.el.SpringBeanFacesELResolver
        </el-resolver>
    </application>

And that's it.  They will happily cooperate after this.  But there doesn't appear to be any way to do this using JavaConfig :(  My dream of an XML free application will have to wait for now...



Friday, February 27, 2015

GPG Errors in Linux Mint

So when performing an apt-get update, you may (rarely) run into something like this:

W: GPG error: https://download.01.org trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A902DDA375E52366

Why does this happen?  I wish I could tell you. But all you need to do to fix it is to add the key again!  Just execute the following command:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A902DDA375E52366

Just be sure to replace "A902DDA375E52366" with whatever shows in your error message, and voila.

Well, almost.  Sometimes that doesn't work.  Why?  I wish I could tell you that, too.  But here's how to fix it if the above doesn't work for you:

sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update


That will force it to pull everything it needs again, and everything should be good to go.

Flash Player, Firefox and Linux Mint

You may have noticed the following message when visiting sites in Firefox that use Flash:

"This plugin is vulnerable and should be updated."

While not a show stopper, it is annoying (and possibly concerning... but don't worry, it's not a huge deal).  If you try to update it you'll find that you can't find the current version for Firefox in Linux Mint.  This is an excellent explanation for why:

http://www.howtogeek.com/193876/using-firefox-on-linux-your-flash-player-is-old-and-outdated/?PageSpeed=noscript

The TL;DR: Mozilla doesn't want to support plugin support for Pepper Flash.

Getting around this is relatively easy, though.  Just use FreshPlayerPlugin.  FreshPlayerPlugin simply acts as a wrapper to allow Firefox to work with Pepper Flash.  To use this you'll need to follow these steps:

1. Install Google Chrome.  You don't have to use it, but it's the easiest way to get the libpepflashplayer.so file you need to get this to work.  Do this:

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable


2. Install FreshPlayerPlugin.  Execute these commands:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install freshplayerplugin


Then just exit Firefox and start it up again.  You should be running the latest version of Flash.

Note: As of the day of this posting, hardware acceleration does not work yet, so don't try to mess with the configuration settings to get it to work.  This will be coming eventually.