Thursday, February 23, 2017

Things To Do When Upgrading To A New Version Of RSAD

This is an addendum to this post: http://john-zhou.blogspot.com/2016/04/instructions-for-installing-rational.html. Recently I found a need to upgrade from RSAD 9.5 (Rational Software Architect Designer) to 9.6. This version of RSAD is based on Eclipse Neon and contains an improved Javascript validator along with other features.

First I want clarify that you should uninstall the previous version of RSAD otherwise Installation Manager will prevent you from progressing. After uninstalling you will also have to remove C:\Program Files\IBM\SDP (the location where you installed RSAD) or else Installation Manager will stop your progress. You should also keep track of any Eclipse plugins you have installed (like MercurialEclipse and TestNG) because you will probably also have to reinstall them.

After your installation your desktop shortcut might still contain "C:\Program Files\IBM\SDP\eclipse.exe" -product com.ibm.rational.rsa4ws.product.v95.ide in the Target field. I recommend changing it to v96.

In your local WAS there will be a few changes that you will need to make. For example if you are using DB2 you will probably have to modify a Websphere variable. In your WAS Administrative Console go to Enviroment->WebSphere variables. Under DB2UNIVERSAL_JDBC_DRIVER_PATH change the value from "C:\Program Files\IBM\IBMIMShared\plugins\com.ibm.datatools.db2_2.2.200.v20150728_2354\driver" to "C:\Program Files\IBM\IBMIMShared\plugins\com.ibm.datatools.db2_2.2.202.v20161026_1643\driver" which are the new drivers installed with this version of RSAD.

If you're running WAS 8.5 you will probably need to set your Compiler compliance level to 1.6 since it defaults to 1.8. This is unnecessary if you have IBM SDK 8 installed or are using WAS 9. You can find the setting in Preferences->Java->Compiler.

Thursday, November 3, 2016

My Experience Converting From CVS To Mercurial

At first I tried to directly convert from CVS to Mercurial using http://hg.gerg.ca/cvs2svn with the command:

./cvs2hg --encoding=cp1252 --hgrepos hgrepository /path/to/cvsrepository

but that only resulted in an empty directory.

In my next attempt I decided to convert from CVS to SVN and then from SVN to Mercurial. With that in mind, I used http://cvs2svn.tigris.org/ for the CVS to SVN portion.

I had an issue that led me to cleaning up some files in my CVS repository. This was mostly likely caused by a file being deleted in CVS and then being created again. This led to one file having two different histories. When running the CVS to SVN conversion I had to add the parameter --encoding=CP1252 due to how our source repository was encoded.

In the SVN to Mercurial conversion I used Mercurial's ConvertExtension. I also had to install Subversion's Python bindings: https://bitbucket.org/tortoisehg/thg/wiki/libsvn. After running "hg convert svnlocation" it succesfully generated a Mercurial repository with the history intact.

Going back to the original cvs2hg conversion, it turns out that what I thought was a empty directory was not in fact empty. The issue was that the OS was hiding the .hg directory from me so it actually did generate a Mercurial repository. This is good because the resulting history is better than the one I got from doing the CVS to SVN to Mercurial conversion.

From this point forward all I have left to do is pick and choose which projects I want to bring over and trim some of the branches that were carried over from the CVS repository.

Thursday, April 28, 2016

Castor and Castor Mapping

When using Castor it will parse your castor mapping xml linearly. For example if you had this class structure:
package com.sample.ixml;
public Sample {
     SubclassB sB;
}
public class SubclassB extends SuperclassA {
     String strB;
}
public class SuperclassA {
     String strA;
}  

Along with this xml castor mapping:

<class name="com.sample.ixml.Sample">
     <map-to xml="Sample" />
     <field name="sB" type="com.sample.ixml.Sample">
          <bind-xml name="SubclassB" />
     </field>
</class>
<class name="com.sample.ixml.SubclassB" extends="com.sample.ixml.SuperclassA">
     <map-to xml="SuperclassB" />
     <field name="strB" type="string">
          <bind-xml name="StrB" />
     </field>
</class>
<class name="com.sample.ixml.SuperclassA">
     <map-to xml="SuperclassA" />
     <field name="strA" type="string">
          <bind-xml name="StrA" />
     </field>
</class>

