I’ve previously written on enabling HTTPS on your website using Let’s Encrypt. I showed that, with Let’s Encrypt, it’s quite easy to secure your Apache web server and, as a bonus, also showed how to secure your Dovecot mail server. But what if you are using Apache Tomcat? That’s quite easy, too!
I tried my hands on JSF last Friday. It didn’t go as smoothly as I expected.
Being the bleeding edge kind of person :P I set it up using Tomcat 6 and a quick start package from Exadel. The package already has all the jar files you need and you only need to type in (or cut-and-paste) some missing java code and jsp scripts. That done, I tried accessing /jskfs/pages. It didn’t work so I tried accessing directly inputname.jsp:
I figured, hey maybe I should try the latest reference implementation. That would also be in keeping up with being a bleeding edge kind of person :P So I went to Sun and downloaded latest reference implementation mojarra-1.2_09-b02-FCS-binary.zip, installed it to /jskfs/WEB-INF/lib, and again tried accessing inputname.jsp:
javax.servlet.ServletException: java.lang.NoSuchMethodError: com.sun.faces.taglib.jsf_core.LoadBundleTag.setBasename(Ljava/lang/String;)
It got worse. Figuring that the reference implementation is incomplete (don’t ask why). So I went to Apache.org and downloaded MyFaces, their implementation of JSF: myfaces-core-1.2.4-bin.zip. I installed it and tried again:
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
I took a look at the web.xml file, found, and commented this out:
I tried again:
javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/sun/faces/taglib/jsf_core/LoadBundleTag
I read somewhere that flushing the web app’s files in the work directory sometimes works so I did and then tried again:
javax.servlet.jsp.JspException: No faces context?!
I tried accessing via the entry point /jskfs/pages. It finally worked.
On a hunch, I went full circle and restored the original jar files, cleared the work directory, and tried accessing via the entry point again. Guess what? It worked 8-}
There are quite a few ways to go about this but one of the better (though not necessarily the easiest) is to use JPackage. On their website, it says that the JPackage Project has two primary goals:
- To provide a coherent set of Java software packages for Linux, satisfying all quality requirements of other applications.
- To establish an efficient and robust policy for Java software installation.
Now that is exactly what I’m looking for.
rpm –import jpackage.asc
mv jpackage.repo /etc/yum.repos.d/
SETUP RPM BUILDING
Put the following into .rpmmacros in your home directory:
%_topdir %(echo /home/jay/rpms)
BUILD THE RPMS FOR REQUIRED NON-FREE PACKAGES JDK AND JTA
Get the JDK files from Sun: jdk-1_5_0_03-linux-i586.bin (not jdk-1_5_0_03-linux-i586-rpm.bin!)
cp jdk-1_5_0_03-linux-i586.bin ~/rpms/sources
Get the JDK source rpm from jpackage
rpm -Uvh java-1.5.0-sun-1.5.0.03-1jpp.nosrc.rpm
rpmbuild -ba java-1.5.0-sun.spec
Get the JTA files from Sun: jta-1_0_1B-classes.zip and jta-1_0_1B-doc.zip
cp jta-1_0_1B-classes.zip jta-1_0_1B-doc.zip ~/rpms/sources
Get the JTA source rpm from jpackage
rpm -Uvh jta-1.0.1-0.b.4jpp.nosrc.rpm
rpmbuild -ba jta.spec
INSTALL SOME DEPENDENCIES FOR JDK*
yum install xorg-x11-deprecated-libs
yum install xorg-x11-deprecated-libs-devel
yum install unixODBC
yum install unixODBC-devel
*Theoretically not necessary if you use yum to install JDK
INSTALL JDK AND JTA
rpm -Uvh *
rpm -Uvh *
AND FINALLY INSTALL TOMCAT5
yum install tomcat5
yum install tomcat5-admin-webapps
yum install tomcat5-webapps
Fedora Core 4 came out today though. Maybe all this hocus pocus is no longer needed.