OpenSUSE on VirtualBox

openSUSE-logo

After some Memorial Day weekend trial and error, I’ve settled on a Linux distribution for my Oracle MapViewer lab. Neither Ubuntu 14.04 nor Fedora 20 performed well under VirtualBox. In the case of Ubuntu, it was the lack of 3D support for Unity, which I think can be fixed by rebuilding the VirtualBox Guest Additions from the kernel source, but I wasn’t able to get VirtualBox to find the source. Based on some other distro instructions I think I just needed to do something like this: “KERN_DIR=/usr/src/kernels/`uname -r`.”

In any case, I had good luck with openSUSE 13.1. Oracle SQL Developer connects to Oracle 12c and the OS performance is good even with both VMs running. Now, my Oracle database and Oracle client environments are both running in virtual machine images that can be moved from one computer to another. More importantly, I can run Java 7 on openSUSE and Java 6 on Ubuntu, my host OS, where I do some customer development.

This illustration depicts the resulting spatial lab environment.spatiallab

Picking a Linux distro took longer than I thought it would. I’m reading to move on now.

Is Oracle MapViewer a Fit for Me?

Recently I began evaluating Oracle MapViewer to determine if it is the right tool for me. I’m looking for a mapping API that will allow me to manage vector graphics, points and polylines, independently from the base map. Today, I write too much repetitive code for map providers like Google Maps and OSM.  Oracle MapViewer it is a good tool for people working in a Java EE environment. It also has a place as part of Oracle’s Business Intelligence Suite, and is a very handy ad-hoc spatial data viewer, but does it belong in my website development toolbox?

current_map_stackMy personal preference is open source and lightweight, as this graphic illustrates, with a client-side JavaScript MVC framework making AJAX calls to JAX-RS web services. The RESTful web services should run in a standard Java web container and not depend on Java EE server containers.

In order to do vector graphics and event handling for polylines and points independently from the base map, my map API abstraction layer must be replaced. Ideally, the replacement framework should be purely JavaScript and should not require any server-side changes, something like Leaflet.

MapViewer Components

MapViewer is much more than just a JavaScript framework for maps. It has several server-side components that support its client-side AJAX-based JavaScript API:

  • A core rendering engine Java library, SDOVIS, that performs cartographic rendering. A servlet exposes the rendering functions to Web applications.
  • Application programming interfaces for programming MapViewer features. These APIs include XML, Java, PL/SQL, and an AJAX-based JavaScript API.
  • A graphical Map Builder tool that enables you to create map symbols, define spatial data rendering rules, and create and edit MapViewer objects.
  • Oracle Maps, which includes map cache and FOI (feature of interest) servers that facilitate the development of interactive geospatial Web applications.

The MapViewer architecture is not targeted towards my ideal environment of simple Java web containers. The preferred environment is Oracle WebLogic or Glassfish.

That being said, MapViewer does support Tomcat, but to what extent I’ve yet to discover. The following table is from the Map Viewer J2EE Servers Support page:

J2EE Server Name and Version

 Oracle WebLogic Server  10g and Later
 GlassFish  3.1.2 or later
 Oracle Application Server  10g (10.1.3.x)
 WebLogic  9
 Oracle OC4J Standalone  10g (10.1.3.x)
 Apache Tomcat  6.x and Later
 WebSphere  6.x and 7.x
 JBoss  4.x and Later

This architecture is illustrated in this graphic from the Oracle Fusion Middleware MapViewer Primer.

mapviewerIn my current work environment, pools of servers support different domains of our site. There is nothing to say that one pool of servers cannot include Java EE servers to handle the mapping load. It would still serve to isolate the mapping services from other server pools as well reduce the workload on the other servers. The business justification for the new pool of mapping servers depends on how many MapViewer features add value to our site, things like dynamic heatmaps, for example.

I’ll start my deep dive with the tutorials that come with the project, and then will explore some of the extensive features list in MapViewer data sheet.

2014 Location Intelligence Conference Report

