Installing Apache Roller using a Virtual Application Pattern, Part 1
JayAllen 120000G6WH Visits (5038)
As we mentioned in a previous entry on JSPWiki, we’ve used a bunch of open-source Java applications in developerWorks over the years. Sticking with the theme of open-source social networking, we chose Roller as the next application to install as a Virtual Application Pattern or VAP.
Roller is great for a second application because like JSPWiki, it’s encapsulated in one web application file but it also requires a database. So in addition to installing the application EAR file, you also need to install a database and set up a datasource to the database.
As with JSPWiki you need to make a few modification to the WAR file and add it to an EAR file for easy installation (we’ve also attached an empty EAR into which you can drop the WAR with a context root of, what else, roller).
You’ll also need to make a couple minor changes to the Roller createdb.sql script and we’ll step you through that as well.
Modifying the Roller WAR and DB script
Once you’ve extracted the WAR file to your computer you’ll need to edit a number of XML files in two JAR files. It’s a simple change, switching the Java Persistence API (JPA) version from 2 to 1, because Roller won’t run on Websphere 7 without the change as the JPA provider that ships with Websphere 7 doesn’t support JPA version 2.
There are many ways to update a WAR file but we prefer to just open the WAR with 7-Zip and edit files directly. The first JAR we need to update is roll
The next files you’ll modify are all the XML files that set up the database calls in org\
Once you’ve saved your changes to the JAR, you’ll need to make a similar change to roll
Save your changes to the JAR. For ease of deployment add the WAR file to the attached empty EAR. Again there are many ways to do this but we just drag and drop it into the EAR using 7-Zip.
The last thing you need to change is the Roller createdb.sql script. The script is located at roll
The tedious part is over and now we can continue with the more exciting VAP creation and deployment!
Creating a pattern for Roller
We’ll assume you’ve already created a service instance so we’ll begin by managing it. From the IBM SmartCloud Control panel->Service Instances tab click Manage Service instance (Figure 1):
Figure 1. Managing the service instance
Login to IBM SmartCloud application workload services with the ID and password you set up when you created the service instance. Once in, click on Create a virtual application pattern (Figure 2).
Figure 2. Creating a virtual application pattern
Alright now we’re at the really cool part. If you’ve ever struggled to install an application on Websphere, you’re gonna love this... it’s all dragging and dropping and simple configuration.
Ensure Web Application Pattern Type 2.0 is selected and then click on the green plus sign to bring up a dialog box.
Figure 3. Select the application pattern type
Select Blank application in the dialog box then click Start Building (Figure 4)…
Figure 4. Get ready to describe the application
From the Assets palette on the left drag onto the main diagramming area. Click inside the Enterprise Application box to reveal the configuration pane on the right. Upload the EAR file you updated with the modified Roller WAR file earlier (Figure 5).
Figure 5. Upload the EAR file you updated with the modified Roller WAR file earlier
Now that the Roller enterprise application is set up it’s time to install the database. From the Assets palette on the left drag the database (Figure 6) ...
Figure 6. The database
... onto the main diagramming area. Upload the createdb.sql that you updated earlier (Figure 7).
Figure 7. Upload the createdb.sql that you updated earlier
Now it’s time to connect the Roller enterprise application with the Roller database. Drag the blue dot from the Roller enterprise application to the Roller database so that a blue line now connects the two boxes. Click on the blue line to reveal the datasource properties and fill them in (Figure 8):
Figure 8. Reveal the datasource properties and fill them in
The last step is to click anywhere in the diagramming area to reveal the configuration pane on the right and complete it with a name and description of the pattern, then save it. This is what the pattern will be called on the patterns page (Figure 9).
Figure 9. Complete configuration with a name and description of the pattern
Return to the Patterns tab, refresh, and you’ll see the new pattern you just created in the list. Select it and click deploy (Figure 10).
Figure 10. Deploy
Click the Instances tab and select the pattern you just deployed (Roller V5 in our example). It’ll take a bit of time but all progress is logged so you have a good indication of how it’s going. You’ll know it’s complete when you see a screen like Figure 11.
Figure 11. Complete!
Go to the endpoint URL and you’ll see the frontpage of Roller! Because Roller stores everything in the database there is no need to restart unlike with JSPWiki .
Figure 12. The Roller front page
You’ll want to create a user, a blog, and some entries. As you can see Roller works well as a VAP.
CJ, Arun, and Jay