Apache TomEE with JOSSO and OpenLDAP

November 11, 2012

This a quick run-through to setup JOSSO with OpenLDAP on Apache TomEE,  the Java Enterprise Edition of Apache Tomcat.

Apache TomEE

Download and install Apache TomEE, nothing it is simpler than that!

Setup

TomEE is based on Tomcat, therefore the directory structure is very similar:

  • conf, the folder with the configuration files
  • lib, JAR files requires by the container
  • log, TomEE and application log files
  • webapps, WAR files
  • webapps/tomee, the Web application delivering the EE capabilities

Additional Libraries

Additional JAR files (ie DB drivers) can be dropped in the lib folder…. but a better approach is indeed to store them separately.

Create a new folder /lib/ext with the libraries, then update the /conf/catalina.properties to ensure those are part of the common classloader:

common.loader=\
${catalina.base}/lib,${catalina.base}/lib/*.jar,\
${catalina.home}/lib,${catalina.home}/lib/*.jar,\
${catalina.home}/lib/ext/*.jar

System Properties

System properties are defined in /conf/system.properties

Data Sources

Datasources are defined in /conf/tomee.xml

<Resource id=”myDS” type=”DataSource”>
JdbcDriver oracle.jdbc.OracleDriver
JdbcUrl jdbc:oracle:thin:@localhost:1521:xe
UserName user
Password pwd
JtaManaged true
</Resource>

Web Application Libraries

Additional JAR files (ie DB drivers) can also be dropped in the lib folder…. but again lets do it properly.

Create a new folder /applib with the libraries, then update the /conf/catalina.properties to ensure those are part of the shared classloader:

shared.loader=${catalina.home}/applib,${catalina.home}/applib/*.jar

java.lang.OutOfMemoryError

Set appropriate size for the Java Heap and PermGen space adding in  /bin/setenv.bat:

-Xmx1024m -XX:MaxPermSize=512m

JOSSO Setup

Download JOSSO dist (1.8.6 in my case) from JOSSO web site and install the Gateway, it is ok to set Tomcat 7 as platform:

josso> gateway install –target C:/apache-tomee-webprofile-1.5.0 –platform tc70

Deploying Apache Tomcat 7.0.x JOSSO Gateway v.1.8.6

Install the agent in the same way:

josso> agent install –target C:/apache-tomee-webprofile-1.5.0 –platform tc70

Installing Apache Tomcat 7.0.x JOSSO Agent v.1.8.6

Both steps will generate a report of all changes, so you can see which jar files have been copied and which configuration files have been modified.

Config Partner Application(s)

Edit /lib/josso-agent-config.xml to define the partner application(s) (<agent:partner-apps> tag), basically which apps/URLs will be JOSSO-protected.

OpenLDAP backend

If you need an LDAP backend (OpenLDAP?) some additional configuration is required:

Edit /lib/josso-gateway-ldap-stores.xml to setup the LDAP connection

Edit /lib/josso-gateway-config.xml to make sure it imports the above josso-gateway-ldap-stores.xml

Edit /lib/josso-gateway-auth and remove  hashAlgorithm/hashEncoding from the Basic Authentication Scheme, those settings seem to bother OpenLDAP and the user authentication doesnt work.

<basic-authscheme:basic-auth-scheme
id=”josso-basic-authentication”
ignorePasswordCase=”false”
ignoreUserCase=”false”>


Spring in Action

August 27, 2008

For anybody who is looking to start with the Spring Framework I definitely recommend the “Spring in Action” book. While you find loads of resources on the Web (aka lots of time to be invested) the book has indeed the approach you need if you are a beginner.

The reader is accompanied through the different chapters where the concepts are introduced incrementally and supported by good code samples. Also to be appreciated is the occasional use of UML diagrams to explain the interaction between classes.
It is available on Manning, and definitely worth the 30 bucks.

Part1 Core Spring is by far the most interesting as it covers IoC, bean wiring and AOP. Other chapters present the Enterprise features of Spring, from database access (JDBC and Hibernate) to security, messaging and Web Services. The book has also an introduction to Spring MVC and some words about the integration with other frameworks.

Key features: Easy to read, step-by-step approach, clear code samples.

Make sure it is the 2nd edition (Aug 2007) which is based on Spring 2.


Building XML Web Services with Java: Hands-On

July 29, 2008

Few weeks ago I attended the “Building XML Web Services with Java: Hands-On” training course offered by LearningTree International.

LearningTree

Aside the excellent central location in London and the nice facilities (canteen, coffee corners, Internet access, lab) available to the students I really have to say it is a very good training which I would definitely recommend to anybody who wants to get going with the Web Services and SOA business.

The program of the course covers different aspects related to Web Services with special focus on the standards, protocols and the Java APIs. Read the rest of this entry »


JBoss AS – Quick start in 5 minutes

February 22, 2008

JBoss AS is an open-source market-leader Java EE-based application server which enables the development and deploying of enterprise Java applications, Web applications and Portals.

There is exhaustive documentation at JBoss.com (JBoss AS web site and Product Datasheet to start with).

This post instead attempts to generate a five minutes “ready-steady-go” checklist with the basic steps to setup and use JBoss (*) for your development. Hopefully it can save you some time in the initial starting-up process. Good luck.

Install JBoss

  • Download the package from JBoss Download Center and unzip it.
  • Execute $JBOSS$/bin/run.bat

Understanding JBoss Directory Structure

JBoss top-level directory structure

  • bin: scripts
  • client: jars required by clients running outside JBoss
  • server: JBoss Server configuration (see below)
  • lib: JBoss Jar files (Do not place your own libraries in this directory).

Read the rest of this entry »


My guide to SCEA

February 1, 2008

SCEA (Sun Certified Enterprise Architect) is the most advanced certification in the Sun J2EE certification stack. It is intended for professionals responsible for designing and architecting J2EE applications.

I achieved the SCEA certification in Aug 2007 after passing the 3 different units: in this post I just want to summarise what SCEA is about and share my experience.

Sun fellas have recently upgraded (after long time) the SCEA certification to Java 5. I haven’t looked into it yet (hence this post is about the old version of SCEA) but I suspect the approach, exam and structure will be very similar.

Read the rest of this entry »