It will trigger an exception with the message "forward references are not supported". In order to fix this you have to reorder your mapping so that it looks like this:
<class name="com.sample.ixml.Sample">
     <map-to xml="Sample" />
     <field name="sB" type="com.sample.ixml.Sample">
          <bind-xml name="SubclassB" />
     </field>
</class>
<class name="com.sample.ixml.SuperclassA">
     <map-to xml="SuperclassA" />
     <field name="strA" type="string">
          <bind-xml name="StrA" />
     </field>
</class>
<class name="com.sample.ixml.SubclassB" extends="com.sample.ixml.SuperclassA">
     <map-to xml="SuperclassB" />
     <field name="strB" type="string">
          <bind-xml name="StrB" />
     </field>
</class>

Tuesday, April 19, 2016

Asynchronous script and document.write

While trying to fix an issue with script.aculo.us I discovered that document.write doesn't work with asynchronous scripts (defer="defer" or async="async" script attributes). script.aculo.us was using that function in order piggy-back load other javascript files. For example, scriptaculous.js?load=effects,dragdrop where document.write will import effects.js and dragdrop.js. Unfortunately browsers will ignore it because it's detached from the document so they don't know where to place it or when to process it. My solution was manually load the javascript files that script.aculo.us needed.

Thursday, April 14, 2016

Upgrading WebSphere Application Server To Java 7

Due to migrating from JSF Beans to CDI Beans I needed to upgrade IBM WebSphere Application Server 8.5.5.9 to run the Java 7 SDK. First you have to download IBM Rational Application Developer for WebSphere Software V9.0 Multiplatform Multilingual - IBM WebSphere SDK Java (TM) Technology Edition V7.0 for WebSphere Application Server V8.5.5 Evaluation. Next extract the files and for your installation convenience move the disk folders to WAS855JDK7.

Next open IBM Installation Manager, go to File->Preferences, and add a respository which should point to the diskTag.inf in your disk1 folder. Back in the Installation Manager main menu, click Install, check IBM WebSphere SDK Java Technology Edition (Optional), click Next. In the next screen be sure to select the package group WAS is installed in, then click Next, and Install.

Next open Rational Software Architect Designer, go to Window->Preferences, go to Server->Runtime Environments, select your WAS, click Edit, change your runtime to JRE 1.7, 64 bit. and click Finish.

Also if you have a pre-existing profile on your server, use these instructions http://www-01.ibm.com/support/docview.wss?uid=swg21671938 to migrate it from 6 to 7.

Friday, April 8, 2016

Switching JSF Implementations In Rational Software Application Designer

While testing our webpages after upgrading Rational Software Application Designer and Websphere Application Server a few problems cropped up such as broken link navigation. After comparing webpages from a WAS 8.5 localhost server and a WAS 7.0 dev server I noticed that they were generating html and java script code differently. I suspected that they were using different JSF implementations and after taking a look at each JSP and JSF options I discovered that the WAS 8.5 server was running DEFAULT (MyFaces2.0) and the WAS 7.0 server was running SunRI1.2. It was probably basing the default on our web.xml which is troubling because it means we might be attempting to run two different JSF implementations for our application. But that is an issue to be resolved another day.

Anyway, in order to fix this I used this IBM article that details instructions on how to change JSF implementations in RSAD: http://www-01.ibm.com/support/docview.wss?uid=swg21385515. The basic gist is that you need to double click your server to go to Overview and check the option "Run server with resources on Server". Then go to Enterprise Applications>"EAR project">"JSP and JSF options" and set your JSF implementation which in our case was SunRI1.2. Afterwards there will be some degree of cleaning out builds and caches. If you see issues I recommend clearing out C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\''WAS profile"\temp\"node name"\"server name"\"EAR project".

Wednesday, April 6, 2016

Instructions For Installing Rational Software Architect Designer and Websphere Application Server

Download, extract, and install the latest version of IBM Installation Manager. In this case that will be version 1.8.4.1 64-bit. If you already have an older version of Installation Manager then in all likelihood you will be forced to uninstall it because there might be conflicts. Uninstalling Installation Manager might necessitate uninstalling any IBM products that are incompatible with a newer version of the Manager. If you uninstalled RSAD (Rational Software Architect Designer) or WAS (Websphere Application Server) then you will also have to delete C:\Program Files\IBM\SDP and C:\Program Files\IBM\SDP\WebSphere and/or C:\Program Files (x86)\IBM\SDP and C:\Program Files (x86)\IBM\SDP\WebSphere in order to remove any excess files the uninstaller didn't catch.

