Tuesday, September 10, 2013

Spring Cache abstraction using Ehcache

In this article, we will see how to use EhCahce with Spring Cache abstraction. Refer http://ehcache.org/documentation/recipes/spring-annotations for using EhCache’s own annotations. The advantage of using it with Spring Cache abstraction is that it's easy to change the underlying storage. Say in future if we want to change it to Memcached, then it is just a configuration change and not a code change. 

Let’s look at the Spring configuration steps and common issues that one encounters while using Spring Cache.
  1. Add the Ehcache dependency to the project
Note: Without adding the dependency you might see the error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Lnet/sf/ehcache/CacheManager;
  1. Include the cache namespace and schema location in the Spring Configuration file.
  2. Configure the application to use annotation driven

  3. Define the cacheManager bean

  4. Configure the ehcache.xml
    Defined the caches in the ehcache configuration XML. Below is the sample ehcache xml file to define the caches.

    Note: Without defaultCache defined, below error will be thrown
Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in ServletContext resource [/WEB-INF/servlet-config.xml]: Cannot resolve reference to bean 'ehcache' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcache' defined in ServletContext resource [/WEB-INF/servlet-config.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Illegal configuration. No default cache is configured.
  1. Add the @Cacheable annotation to the code

  2. Common issues one might face in using the Spring Cache abstraction
    1. Cache key collision:
The default key generator is a simple one and it is easy to get key collisions using this. Refer the DefaultKeyGenerator.java code to see how it works. Also when you have an array as a parameter, the default key generator produces different key for each execution.
It’s better to use your own key generator. Below is the sample one I used

And you can set this as your default key generator in the Spring configuration file like below.
    1. Application context is loaded more than once:
Sometimes due to misconfiguration the application context gets loaded twice and due to that you might get the error. Make sure you name the cacheManager in the ehcache.xml and you are not loading the application context twice.
Another unnamed CacheManager already exists in the same VM. 
Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: InputStreamConfigurationSource [stream=sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@47f3ed6]

            Following the above steps will help you to setup the Spring Cache abstraction using Ehcache.

Monday, August 5, 2013

SSH into Ubuntu in Virtual Box

Change the Network Adapter as "Bridge Adapter" and start the Ubuntu VM.
Once logged in get the ip of the machine using ifconfig command, in this case the ip is 159.112.138.46
Then in Cygwin from Windows Host, you should be able to do the SSH.

Thursday, June 20, 2013

Overview of Microstrategy features

In my previous blog Microstrategy 9 Installation on a new Windows 2008 server we looked at installing the MSTR. Here let's look at the features we installed. Below is the list of all the features from MSTR.
The below picture will give us the overview of how all these features are related.
Let's look at each one of them in detail
  1. Microstrategy Intelligence Server
    Microstrategy Intelligence Server is the architectural foundation for the Microstrategy platform. This communicates to the various data sources, and runs the reports and distributes to MSTR Desktop and Web users. Intelligence server ensures the scalability and fault tolerance required for analysis of terabyte databases and millions of users.
    Below are the sub-features installed as part of MSTR Intelligence server. We will cover these features in detail when we explore the Intelligence server in detail.
  2. Microstrategy Web universal
    MSTR Web enables the users to create and/or run the reports in web.
    Below are the sub-features installed as part of MSTR Web Universal.
  3. Microstrategy Office
    MSTR Office is a plugin for Microsoft Office and lets the user to run reports from Office tools. I could not show the screen shot for this product, I didn't install this feature as I don't have the MS Office in my VM.
    Below are the sub-features installed as part of MSTR Office.
  4. Microstrategy Mobile
    MSTR Mobile enables the users to view the reports from mobile devices.
    Below are the sub-features installed as part of MSTR Mobile.
  5. Microstrategy Desktop Products
    MSTR Desktop allows the user to create and/or run the reports in the Desktop.
    MSTR Architect helps to map the data model to the business model.
    Below are the sub-features installed as part of MSTR Desktop.
  6. Microstrategy Object Manager
    MSTR Object Manager is used to migrate MSTR objects from one environment to another.
  7. Microstrategy Command Manager
    Command Manager is used to create scripts to automate common administrative tasks.
  8. Microstrategy Enterprise Manager
    MSTR Enterprise Manager provides the usage details of the MSTR Intelligence Server. The core of Enterprise Manager is nothing but a MSTR project with set of predefined reports, and the metrics and attributes to create your own reports. You can run reports that help you to:
    • Allocate system resources based on data warehouse usage trends
    • Research efficient aggregation, partitioning, and indexing strategies
    • Profile users based on their system resource usage
    • Determine the optimal time to run scheduled jobs, load data, or perform routine system and database maintenance
    • Determine the most popular reports so you can schedule and cache them, thus increasing their response time and reducing the load on the system
    • Identify unused objects from your metadata repository so they can be deleted later
    • Identify peak usage times and patterns and, if necessary, change your Intelligence Server configuration to respond appropriately
    • Determine whether you need to add more threads to the database connection threads if queue times are long
    • Find which tables are the most used, and create indexes to improve performance
  9. Microstrategy Integrity Manager
    MSTR Integrity Manager is used to automate the report testing.
    MSTR Integrity Manager
  10. Microstrategy System Manager
    Microstrategy System Manager helps to automate the configuration of MSTR products in larger environments.
  11. Microstrategy SDK
    MSTR SDK enables the developers to extend and integrate MSTR platform through a set of APIs that exposes all platform functionality. It helps to embed intelligence in any custom application.
  12. Microstrategy Narrowcast Sever
    MSTR Narrowcast server delivers the report in mail/phone based on the schedules.
    Below are the sub-features installed as part of MSTR Narrowcast Server.
  13. Other Components
    This installs the drivers to access Cubes from Analysis Servers and Sequelink ODBC Socket server to talk to multiple data sources.
