Publishing portal artifacts from IBM Rational Application Developer V7 to
by user
Comments
Transcript
Publishing portal artifacts from IBM Rational Application Developer V7 to
Publishing portal artifacts from IBM Rational Application Developer V7 to IBM WebSphere Portal Server V6 Part of a series on portal and portlet development By Kapil Gambhir Software Development Engineer IBM Corporation Level: Intermediate August 2007 Publishing portal artifacts from Rational to WebSphere software, Page 2 of 18 Contents Introduction ..................................................................................................................... 3 Integrated development................................................................................................... 3 Publishing........................................................................................................................ 3 New integration features ................................................................................................. 4 Ease of use.................................................................................................................. 4 Full-function portal server ............................................................................................ 4 Easy server configuration ............................................................................................ 4 Sensing server state .................................................................................................... 5 EAR publishing ............................................................................................................ 5 Miscellaneous new features ........................................................................................ 6 Publish options ................................................................................................................ 6 Creating a server ......................................................................................................... 7 Export portal or portlet ................................................................................................. 9 Run on server (ROS) ................................................................................................... 9 Deploy ....................................................................................................................... 11 Run on Server (ROS) versus Deploy......................................................................... 14 Troubleshooting ............................................................................................................ 16 Other articles in this series ............................................................................................ 17 Resources ..................................................................................................................... 18 About the author............................................................................................................ 18 Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 3 of 18 Introduction IBM® Rational® Application Developer Version 7 (and later) has introduced many new features to enhance your development experience, and it provides you diverse benefits while you are working with portal and portlet projects. These features are so useful that you may find yourself virtually compelled to move up the version ladder (both for Rational Application Developer and IBM® WebSphere® Portal Server (Versions 5.1.x and later)). This article discusses the key benefits of using this combination, and then goes into detail explaining various options available to you when you want to publish these artifacts from Rational Application Developer to WebSphere Portal Server. It will also identify the recommended publishing option for pertinent use cases. Finally, it will provide some troubleshooting tips for you (the developer) to resolve some common issues on your own. Integrated development The combination of Rational Application Developer and WebSphere Portal provides a true integrated development environment (IDE). A development environment is not really qualified to be called integrated until you can deploy resources created in it to a server. This integration helps you as a developer operate at various levels from within the same environment, and thus avoiding switching in and out of your current environment. Rational Application Developer provides the facility to publish portal and portlet projects to WebSphere Portal Server on a local or remote server, on all supported server environments. Publishing Rational Application Developer has introduced new features to operate smoothly with WebSphere Portal runtime (server) V6. The foremost and most critical is providing a full-blown portal server with Rational Application Developer installation, which you can use on the developer machine to develop all the features that the portal application supports. Rational Application Developer provides you full-featured support for creating portal and portlet artifacts, and the ability to publish complements this by deploying these artifacts to the server. There are multiple options available to publish these artifacts, some of which are specifically designed (from scratch) and available in Rational Application Developer, and others that derive from the underlying stack of eclipse projects (specifically, the Web Tools Platform or WTP project) but have been customized and extended for WebSphere Portal Server. The features not only provide a better overall user experience with the product, but also result in better productivity by facilitating an integrated approach to developing portal and portlet applications. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 4 of 18 This article primarily focuses on the combination of Rational Application Developer and WebSphere Portal Server, as publishing options broadly remain the same for WebSphere Portal 5.1 with Rational Application Developer. Rational Application Developer is a featured subset of IBM® Rational® Software Architect, so unless specifically mentioned, all the information in this article also applies to Rational Software Architect V7. New integration features From a version perspective there are critical changes introduced in Rational Application Developer, and it is important to understand these changes to derive the maximum benefit out of the tool. Ease of use The use of a single server type (for V6) has simplified the user experience compared to having three different server types for 5.1.x, as shown in Figure 1. Rational Application Developer now takes care of these intricacies internally, depending on the operation and location of the server being targeted. The functionality of the old test environment will still remain but will only be enabled for a local host. Figure 1. V6 introduces a single server type Full-function portal server The actual test environment is equivalent to a full-blown instance of WebSphere Portal Server from a functional perspective, and scripts are available to make this server a minimized version from the perspective of providing less featured portlets to reduce startup time and memory consumption (see the Resources section for more details). This in turn has huge benefits for the developer, because you can build and test the applications in a local environment with Rational Application Developer. Note: These scripts are only meant for development use and should not be used for a production server, because they use some internal flags that are not supported. Easy server configuration As both types of servers are essentially going to be similar, the server configuration is reduced to a more manageable 3 tabs (shown in Figure 2), instead of around 14 in Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 5 of 18 earlier versions. From a user experience perspective, all administrative tasks are carried by the admin console or the portal administration portlets. Figure 2. Server configuration This reiterates the advantage of having a full-blown (normal) server, because it provides a uniform way of managing server-specific configurations through its admin console. Rational Application Developer's specific configuration, which is required for interacting with the portal, is still kept in the Rational Application Developer server configuration. For all other EAR configuration-related activities, you can edit the application.xml (accompanying the corresponding EAR project) to change the EAR level settings (like ClassLoader_Mode). Sensing server state Rational Application Developer is able to sense the state of the server started outside it (even for a local server), and the startup need not be initiated from within Rational Application Developer. For a remote server, it still requires the server to be started already for it to sense its current state. In addition to this, the server need not be restarted for many changes to take effect, which provides a major gain in productivity. This is a huge improvement, and it means that you do not need to re-start the server every time you make changes or even if you switch or delete a workspace. This feature isolates the lifecycle of the WebSphere Portal server from Rational Application Developer. EAR publishing Portal artifacts (portal and portlets) are now published at the EAR level, unlike the earlier version in which, for remote servers, WAR publishing was the only type allowed. Now, developers can publish their EAR-level artifacts from Rational Application Developer itself, and all Java™ 2 Platform, Enterprise Edition (J2EE) level configuration and artifacts can be deployed from within Rational Application Developer for a portlet project. This is a big gain from an integrated environment perspective. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 6 of 18 Miscellaneous new features Other new features include these useful abilities: • Secure file transfer (out of the box). Files published from Rational Application Developer to the server are performed over a secure channel. • IBM® WebSphere® Application Server Version 6.1 has a portlet container as part of its runtime, and Rational Application Developer supports it as the target runtime for JSR (Java Specification Request)168 portlets. • The Restore original artifacts operation (available when you right-click the portal server created in Rational Application Developer, and shown in Figure 3) returns the original wps.ear (shipped with the portal server during installation) and basically undoes changes made to a Portal’s artifacts (theme, skin, and so on) for both local and remote servers. Figure 3. Right-click the portal server to access these commands • The Open portal command (also shown in Figure 3) brings up the Home page of the portal server. • Use the Initalize server status command (right-click the portal server created in Rational Application Developer) to sense the status of the server if it is not sensed already. • Settings for locally installed servers are automatically detected by the new Server wizard. While creating a new local WebSphere Portal Server, only the user credentials need to be provided. Other information is automatically picked up. • Rational Application Developer’s Console view shows server log output for both local and remote servers. • Full XML Access logging shows all XML Configuration communications between Rational Application Developer and WebSphere Portal Server. • The Project wizard that creates a new portal project also detects the locally installed server version. Publish options Rational Application Developer supports various options to publish applications to the server. Primarily they are segregated into the following categories: • Export • Run on Server • Deploy Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 7 of 18 Creating a server For you to be able to publish the artifacts and resources to the server, you need to create a server that will hold information required by Rational Application Developer to interact with the server. To create a server, perform the following steps. 1. Navigate to the New wizard and choose Server, or right-click the Server view and select New > Server. Choose WebSphere Portal v6.0 Server, as shown in Figure 4. Figure 4. Creating a new server This requires that WebSphere Portal Server is present as an installed runtime, which is automatically taken care of when you install WebSphere Portal Server on a machine that has Rational Application Developer installed on it. 2. After you select the server, click Next, and then provide the WebSphere credential and network port details for connecting to the server, as shown in Figure 5. Figure 5. Enter the WebSphere settings for the new server 3. Supply this information, then click Next and specify the WebSphere Portalspecific values, including the portal server credentials, as shown in Figure 6. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 8 of 18 Figure 6. Enter WebSphere Portal settings for the new server 4. The final window involved in this process is where you specify the information related to transferring the files to the portal server, as shown in Figure 7. There are two options available here. Either map or specify the folder of the server directory in the local machine (it is a remote machine), or (if it is a machine for which file systems cannot be mapped) specify the FTP details for the same. Figure 7. Specify setting to transfer files to the portal server Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 9 of 18 Export portal or portlet This is the manual option to publish the applications and projects from the Rational Application Developer workspace to WebSphere Portal Server. It creates a portal deploy set (a set of files) which uses a combination of XML Configuration interface and wsadmin script to publish the portal to WebSphere Portal Server. For portlets, you can export WAR or EAR files to the portal server and can be installed on the server like any other archive file. 1. This is achieved by selecting File > Export > Portal Project Deploy Set, as shown in Figure 8. You may also select Portal Project Deploy Set in the Export wizard. 2. Click Finish after providing the relevant details for the portal. Figure 8. The Portal Project Deploy Set 3. Specify the Portal EAR name (the file is created with this name), destination, and the server to which this project is targeted, as shown in Figure 9. Figure 9. Portal EAR details Run on server (ROS) This is a feature inherited from the Eclipse WTP project that has been enhanced and customized for WebSphere Portal Server. So the user experience and the UI are leveraged from the WTP project. This is an automatic publish feature wherein the artifacts and the configuration are published to the server. This is applicable for both portal and portlet projects. 1. Right-click the project and select Run on Server, as shown in Figure 10. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 10 of 18 Figure 10. Selecting Run As > Run on Server 2. Choose the server to which the project needs to be deployed, as shown in Figure 11, then click Next. Figure 11. Choose the type of server to create 3. Choose the EARs that need to be published, or removed from the server if already published, and click Finish, as shown in Figure 12 Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 11 of 18 Figure 12. Modify the projects that are configured on the server Deploy This feature (option) has been built especially to suit the portal and portlet publishing, and has been built wholly within Rational Application Developer. This is also another automatic publish option available in Rational Application Developer. This option is more feature-rich, as it provides various permutations and combinations with regard to deployment options. This is also applicable for Portal and Portlet. 1. Right-click the project and select Deploy Portal or Deploy Portlet, as shown in Figure 13. Figure 13. Deployment options 2. Select the server to which Portal deploy is intended, and click Next, as shown in Figure 14. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 12 of 18 Figure 14. Select or create portal server The Deployment options available here (at the bottom of the window shown in Figure 14) refer to whether you desire a full deployment (configuration and files), or just the configuration itself. Full deployment publishes the artifacts first (that is, the J2EE resources), and then the configuration (which just points to the portal configuration describing the layout and navigation of the portal site). If there is no change in the artifacts, and only the configuration has changed, choose the second option because it will be much faster. 3. Click Finish to start deploying a portal, as shown in Figure 15. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 13 of 18 Figure 15. Select which portlet projects to deploy The first grid in this dialog provides you the option to choose which portlets you desire to deploy, along with the Deployment recommendation and information about the current status of the portlet on the server (that is, if the portlet is available on the server then it is marked as Optional, else it is marked as Must Deploy). For portlets that are not present on the server, it mandates deploy and doesn’t allow you to clear the selection. The second grid additionally provides you the option to mark a portlet as a WSRP (Web Services for Remote Portlets) producer. This is a new feature in Rational Application Developer. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 14 of 18 The Portlet Overwriting option facilitates different choices to overwrite an existing portlet on the server. It is recommended that you use the Update method because that retains other settings you have chosen on that portlet on the server. The UI for Deploy portlet is also similar and provides similar option for a portlet. Run on Server (ROS) versus Deploy Both these options facilitate automatic publishing of resources, but the difference lies in the detail. Deploy is used to publish the artifact and configuration (in case of portal) to the server, and to register the EAR with the server. Deploy provides a more feature-rich option of choosing the portlets to be deployed and used to publish the whole package to the final, production, or staging server. It is more time-intensive because it goes into comparing the current portal configuration on the server with the Rational Application Developer workspace and, depending on the differences in the two, takes appropriate actions. It gives priority to the resources present in the workspace, and thus deletes all those present on the server but not on the workspace. It creates resources on the server that are not present on the server, and also retains the settings of the resources that are present both on the workspace and the server. ROS, on the other hand, not only registers the EAR with the portal server, but also creates page on the portal server on which it places the portlet (for which ROS is executed). The created pages and the label used are configurable, and are driven from the values given in the server configuration. It extends the current portal configuration by adding these labels and pages to the existing configuration (layout): even the ordinal of the pages can be specified. ROS brings up the browser to display the portlets or portal after completing the publish, which helps you visualize the UI of the artifact or portlet under development. Figure 16 shows portlet publishing options that are available as part of a second tab in server configuration. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 15 of 18 Figure 16. Publishing settings for portlet projects From a scenario perspective, ROS is typically used for development, where a developer is interested in publishing and debugging the incremental changes (of the portlet) to the server (which, ideally, is a local WebSphere Portal Server). ROS is an option that developers have experienced in Eclipse (as part of WTP), and thus they are more comfortable using the interface. The hot swapping feature is available in the ROS option for a local server. It allows you to see the changes done to non-configuration files with a refresh of the browser (an internal Rational Application Developer one) for the incremental publish. For the local server, you also have the option to specify whether the resources should be used from the workspace (which enables the hot swapping), or if they should be sent to the server for publishing, as shown in Figure 17. Figure 17. Modify the publishing settings ROS is a collective action involving Adding and Removing Projects on the server, invoking a publish on the server, and then right-clicking the server and select the Open Portal option. Figure 18 shows some of the sample timings that were recorded for various options to publish the portal artifacts. You should look at them from a relative perspective and not an absolute perspective. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 16 of 18 Figure 18. Time to complete operations given certain options Operation Project type Local server Remote server 2 min 20 sec 1 min 47 sec Basic portlet second attempt with a Java™Server Page (JSP) change 7 sec 1 min 13 sec Portal project having basic portlet first attempt 3 min 50 sec 3 min 40 sec Portal project having basic portlet second attempt 2 min 37 sec 3 min 11 sec Basic portlet first attempt 12 sec 34 sec Basic portlet second attempt with JSP change 10 sec 31 sec Portal project having basic portlet first attempt 1 min 38 sec 2 min 17 sec Portal project having basic portlet second attempt 1 min 24 sec 2 min 2 sec Run on Server Basic portlet first attempt Deploy As you can clearly see, ROS is more suited for a development environment, wherein the incremental changes can be not only published to the server but also visualized along with it (which takes the major chunk of the time, especially in the first publish). Deploy is ideal for a scenario wherein you do not intend to visualize the changes, and you are fine with just the deployment of the artifacts to the server. Troubleshooting With publish the artifacts are deployed to the server, and it is important that the environment is correctly set up for it to work seamlessly. Following are some of the tips which you should keep in mind to ensure that publish is under control. As a general guideline, if the server is complaining about some failure (publish failure or any other publish related error), you are advised to delete the server instance from Rational Application Developer (it is critical to clear the Stop the Server option, the last checkbox) and then re-create the server. This process by itself does a lot of background housekeeping jobs to ensure that the server image is in synch with all that is available. If any artifact is deployed using ROS for a local server, and that artifact is deleted or renamed (for instance, the workspace which has that project is deleted or renamed), then it is required that the server configuration is cleaned up to get rid of this reference. As mentioned earlier, as the server’s lifecycle has been isolated from Rational Application Developer’s lifecycle, the new server created would be able to sense the server state automatically (or you can explicitly ask it to do so by selecting the option Initialize Server State on the server pop-up menu. In an ideal scenario it is recommended that you disassociate the project (using the Remove Projects option in the server pop-up menu) from the server if your intent is to take it off of the list of published applications on the server. This would keep the server configuration clean. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 17 of 18 In case of a remote publish, ensure that the host name given at the time of server installation (which is available in <profile_dir>\config\cells\<cell_name>\nodes\<node_name>\serverindex.xml) is reachable from the local machine (which is hosting Rational Application Developer). Ensure that the default browser can ping the server, because Rational Application Developer uses the browser settings for some of the connections. In addition, if a proxy name that cannot be reached is mentioned in the browser, then the connection in Rational Application Developer will also fail. As a test environment, there are remote chances that the portal server will become corrupt. To avoid potential rework, it is advisable to keep a backup of the portal configuration (basically the directory hosting the cloudscape, or the database chosen to do so) and the profile directory. Ensure that the port numbers are correctly specified. These are critical in finding the state of the server, and for the ongoing interaction with the server. Other articles in this series Check the One-stop guide to portal and portlet application development using Rational Application Developer V7 and WebSphere Portal V6 for summaries of the nine other articles in this series and links to download each of them in PDF format. Topics covered include the predevelopment resources, portlet tooling features, portal design tools, and the testing, deploying, and debugging capabilities of Rational Application Developer. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®. Publishing portal artifacts from Rational to WebSphere software, Page 18 of 18 Resources Learn • • • • • • • Discuss • Get information on IBM Rational Application Developer and how to use it: o What's new in IBM Rational Application Developer V7.0 o IBM Rational Application Developer Version 7.0 Information Center o Rational Application Developer page on IBM® developerWorks® For product documentation for WebSphere Portal, visit the IBM WebSphere Portal Version 6.0 Information Center Find out What’s new in WebSphere Portal Version 6. This developerWorks article by Stefan Hepper, Stefan Liesche, Gregory Melahn, and Thomas Stober (July 2006) describes the highlights in IBM® WebSphere® Portal Version 6.0. You see how WebSphere Portal helps you create a serviceoriented architecture (SOA) environment, and you learn about the technical enhancements that speed up your development projects, providing quick business value and ease-of-use. This article is as a good starting point to understand the version content and the improvements since the previous releases. Find out how to tweak a portal server for local installation, Installing and configuring WebSphere Portal V6.0 Servers for development with Rational Application Developer V7.0 and Rational Software Architect V7.0. Consult XML Configuration interface: Reference. Visit the Rational page on developerWorks to find technical resources and learn about best practices for the Rational Software Delivery Platform. Subscribe to The Rational Edge weekly newsletter. Participate in the Rational Software Architect, Data Architect, Software Modeler, Systems Developer, Application Developer and Web Developer forums and the WebSphere Portal forum, where you can ask questions, share your experiences, and discuss problems and solutions. Get software • Get the evaluation version of Rational Application Developer. • Get WebSphere evaluation versions from the WebSphere downloads page. About the author Kapil Gambhir is the Technical Lead for the Portal Tooling component in Rational Application Developer in the WPLC group at the IBM India Software Labs in Delhi, India. He has 11 years of experience in the IT industry and has experienced a wide gamut of technologies, industries, and platforms. He has a keen interest in the latest and most disruptive technologies. Copyright © 2007, IBM® Corporation. All rights reserved. Published by IBM® developerWorks®.