Screenshot from 2014-05-23 15:18:18

The Location Intelligence conference in Washington, D.C. this week reinvigorated me. Tim Gerber, my database administrator/coworker, and I gave a presentation, How Garmin Connect Manages and Analyzes 5-billion Miles of User Activities , and we attended some very informative sessions.

It was exciting to meet both authors of Applying and Extending Oracle Spatial, Siva Ravada, and Simon Greener. You may know Simon from his website spatialdbadvisor.com.

Dan Geringer, who has been an invaluable spatial resource to Garmin, arranged a meeting for Tim and me with LJ Qian from Oracle’s Map Viewer team and Jayant Sharma, an Oracle Spatial Product Manager. We talked at length about generating dynamic heat maps from Oracle Spatial data, and we discussed using Oracle Map Viewer as an abstraction layer above base maps from Google, OSM, and other providers. I also enjoyed visiting with Oracle Product Manager, Jean Ihm.

My top priority coming out of the conference is to see if I can do with the Oracle Map Viewer HTML5 map client what I had hoped to accomplish with Leaflet. I want to separate our map code, line and point interaction, from the base map provider selected by the user, so that we can reduce the code written specifically for Google, Bing, OSM, and Baidu maps.

Since returning home I’ve been trying to find a Linux distro that runs well under Oracle VirtualBox to use as my test environment for Oracle SQL Developer, Oracle MapViewer quick start, and possibly Oracle WebLogic. Ubuntu 14.04 did poorly due to an issue with Unity 3D. Fedora 20 also seemed slow. OpenSUSE 13.1 looks promising, but I’m not far enough along in the set-up know for sure.

How to Install Oracle MapViewer

MapViewerLogo

In this post, I cover how to install the Oracle MapViewer 11g (11.1.1.7) Quick Start Kit. I also tell you where to track down a copy of the data for the MapViewer demos (that is not included with this distribution), and I take you step-by-step through the import of that data and the creation of a permanent data source.

Download Oracle MapViewer

Go to the Software Downloads for Oracle Fusion Middleware MapViewer page and accept the Terms and Conditions. Download the MapViewer Quick Start Kit from the Current MapViewer Version section. The Quick start kit is bundled with Glassfish server version 3.1.2. Alternatively, you can download and unzip the EAR file and then deploy the WAR file from the EAR to Tomcat.

Unzip the file and read the README.txt file located in the mapviewer11g_gs directory.

Install and Configure Glassfish and MapViewer

Installation is simply a matter of following the instructions in the README.txt file.

$ ./runMeFirst.sh
Setting 'admin' user's password to: welcome1 ...
Command change-admin-password executed successfully.
Waiting for domain1 to start ......
Successfully started the domain : domain1
domain  Location: /home/smitchell/Applications/mapviewer11g_qs/glassfish3/glassfish/domains/domain1
Log File: /home/smitchell/Applications/mapviewer11g_qs/glassfish3/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Deploying Oracle MapViewer ......
Application deployed with name mapviewer.
Command deploy executed successfully.
Deploying MapViewer Samples application ......
Application deployed with name mvdemo.
Command deploy executed successfully.
Enabling remote secure login
You must restart all running servers for the change in secure admin to take effect.
Command enable-secure-admin executed successfully.
Restarting server ...
Successfully restarted the domain
Command restart-domain executed successfully.
MapViewer QuickStart kit is now running!
MapViewer Server URL: http://localhost:8080/mapviewer
MapViewer Samples URL: http://localhost:8080/mvdemo
Glassfish Admin URL:  http://localhost:4848

Next, remove the one-time-use files used by runMeFirst.sh.

$ rm welcome1.txt 
$ rm password.txt 

MapViewer is now running. To start and stop Glassfish/MapViewer run the startServer and stopServer scripts.

Configure the MapViewer Demo

The MapViewer Quick Start Kit comes bundled with the MVDEMO war. There is some housekeeping necessary to set up the demo. That is all explained on the MVDEMO homepage: http://localhost:8080/mvdemo/.