We will look into each feature in detail in the upcoming blogs.

Sunday, June 16, 2013

Microstrategy 9 Installation on a new Windows 2008 server

Since my customer has decided to go with the Microstrategy(MSTR) as analytics and reporting tool, I got curious about this tool and wanted to know more on its capabilities. I got an opportunity to go for a free training from MSTR, and I got the evaluation CD & a nice notebook J. I thought I will install it and explore it for 30 days… Lets see how far I go!
The installation of actual MSTR seems to be simple, but setting up the windows server for the installtion took more time. It would have been simpler if MSTR gave the VM with MSTR services installed in it. Anyways lets assume we have the Windows Server 2008 ready and let see how to install the MSTR. The prerequites are mentioned in the MSTR website http://www.microstrategy.com/evaluation-edition
System Requirements
  • x86 or x64 compatible CPU
  • 4 GB RAM
  • Minimum storage space required: Three times the amount of RAM available to Intelligence Server. For example, an Intelligence Server that is provided 4 GB of RAM requires 12 GB of hard drive space.
  • Windows 2003 Standard Edition SP2 (on x86 or x64) ,Windows 2003 Enterprise Edition SP2 (on x86 or x64) ,Windows 2003 Standard Edition R2 SP2 (on x86 or x64) ,Windows 2003 Enterprise Edition R2 SP2 (on x86 or x64) ,Windows Vista Business Edition SP2 (on x86 or x64), Windows Vista Enterprise Edition SP2 (on x86 or x64) ,Windows 7 Professional Edition SP1(on x86 or x64), Windows 7 Enterprise Edition SP1 (on x86 or x64) ,Windows 8 all editions (on x86 or x64) ,Windows 2008 Standard Edition SP2 on x64 ,Windows 2008 Enterprise Edition SP2 on x64 ,Windows 2008 Standard Edition R2 SP1 on x64 ,Windows 2008 Enterprise Edition R2 SP1 on x64 ,Windows Server 2012 Standard (on x64)
  • Microsoft Internet Information Services (IIS) version 6.x, 7.0.x, 7.5.x, or 8.x.
  • Microsoft .NET Framework 4.0 or 4.5. This must be installed prior to installing MicroStrategy.
  • Microsoft Internet Explorer version 7.x, 8.x, 9.x, or 10.x.
  • Adobe® Reader® version 9.x, 10.x or 11.x.
  • Adobe® Flash® Player version 10.1.x, 10.3.x, or 11.x.
  • 16-bit color display or higher
  • Windows fonts display set to small fonts (96 dpi)
