Meet the Experts: Karl Bishop on WebSphere Portal and Linux

This question and answer article features WebSphere expert Karl Bishop, who answers questions about WebSphere Portal, Linux, WebSphere Studio, and WebSphere Application Server.

Karl Bishop (kfbishop@us.ibm.com), Senior Software Engineer, IBM

Photo: Karl BishopKarl Bishop is a Senior Software Engineer on the IBM Web Enablement and Support team. He works from the wilds of North Carolina. Karl works on various internal and external Web 2.0 and Mobile applications. He specializes in Dojo, Dojo Mobile, and Worklight based solutions.


developerWorks Contributing author
        level

16 June 2004

Introduction

WebSphere® Portal delivers a single point of access for applications and information within a customizable and extendable framework. It integrates an application deployment platform with team collaboration, content publishing, workflow, and enterprise application access services. For more information, see developerWorks WebSphere Portal zone.

Question: How do I change my system's host name when running WebSphere Portal?

Answer: There is currently no direct method to change your host or node names on WebSphere-based servers. While the following works reliably for myself, you should exercise caution and perform full backups prior to attempting this on your own servers.

First a little background. The hosting and development environment my group is currently using consists of many servers running VMware ESX (a Linux variant). Each physical host supports many VMware guest systems. In our environment, we are running primarily SuSE Linux with a few Windows® 2000 guests as well. Each guest server runs a variety of IBM® middleware (Http Server, WebSphere Application Server, WebSphere Portal, DB2, Tivoli Directory Server, and more). We frequently clone these guest images into new servers, and part of that process is performing a host name and IP address change.

I have written scripts that perform these procedures, and while I cannot post the scripts here, I can detail the basic functions performed. These steps have only been tested and run on Linux based servers (VMware ESX, SuSE Enterprise Linux v8.1, Redhat and Fedora). Mostly, I take a shotgun approach to changing files, as shown below.

I assume that similar steps could be taken on a Windows platform, along with a generous scan of the Windows registry thrown in as well. For Windows, I would recommend that you install Cygwin to provide a decent working environment.

Again, this is not an official recommendation, nor is it supported by IBM. It works for me. Your mileage may vary. Ensure all servers are stopped prior to performing these steps.

IBM Http Server:

  1. Update the httpd.conf file with the new host/FQDN name.