Confirm the Required Database Views Exist

Numerous views should have been created in MDSYS when you installed Oracle Enterprise Edition.  Open SQL Developer and connect to the database. Scroll down to Other Users. Expand Other Users and find the user MDSYS. Expand the Views folder and scroll down until you come to the USER_SDO_… views (not shown). The following views should be there: USER_SDO_CACHED_MAPS, USER_SDO_MAPS, USER_SDO_THEMES, and USER_SDO_STYLES.

MDSYS_VIEWS

Note that the mcsdefinition.sql file is opened in the right side-panel above. That is a script that creates the necessary views should they be missing.

Import the MapViewer Demo Data

The data for the MapViewer demo is contained in a file named mvdemo.zip. That file is not part of maviewer11g_qs download. I found a copy in mapviewer10133wls.zip. It contains the mvdemo.zip file which, in turn, contains four SQL files, a mvdemo.dmp file, and readme.txt.

Follow the instructions in the file readme.txt included in mvdemo.zip. It walks you through the following steps.

Create new Oracle User

Create a new user, mvdemo. You’ll need that user later to import the demo data, although you may use a different user if you wish.

grant connect, resource, create view to mvdemo identified by mvdemo;
Grant succeeded.

Import the Dump Data

I’m working on two machines, so for this step, I first used secure copy to copy the dump data over to the Oracle database server.

 scp mvdemo.dmp oracle@gps11g:~/
oracle@gps11g's password:
mvdemo.dmp                                      100%  8288KB    8.1MB/s    00:00

From the oracle user account on the database server I ran the import command:

$ imp mvdemo/mvdemo file=mvdemo.dmp full=y ignore=y

Import: Release 11.2.0.1.0 - Production on Sun Jun 9 19:43:47 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V09.00.01 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
export client uses WE8MSWIN1252 character set (possible charset conversion)
. importing MVDEMO's objects into MVDEMO
. importing MVDEMO's objects into MVDEMO
. . importing table                       "CITIES"        195 rows imported
. . importing table                     "COUNTIES"       3230 rows imported
. . importing table                    "EMPLOYEES"         14 rows imported
. . importing table                  "INTERSTATES"        239 rows imported
. . importing table                         "MAPS"          4 rows imported
. . importing table                       "STATES"         56 rows imported
. . importing table                       "STYLES"        285 rows imported
. . importing table                  "TERRITORIES"          9 rows imported
. . importing table                "TERR_COUNTIES"       3230 rows imported
. . importing table                       "THEMES"         10 rows imported
Import terminated successfully without warnings.

Run mvdemo.sql

Readme.txt suggests importing mvdemo.sql from SQL*PLUS; however, I did it from SQL Developer using a new connection authenticated with the new mvdemo user account.

sqldemo_import

That completes the mvdemo data import.

Create the mvdemo Data Source

Open the MapViewer Administrative console, http://localhost:8080/mapviewer/, and click the Admin link that I circled in red below.

MapViewerAdmin

Follow these steps:

  1. Sign in with the Glassfish Id and password, admin/welcome1. You may change the Glassfish password by running the resetPassword.sh script.
  2. When the Management page appears click Configuration at the top of the menu on the left side of the page.
  3. The MapperConfig file will be displayed. Scroll to the bottom of the file to the Predefined Data Sources section.
  4. Un-comment the mvdemo map_data_source and edit the values to match the database server as shown below. NOTE: the exclamation point in front of the password is not a typo. It must be there.
  5. Click the Save and Restart button at the bottom of the Configuration page.

datasource

Click on the Data sources menu below the Configuration menu after the MapViewer restarts and you’ll see the new data source.

mvdemo_ds

Explore the Demos

You can now start exploring the demos at http://localhost:8080/mvdemo/demo/oracle_maps_demo.jsp.

demopage

In my next post I’ll set up the HTML5 demos, that is, once I’ve finished exploring this demo set.