Insert the DVD and double click on the DVD, it will open the below window, click on "Begin Microstrategy Platform Installation".
Select the language and click "Ok"
Click "Next"
Accept the license agreements and click "Next"
The license kay can be obtained form http://www.microstrategy.com/LicenseKey. Promo code is required to get the license key. I got one with the evaluation DVD pack. License ley will be sent to your registered email address. Yes, you will have to register to get the license key.
Change the installation folders if needed. I prefer it to have the default installation path.
Select the features you want to install. Since I am evaluating I installed all the features except the "Microstrategy office" as it required MS Office to be installed in the server, and I don't have one on my server.
After this I got an error saying "Adobe Acrobat Reader 7 or greater" is needed. I downloaded and installed the acrobat reader. Then I got the below errors
MicroStrategy Common Files requirements:MISSING: Microsoft .Net Framework v4.0
MicroStrategy Desktop Products requirements:MISSING: Microsoft .Net Framework v4.0
MicroStrategy Object Manager requirements:
OK
MicroStrategy Command Manager requirements:
OK
MicroStrategy Enterprise Manager requirements:
OK
MicroStrategy Intelligence Server requirements:
OK
MicroStrategy Web Universal requirements:
MISSING: Microsoft Internet Information Server Version 5.0 or greater.
MISSING: Microsoft .Net Framework v4.0
MicroStrategy Web Services requirements:
MISSING: Microsoft Internet Information Server Version 5.0 or greater.
MISSING: Microsoft .Net Framework v4.0
MicroStrategy Mobile Server (ASP .NET) requirements:
MISSING: Microsoft Internet Information Server Version 5.0 or greater.
MISSING: Microsoft .Net Framework v4.0
MicroStrategy SDK requirements:
OK
MicroStrategy Integrity Manager requirements:
OK
MicroStrategy Office requirements:
MISSING: Microsoft .Net Framework v4.0
MISSING: Microsoft Office XP or higher.
MISSING: Windows Installer 4.5 or higher.
(Windows Installer 4.5 redistributables can be found in
..\Utilities\3rdParty\WindowsInstaller45 folder
on the MicroStrategy product installation media.)
SequeLink ODBC Socket Server requirements:
OK
MicroStrategy Narrowcast Administrator requirements:
OK
MicroStrategy Delivery Engine requirements:
OK
MicroStrategy Subscription Portal requirements:
MISSING: Microsoft Internet Information Server Version 5.0 or greater.
MicroStrategy Tutorial - Reporting requirements:
OK
MicroStrategy Analytics Modules requirements:
OK
MicroStrategy MDX Cube Provider requirements:
MISSING: Microsoft Internet Information Server Version 5.0 or greater.
MISSING: Microsoft .Net Framework v4.0
I got below message after installing Microsoft .Net 4.0 and IIS.
MicroStrategy Mobile Server (ASP .NET) requirements:
MISSING Web Server feature: Security\Windows Authentication
MISSING Web Server feature: Application Development\ASP
I had to enable the ASP & Windows Authentication services for the IIS as shown below.
Since it's the new server, I didn't get a chance to enable the ASP and ASP.Net extensions in the IIS. Good that MSTR installation recognizes that and showed me the below pop up.

Leave the default and click "Next"

 This is to just an information that you will get the activation key in the mail.

 Enter the instance name, location, use and click "Next"

Enter your information and click "Next".. In case if you select "I am not an employee…" option then it will prompt you an one more window where it will ask you to entert one of the Employee's information associated with this project.

The installation will start now. It took me hours to finish the installation as my VM's processor and memory are under the required specifications.  Select to get the activation code in email. You need to activate the software within 7 days from the installation.