WebSphere Application Server v5 and WebSphere Portal v5:

  1. Delete all logs and temporary files (this is optional). There are others, but these are the big ones:
    • ${WAS}/logs/*
    • ${WAS}/temp/*
    • ${WAS}/wstemp/*
    • ${WPS}/log/*
    • ${WPS}/config/work/*
  2. Replace all instances of the old name and FQDN with new values. Find the files using:
    • For WebSphere Application Server:
      grep -rl ${OLD_NAME} ${WAS_DIR}
      ed - $FILE <<!EOF
          g/${OLD}/s//${NEW}/
          w
          q
      !EOF
    • For WebSphere Portal Server:
      grep -rl ${OLD_NAME} ${WPS_DIR}
      ed - $FILE <<!EOF
          g/${OLD}/s//${NEW}/
          w
          q
      !EOF
  3. Rename all directories and files that contain the old host (node) name. The trick is to process the files from the bottom up, hence the reverse sort of matching items.
    for OLD in $(find ${WAS_DIR} -name "*${OLD_NAME}*" -print|sort -r); do
      NEW=${OLD%${OLD_NAME}}${NEW_NAME}
      mv -v ${OLD} ${NEW}
    done
  4. Rebuild any Http Server plugins.

DB2 V8.1, for each database instance:

  1. Set DB2SYSTEM --> "db2 update admin configuration using db2system $NEW_NAME"
  2. Set SMTP_SERVER --> "db2 update admin configuration using smtp_server $NEW_FQDN"
  3. Update all files containing instances of the old name and FQDN: grep -rl ${OLD_NAME} /home/{INST_DIR}".
  4. Rename all files and directories containing old name (see sample code for WebSphere Application Server and WebSphere Portal above).
  5. Reboot the DB2 server machine.
  6. On all clients, update the node settings with new node values:
    1. > db2 uncatalog node {oldServer}
    2. > db2 catalog tcpip node <newNode> remote <newServer> server {serviceName}

Tivoli Directory Server:

  • Perform the same steps as shown in the WebSphere Application Server and WebSphere Portal procedures above.

Operating system:

  1. Set the host name. In Linux, this can be done using: "hostname -v ${NEW_FQDN}" and /etc/HOSTNAME if present.
  2. Update the /etc/hosts file with the new hostname, FQDN, and IP address.
  3. Update the network interface file, for example, /etc/sysconfig/ifcfg-eth0, with the new network settings.
  4. Update the gateway file, for example, /etc/sysconfig/network or /etc/sysconfig/network/routes.
  5. Update the DNS information as required, for example, /etc/resolv.conf.

Question: I am using WebSphere Portal V5 and I want to tell Portal to reload JSP files on the fly. Currently, I have to update the portal application using the administration console each time I make a change.

Answer: To enable automatic reloading of JSPs, do the following:

  1. Open the following file:
    <AppServer>\config\cells\<your_host_name>\applications\wps.ear\
               deployments\wps\wps.war\WEB-INF\ibm-web-ext.xmi
  2. There will be an entry like this (formatted for easy viewing):
    <webappext:WebAppExtension
    	xmi:version="2.0"
    	xmlns:xmi="http://www.omg.org/XMI"
    	xmlns:webappext="webappext.xmi"
    	xmlns:webapplication="webapplication.xmi"
    	xmlns:commonext="commonext.xmi"
    	xmlns:common="common.xmi"
    	xmi:id="IBM_WPS_Ext"
    	reloadInterval="3"
    	reloadingEnabled="false"
    	fileServingEnabled="true"
    	directoryBrowsingEnabled="false"
    	serveServletsByClassnameEnabled="false"
    	preCompileJSPs="false"
    >
  3. Change the parameter reloadingEnabled="false" to reloadingEnabled="true". Caution: This file also contains a <jspAttributes ...> tag with a similar value. Do not change this entry. Stop and start the the server after changing the parameter to true.

Note: There is a performance hit by enabling this option. Make sure that you change this entry only on development and test systems. Do not enable this on production systems.

Question: Is WebSphere Portal and WebSphere Application Server available for my personal training? If so, would you suggest steps that would get me developing/using some of the key features of both? If there is not already one created, I am thinking a quick how to install and maybe quick code drop that contains simple uses of some of the most usable features of WebSphere Portal.

I would like to see the instructions available for Linux (I have Fedora installed now), but would consider another flavor. (submitted by Mike S.)

Answer: Becoming a developerWorks subscriber entitles you to a single user license of almost all the WebSphere products. See the top of this article for more information. If you are not yet a dW subscriber, then you might want to try the following routes.

For WebSphere Application Server, there is a 60-day trial version you can download. Follow the trial link in the lower right of the WebSphere Application Server page.

For WebSphere Portal, there is no Demo version available for training purposes. This is mostly due to the sheer size of the WebSphere Portal product line. There are dozens of CDs that cover many platforms, languages, and custom configurations. A basic WebSphere Portal installation requires a minimum of 4 to 6 CDs. Your IBM Sales Rep might be able to assist you in getting a temporary setup for you.

If you have a valid version of WebSphere Studio Application Developer, or want to download the 60-day trial version located on the developerWorks WebSphere Downloads page, you could then download and install the Portal Toolkit. Be sure to obtain the latest version of both products. I do not know for a fact that you can install the Portal Toolkit onto a trial version of WebSphere Studio, but it would be 60 days of pure portal learning pleasure if you could. Also, both products support Linux. The toolkit has a full working version of WebSphere Portal. Most of the bundled portlets are not included. There is ample documentation to get you going as well.

Neither product supports Fedora Core 1. There are also issues with the later version of glib libraries installed as a Fedora update. To get around this, run this command as root prior to installing each product: export LD_ASSUME_KERNAL=2.2.5. I am personally running WebSphere Studio and the Portal Toolkit on a Fedora Core 1 based system for my development environment.

Finally, for everything portal, go to the WebSphere Portal Zone. It has everything you need to get up and running on WebSphere Portal. I highly recommend Ron Lynn's Hello World articles to get a quick start.

Question: Wondering if you could answer a quick question about installing WebSphere Portal 5.0. I have setup a server and it is currently running WebSphere and DB2 as the database. I am trying to install the WebSphere Portal server by running the install.bat file on my CD. It prompts me for the directory I want to install Portal (I used the default of C:\program files\websphere\portalserver), then it wants to know where I installed WebSphere Portal server, again I used the default of C:\program files\websphere\appserver. The next option is user id and password, I enter one, then it gives me an error: The specified Websphere Application Server location is not valid. The installer will now exit.

Answer: You did not provide enough information for me to give you a strong answer, but it sounds like you are trying to install WebSphere Portal onto an incompatible version of WebSphere Application Server. Also, you did not tell me the version of WebSphere Portal or WebSphere Application Server you are trying to use. You said that you already have WebSphere Application Server using DB2 as its database. This would imply V4.x as V5 does not use a back-end database. You need to install a matching WebSphere Portal V4.x. Mixing versions of WebSphere Application Server and WebSphere Portal will not work.

The only things I can recommend are to carefully go through the installer logs (check the temp directory) for any specific error messages. You might also want to uninstall WebSphere Application Server first, then allow WebSphere Portal to perform the WebSphere Application Server installation as part of the normal install.

Question: How do you run a dynamic EJB-QL query when developing in WSAD 5.1.2?

Answer: Running dynamic EJB-QL queries requires the use of Dynamic EJB Query Service (DQS) bean that is included with WebSphere Application Server Enterprise Edition. Install and use the class files located in installableApps/Query.ear. You can load this ear file into WebSphere Studio and go from there. I did not have time to get this EAR file and test it.

This information is explained in EJB 2.0 Development with WebSphere Studio Application Developer (Redbook), beginning on page 149. Also see the WebSphere Application Server Information Center.

Question: We have a application developed by some other developers than us and it is working fine on Weblogic and Oracle. Now, our task is to migrate it onto DB2 and WebSphere. The other requirement is that we have to configure the application on WSAD. I configured the application on WSAD, but due to certain errors in the code, I'm not able to create a ear thru WSAD. So what I did is that I created a EJB jar and Java™ source jar files thru WSAD and created a war file for the Web content portion using WAS AAT. Then I combined all the 3 files using WAS AAT. Now when I try to deploy it on WAS, it halts the installation of the application at the time of EJB deployment and reports 196 error. Another aspect is when I uncheck the option of deploying the EJB at the time of installation of the application, it deploys and installs the application, but reports the errors when I try to run the application. Please suggest what needs to be run.

Answer: Unfortunately, you did not go into enough specifics to help accurately answer your question. You say there are issues with the code that prevent you from exporting a EAR directly from WebSphere Studio. My guess is that all the other errors you are seeing are indirect manifestations of the same condition. My suggestion is to resolve the issues with the code from within WebSphere Studio first. You do not specify what versions of WebSphere Studio, WebSphere Application Server, or DB2 you are attempting to deploy. Also, ensure that you are not using any vendor specific classes or extensions in either the J2EE or database access code.

Question: I want to get Transaction Manager from WebSphere 5.0 using "java:comp/....". I am getting error like "Unable to enlist resource to the transaction". Also, how to get a list of JNDI names using DumpNameSpace tool. Even though I give the host name and port number, I am not getting the list. Can you please tell me which port number and host name I should give. (submitted by Anand)

Answer: I have not heard of that error message, and without more information, I cannot hazard a guess at any answer. Carefully review the log files for more information.

Depending on what you are looking for, running the dumpnamespace tool will default to the current host (localhost) and port 2809. This is the standard port for JNDI, unless you have altered the port in the WebSphere Application Server profile. Again, without knowing more information such as error messages, I cannot guess as to a resolution. Are you receiving any responses back? You may want to look for external causes, such as an overprotective firewall, or faulty configuration within WebSphere. Go over all the WebSphere Application Server logs and verify that the base environment is functioning correctly.

Question: How to develop multi-language application using JSF in WSAD 5.1.2?

Answer: Java Server Faces use the same JSTL tag libraries as any other proper Web application. To include Internationalization (I18N) support in your Web application, select JSP Tag Libraries under Web Features, and then Internationalization tag library. Inside your JSP, add the proper appropriate taglib statement, bundle definition, and then key requests as shown in the fragment below:

<%@ taglib uri="http://jakarta.apache.org/taglibs/i18n-1.0" prefix="i18n" %>
<i18n:bundle baseName='nls.mte'/>
...
<i18n:message key="greeting.informal"/>
...

This fragment assumes that you have created your language based properties file located in WEB-INF/classes/nls/ as: mte.properties. Each language specific properties file consists of the base name, language definition, and .properties. For example, French would be mte_fr.properties. Each language based property file contains a key line that contains the following:

mte.properties:
greeting.informal = Hello my friend!
mte_fr.properties:
greeting.informal = Bon jour mon ami!

This only scratches the surface of internationalization. You can find information in the WebSphere Studio help, Apache Jakarta JSTL Web page, and Sun® Java tutorial on Internationalization.

Question: I'm trying to connect to DB2 from WSAD. I selected the DB2 V8.1 JDBC driver, but every time I try to finalize the connection, I get an error that says "No suitable driver found". I have verified that the driver is correct and that the source file is valid. What am I doing wrong?

Answer: You are probably using the Type 3 - DB2 APP driver. While this is fine, you should probably be using the latest DB2 Universal Driver. It uses a pure Type 4 driver interface and is better suited for your use. I'll quickly go over the configuration of both driver types.

The problem with using the old DB2 APP driver is that you must have the full DB2 environment configured. In WebSphere Studio, this means that the user must have previously loaded (sourced) the db2profile. Without the full DB2 path and other environment variables set up, you will never get the APP driver working. Here is a snippet of code that I have in a wrapper script for WebSphere Studio to load the DB2 environment during the WebSphere Studio start-up:

[[ -f /home/db2inst1/sqllib/db2profile ]] && ./home/db2inst1/sqllib/db2profile
/opt/IBM/WebSphereStudio/ApplicationDeveloper/v5.1.2/wsappdev51

Once your DB2 environment is configured, you can then create your application driver based connection from within WebSphere Studio.

Database vendor type:
DB2 Universal Database V8.1
JDBC driver type:
IBM DB2 APP driver
Class location:
/home/db2inst1/sqllib/java/db2java.zip

To use the Universal DB2 Driver connection, you do not need to configure any environment variables for WebSphere Studio. Create your database connection as shown below. Note that you need to load two files into the class location:

Database vendor type:
DB2 Universal Database V8.1
JDBC driver type:
BM DB2 Universal driver
Class location:
/home/db2inst1/sqllib/java/db2jcc.jar:/home/db2inst1/ sqllib/java/db2jcc_license_cu.jar

If you receive errors relating to connecting or I/O, verify your user ID, password, server name, and connection port. The default connection port is 50000, but this is frequently changed. Verify the port with your DB2 administrator. Also, another common issue is that your firewall may be blocking requests on the desired port.

Another hint is to make sure that you CLASSPATH does not have any legacy DB2 connection jar files prior to the db2jcc.jar file, as they may cause connection troubles.

Question: Can I connect WSAD to a CVS server running SSH2 authentication?

Answer: Currently, SSH2 is not supported from within WebSphere Studio. I believe that the latest versions of Eclipse do include SSH2 support. WebSphere Studio native support should follow suit in the near future. There is also a SSH2 plug-in available for Eclipse, but it requires a 1.4 based JRE, and that has caused incompatibility problems within WebSphere Studio when I tried to use it. To support SSH2 with current WebSphere Studio versions, externalize the solution by using a SSH agent. The procedures below are written for a Linux environment, but you can adapt them for a Windows platform too. For Windows, you need a good SSH adapter. PuTTY is a good freeware product that supports this configuration.

  1. Create a key for your machine:
    1. > ssh-keygen -t rsa
    2. Accept the default file id.
    3. Optionally put in a pass phrase. Note, adding a pass phrase requires you to reenter it when starting WebSphere Studio.
  2. Update your authorized keys file on the CVS server. Note, this assumes that CVS is using system user level authentication.
    1. Log into the CVS server.
    2. Add your SSH public key to the authorized keys file. Files names may differ slightly.
      1. Contents of the public key on the local server: ~/.ssh/id_rsa.pub
      2. Add to file on server: ~/.ssh/authorized_keys
      3. Ensure there are no line break except between keys.
      4. The key should look like: ssh-rsa {Long random string of characters}={youruserid@yoursystem.yourdomain.com
  3. Connect to the cvs server from a command prompt:
    1. > ssh cvsserver.yourdoamin.com
    2. You should not be asked for your password.
  4. Start WebSphere Studio under an ssh environment. You may want to add this to a generic wrapper script for WebSphere Studio.
    1. > ssh-agent /opt/IBM/WebSphereStudio/ApplicationDeveloper/v5.1.2/wsappdev51
    2. If you opted to use a pass phrase, a window pop-up prompts you for it.
    3. Note: It is also a common practice to put your entire X session under the ssh-agent control, which makes this step unnecessary.
  5. Verify the general CVS settings in WebSphere Studio:
    1. Select Window --> Preferences.
    2. Select Team --> CVS --> Ext Connection Method.
    3. Verify the following settings:
      1. CVS_RSH: ssh
      2. Parameters: {host} -l {user}
      3. CVS_SERVER: cvs
      4. Click Apply if you made changes, and then OK.
  6. Configure your WebSphere Studio CVS connections to use SSH2.
    1. Select Window --> Open Perspective --> CVS Repository Exploring.
    2. Create a new CVS connection.
    3. Set the connection properties as shown below:
      1. Host: cvsserver.yourdomain.com
      2. Repository path: {Path-To-CVS-Repository}/{Your-CVS-Module-Name}
      3. User: {your cvs id}
      4. Password: [leave blank]
      5. Connection type: ext
  7. Assuming everything is setup correctly, you can browse and work with your CVS projects without password pop-ups.

Question: When I am trying to access the Oracle® 9i database, I get the following exception:

java.sql.SQLException: DSRA9002E: ResourceException with error code null: javax.resource.ResourceException: addSync: caught Exception

This exception is not reported consistently. Can you please advise what could be the problem? I am using WebSphere 5.0 and an Oracle thin driver.

Answer: This is likely an authentication level error. You did not say if this error occurs from within WebSphere Studio or once deployed on WebSphere Application Server. See Adding a Oracle9i DataSource from WSAD5 for a description on configuring an Oracle Datasource in WebSphere Studio.

Verify that you are using the correct JNDI DataSource name (for example, jdbc/OracleDS), and that you have configured the proper ID and password in JAAS. You imply that this is an intermittent error, are you attempting to cache your JNDI context? If so, this may be causing some issues.

Question: I am a developer who has many years of experience on the AS400, most of which doing OPM development. I also spent several years between 1995 and 2000 doing Client Server, Web and Java development on Windows and Linux OS. I'm back on the AS400 and I am diving into WebSphere. I am wondering, within the Web Perspective in WebSphere, when designing a page, is there any way to just point controls to the iSeries DB2 database tables to load the controls (like a listbox, text area, etc) straight from the data in the DB2 table? It seems as though I cannot and must develop an RPG or COBOL program to access the data.

Answer: If you want to go full bore into the bleeding edge of application development, then you should look into using Java Server Faces (JSF). Within a JSF JSP file, you can easily create a database driven select list. Search the WebSphere Studio help for Data Access Beans and WDO to get started.

Having said that, I personally dislike having any business style logic defined in the JSP pages, as it breaks the classic Model-View-Controller (MVC) design. I also do not care for the results of the automatically generated data access beans. It is much cleaner to have a business logic class (Model) called from your servlet/portlet (Controller) that performs a database query (JDBC/Datasource) and stores the results in a standard Javabean. This object is then placed onto the request, session, or application scope as appropriate. The JSP (View) then obtains the object data bean and presents the data as a list or select box as needed. This model has proven to be easy maintain.


Related information

About Meet the Experts

Meet the Experts is a monthly feature on the developerWorks WebSphere Web site. We give you access to the best minds in IBM WebSphere, product experts and executives, who are waiting to answer your questions. You submit the questions, and we post answers to the most popular questions.

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=14519
ArticleTitle=Meet the Experts: Karl Bishop on WebSphere Portal and Linux
publish-date=06162004