I wrote a java class with the main() method to connect to "msmdpump.dll" and execute MDX on cube and retrieve a result. like this :
public static void main(String[] args) throws ClassNotFoundException, OlapException{
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
Connection connection = null;;
try {
connection = DriverManager.getConnection("jdbc:xmla:Server=http://172.20.0.29:80/OLAP/msmdpump.dll"+
";Catalog=CreditCard",
"",
"");
} catch (SQLException e) {
e.printStackTrace();
}
if (null== connection){
System.out.println("Connection null");
}else
System.out.println("Connect Successfully !");
OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = null;
try {
olapConnection = wrapper.unwrap(OlapConnection.class);
} catch (SQLException e) {
e.printStackTrace();
}
OlapStatement statement = null;
CellSet cellSet = null;
try {
statement = (OlapStatement) olapConnection.createStatement();
cellSet = statement.executeOlapQuery(
"SELECT NON EMPTY { [Measures].[Instalment Future Amount] } ON COLUMNS"+
", NON EMPTY { ([Dim MerchantInstalmentCashFlowDate].[J Year].[J Year].ALLMEMBERS * [Dim MerchantInstalmentCashFlowDate].[Persian Month].[Persian Month].ALLMEMBERS) } ON ROWS "+
"FROM [Credit Card DW] where ([Dim Merchant].[Mrc Unique Id].[Mrc Unique Id].&[100000000000013])"
);
} catch (SQLException e) {
e.printStackTrace();
}
for (Position row : cellSet.getAxes().get(1)) {
for (Position column : cellSet.getAxes().get(0)) {
for (Member member : row.getMembers()) {
System.out.println(member.getName());
}
final Cell cell = cellSet.getCell(column, row);
System.out.println(cell.getFormattedValue());
System.out.println();
}
}
}
everything is fine, I executed it on my local computer and see the result on my console :)
Next I copied the same code in my backbean's method to call it from jsf page. I deployed the EAR file contained those pages and when I brows that jsf on browser I got this error which means the application doesn't have authorize to connect to .dll file !!
'401: Unauthorized' for url: http:// 172.20.0.29:80/OLAP/msmdpump.dll
All code is same and only the different is I execute the first class by java (with main() method) and in second I call the method by jsf which deployed on Weblogic.
Any body could help me to figure it out why this happen ? Thanks in advance .