The installed components and it details are listed once the installation is complete.
Component Install:
- MicroStrategy Desktop Analyst
- MicroStrategy Desktop Designer
- MicroStrategy Architect
- MicroStrategy Server Administrator
- MicroStrategy Object Manager
- MicroStrategy Command Manager
- MicroStrategy Enterprise Manager
- MicroStrategy System Manager
- MicroStrategy Intelligence Server
- MicroStrategy Report Services
- MicroStrategy OLAP Services
- MicroStrategy Distribution Services
- MicroStrategy Transaction Services
- MicroStrategy Web Universal - MicroStrategy Web Server (ASP .NET)
- MicroStrategy Web Universal - MicroStrategy Web Server (JSP)
- MicroStrategy Web Universal Analyst
- MicroStrategy Web Universal Professional
- MicroStrategy Web Universal Reporter
- MicroStrategy Mobile - BlackBerry® Device Client Application
- MicroStrategy Mobile - MicroStrategy Mobile Server (ASP .NET)
- MicroStrategy Mobile - MicroStrategy Mobile Server (JSP)
- MicroStrategy Portlets
- MicroStrategy GIS Connectors
- MicroStrategy SDK
- MicroStrategy Integrity Manager
- MicroStrategy Tutorial - Reporting
- MicroStrategy Analytics Modules
- MicroStrategy Narrowcast Administrator
- MicroStrategy Delivery Engine
- MicroStrategy Subscription Portal
- MicroStrategy Tutorial - Delivery
- SequeLink ODBC Socket Server
- MicroStrategy MDX Cube Provider
Target Directories:
- MicroStrategy Desktop Products: C:\Program Files\MicroStrategy\Desktop
- MicroStrategy Object Manager: C:\Program Files\MicroStrategy\Object Manager
- MicroStrategy Command Manager: C:\Program Files\MicroStrategy\Command Manager
- MicroStrategy Enterprise Manager: C:\Program Files\MicroStrategy\Enterprise Manager
- MicroStrategy System Manager: C:\Program Files\MicroStrategy\System Manager
- MicroStrategy Intelligence Server: C:\Program Files\MicroStrategy\Intelligence Server
- MicroStrategy Web Universal - MicroStrategy Web Server (ASP .NET): C:\Program Files\MicroStrategy\Web ASPx
- MicroStrategy Web Universal - MicroStrategy Web Server (JSP): C:\Program Files\MicroStrategy\Web JSP
- MicroStrategy Mobile - BlackBerry® Device Client Application: C:\Program Files\MicroStrategy\Mobile Clients
- MicroStrategy Mobile Server - MicroStrategy Mobile Server (ASP .NET): C:\Program Files\MicroStrategy\Mobile Server ASPx
- MicroStrategy Mobile Server - MicroStrategy Mobile Server (JSP): C:\Program Files\MicroStrategy\Mobile Server JSP
- MicroStrategy SDK: C:\Program Files\MicroStrategy\SDK
- MicroStrategy Portlets: C:\Program Files\MicroStrategy\Portlets
- MicroStrategy GIS Connectors: C:\Program Files\MicroStrategy\GISConnectors
- MicroStrategy Integrity Manager: C:\Program Files\MicroStrategy\Integrity Manager
- MicroStrategy Tutorial - Reporting: C:\Program Files\MicroStrategy\Tutorial Reporting
- MicroStrategy Analytics Modules: C:\Program Files\MicroStrategy\Analytics Modules
- MicroStrategy Narrowcast Administrator: C:\Program Files\MicroStrategy\Narrowcast Server\Delivery Engine
- MicroStrategy Tutorial - Delivery: C:\Program Files\MicroStrategy\Narrowcast Server\Tutorial
- MicroStrategy Subscription Portal: C:\Program Files\MicroStrategy\Narrowcast Server\Subscription Portal
- MicroStrategy Health Center: C:\Program Files\Common Files\MicroStrategy\HealthCenter
- MicroStrategy MDX Cube Provider: C:\Program Files\MicroStrategy\MDX Cube Provider
- MicroStrategy Common Files: C:\Program Files\Common Files\MicroStrategy
Program Folder: MicroStrategy
Log file:
C:\Program Files\Common Files\MicroStrategy\install.log
MicroStrategy Web Server (ASP .NET) Virtual Directory: MicroStrategy
MicroStrategy Mobile Server (ASP .NET) Virtual Directory: MicroStrategyMobile
MicroStrategy Subscription Portal Virtual Directory: NarrowcastServer
MicroStrategy MDX Cube Provider Virtual Directory: MicroStrategyMDX
License Details:
Contract ID: 76053
License Key Group: 1
License Key Issue Date: 7/18/2012
GA installation
MicroStrategy Intelligence Server Module
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Intelligence Server Universal Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Narrowcast Server Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Report Services Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy OLAP Services Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Distribution Services Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Transaction Services Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Intelligence Server Clustering Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Intelligence Server MultiSource Option
License based on Named Users
Maximum number of Named Users allowed: 500
Maximum number of Concurrent Users allowed: 50
MicroStrategy Web Reporter Module
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Web Universal Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Web Analyst Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Web Professional Option
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy Desktop Products
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
MicroStrategy Desktop Analyst Module
Maximum number of Named Users allowed: 500
MicroStrategy Desktop Designer Option
Maximum number of Named Users allowed: 500
MicroStrategy Architect
Maximum number of Named Users allowed: 500
MicroStrategy Server Administrator
MicroStrategy Command Manager
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
License based on Named Users
Maximum number of Named Users allowed: 500
Maximum number of Managed Named Users allowed: 500
MicroStrategy Enterprise Manager
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
License based on Named Users
Maximum number of Named Users allowed: 500
Maximum number of Managed Named Users allowed: 500
MicroStrategy Object Manager
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
License based on Named Users
Maximum number of Named Users allowed: 500
Maximum number of Managed Named Users allowed: 500
MicroStrategy SDK
Production Version
MicroStrategy Analytics Modules
Evaluation Version
MicroStrategy Integrity Manager
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
Maximum number of Named Users allowed: 1
Maximum number of Managed Named Users allowed: 500
MicroStrategy Mobile
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
License based on Named Users
Maximum number of Named Users allowed: 500
MicroStrategy System Manager
Evaluation Version
Evaluation period: 1
Evaluation duration: 30 day(s)
License based on Named Users
Maximum number of Named Users allowed: 500
Maximum number of Managed Named Users allowed: 500
 Restart the server to complete the installation

Activate the server using Start à Microstrategy à License Manager
Enter the activation key that you got in the mail.

This completes the Microstrategy Server installation.

The installation should be easy if you have a good server to install it in. I had to struggle to get the VM ready and install MSTR on top of that. That too my VM was about micro in size. Took 3 hours to complete my installation. Better to use a larger VM for quicker installation.