Use Tomcat Connector for Load Balancing Glassfish or SJSAS

In this tutorial i describe how you can use the Tomcat Connector (mod_jk module) as a load balancer for the Glassfish or Sun Java System Application Server (SJSAS). It’s availabe as a loadable module for the Apache webserver and for the Microsoft IIS. The Tomcat Connector uses the packet oriented binary AJP13 protocol for the communication between the servlet container and the webserver. This architecture is optimized for speed and is much faster as a proxy configuration. Download components Download the actual mod_jk distribution for either Apache or IIS webserver. Download the actual Tomcat 5.5 distribution. Download commons-logging and commons-modeler[…]

Read more

Developing Java Mappings for SAP XI

You can use NetBeans to develop java mappings for the SAP NetWeaver Exchange Infrastructure (SAP XI). The only thing you need is the mapping api library from your SAP XI installation. Registering Mapping API in NetBeans Use the NetBeans Library Manager under «Tools->Library Manager» to register the aii_map_api.jar file. You find this library in the following path of your SAP XI installation: <SAP_install_dir>/<system_name>/<instance_name>/j2ee/cluster/ server<number>/apps/sap.com/com.sap.xi.services/ Project settings The SAP NetWeaver Exchange Infrastructure 3.0 is based on J2EE 1.3 and Java 1.4, so you must use a JDK 1.4.x and source level 1.4 for your project. Useful libraries SAP XI uses XML[…]

Read more

NetBeans JPA and Hibernate Tutorial

This tutorial illustrates the usage of JPA with Hibernate as the persistence layer for a Java SE application. For this tutorial we use a PostgreSQL database. The installation of PostgreSQL and creation of the test database is not handled in this tutorial. Start NetBeans and create a new Java project. Name your project «JPATutorial» and deselect the «Create Main Class» checkbox. Click on «Finish» and the setup wizard creates your project. Right click the «Source Packages» note in the project explorer and select «New -> Java Package». Name the package «jpatutorial» and click «Finish». Libraries We need some additional libraries[…]

Read more

Fill a treeview programmatically

You must build a collection of TreeNode objects and add this collection to the TreeView control. Each TreeNode object has several properties to set up the visual appearance and functionality. Important TreeNode properties expanded – Shows this node expaned with children ext – Title text of the node target – Target browser window toolTip – Tooltip text to display url – Hyperlink to navigate to action – Name of method to call if user selects this node actionListenerExpression – Expression for action listener method. Adding icon to TreeNode To add a icon to the TreeNode you must first create a[…]

Read more

JAAS with active directory authentication in a web application

This is a sample to use JAAS authentication with a windows active directory server. I use a Sun Java System Application Server, so the steps with other servers could be different. Step 1: Defining LDAP realm In this example you must define a LDAP realm named «ads-realm» with the following parameters: Realm class: com.sun.enterprise.security.auth.realm.ldap.LDAPReam Properties: directory = ldap://ads.host.name:389 base-dn = DC=ads,DC=domain,DC=com search-bind-dn = user search-bind-password = password search-filter = (&(objectClass=user)(sAMAccountName=%s)) group-search-filter = (&(objectClass=group)(member=%d)) jaas-context = ldapRealm You must change directory, base-dn, search-bind-dn and search-bind-password to your active directory configuration. The «search-bind-dn» and «search-bind-password» parameters are needed, because with default settings[…]

Read more