Download and extract the latest version of IBM Rational Software Architect Designer for Websphere Software. In this case it will be 9.5.0 64-bit. Out of convenience place your disk1 and disk2 folders inside your RSA4WS_SETUP folder if you have downloaded them as zip files. That way you won't get prompted during the installation process to point to the location of disk1 and disk2.

Next open Installation Manager and go to File->Preferences. Here we want to "Add Repository..." and have it point to the location of repository.config in your RSA4WS_SETUP folder. Next we want to add a second respository and have it point to http://www.ibm.com/software/repositorymanager/com.ibm.websphere.BASE.v85 so we can download updates for our software. There will be a user name (IBM ID) and password prompt in order to download updates. In the next prompt uncheck master password.

Back in the main menu click on Install. In the next window toggle which products you want to install. In this case we will be only installing RSAD 9.5. Click Next, Next, accept the terms, and Next. In the next screen create a new package group if you don't already have one for 64-bit installations.

Click Next and Next. Now in additional to the default features we want to add some additional items to our installation. For this specific installation the easiest way to do this is to select "Architect - Minimal", "MDD for Java - Standard", and "Service Architect". Selecting the dependencies is unnecessary. The Manager will automatically include it as part of the install process. We also want to install the server tools for Websphere Application Server 8.5. You don't need to install the stub if you plan to install WAS 8.5 locally. In addition we will also be installing all of the "Code development and quality tools" and Maven Tools. Then Click Next.

Click Install. Once the installation is done we will need to apply a license. Go back to the main menu of Installation Manager. "Manage Licenses" Toggle "Import product Activation Kit" and click Next. Click on Browse and find the RSA4WS95_Lic.jar in your RSA4WS_v9.5_Activation_Kit folder. Click Next, accept the terms, and Finish.

Next we will install IBM WebSphere Application Server. Download and extract the latest version of WAS. In this case it will be 9.5.0 64-bit. Out of convenience place your disk1 and disk2 inside your WAS855 folder if you have downloaded them as zip files for the same reason we did it for the RSAD installation. Next open Installation Manager and add a new repository pointing the location of diskTag.inf in your disk1 folder.

Back in the main menu click on Install. Select IBM WebSphere Application for Developers in Installation Packages, Click Next, accept terms, and Next. Here we will check all fixes except for WinX32 (since we are installing the 64-bit version) and older fix packs that will trigger conflicts (in this case that will be IFPI56377). In this next screen create a new package group, then click Next, and Next. In Features, make sure IBM 64-bit WebSphere SDK for Java is checked, then click Next.

Once the installation is done we will configure RSAD and WAS. Open RSAD and if you are using an existing workspace you will have to go through a migration process to update them. In the Workspace Migration menu accept the default suggestions, click Next, Next, and Next.

If this is your first time you will get a prompt to create a server. If necessary, uncheck the requirement for admin name and password and accept the defaults. In your "Java EE" Perspective and go to your Servers tab. Right click on the server and in the context menu go to "Add and Remove...". Highlight your EAR project and click Add and Finish.

Otherwise in order to create a server open your "Java EE" Perspective and go to your Servers tab. In the right click context menu, go to New->Server. Select Websphere Application Server v8.5 and click Next. It will probably prompt you for the location of your JRE. Browse to C:\Program Files (x86)\IBM\WebSphere\AppServer and click Next. If necessary, uncheck the requirement for admin name and password and accept the defaults. Click Next to go to the "Add and Remove..." screen. Highlight your EAR project and click Add and Finish.

Next right click on the server and Start. Right click on server, Administration, "Run Administration Console". In here is where you will have to configure your bus, destinations, connection factory, queues, activation specifications, data source provider, and so forth. We won't go into detail on this because it is user specific and rather involved.

I want to add that if you double click on your server in the Servers tab you will open up an overview. I recommend going to your Publishing settings and toggling "Never publish automatically". It will remove a major annoyance that will often crop up while you work. Make sure to save so your changes will go into effect.

Lastly note that if you are running a application-managed enviroment you will need to run wsenhancer.bat when building your files in order to inject necessary bytebode into your JPA entities. This file can be found in C:\Program Files (x86)\IBM\WebSphere\AppServer\bin. I recommend setting it up in "External Tools Configuration" and set your Working Directory to ${workspace_loc:/"location of project"/"location of entities"}