jonpliske
10-27-2008, 12:59 PM
I am attempting to create a separate web application to run along side the main Pentaho (2.0 EE RC1) web app on Tomcat. Within this application, I have several JSP files that interact with the Pentaho libraries in order to render charts and execute XActions. Unfortunatly, I have been unable to get these JSP's to function correctly outside of the primary Pentaho webapp.
To test this approach, I created a simple JSP file containing the following code (not including imports or HTML):
String baseUrl = PentahoSystem.getApplicationContext().getBaseUrl();
IPentahoSession userSession = PentahoHttpSessionHelper.getPentahoSession( request );
String thisUrl = baseUrl + "./Debug?"; //$NON-NLS-1$
SimpleUrlFactory urlFactory = new SimpleUrlFactory( thisUrl );
ArrayList messages = new ArrayList();
SimpleParameterProvider parameters = new SimpleParameterProvider();
parameters.setParameter( "image-width", "600"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-height", "300"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "drill-url", "Debug?vertical={vertical}" );
parameters.setParameter( "inner-param", "vertical"); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer content = new StringBuffer();
ChartHelper.doPieChart( "advertisers",
"backend",
"vertical_count_pie.xml",
parameters, content, userSession, messages, null );
String top_verticals = content.toString();
If I put this file in the 'jsp' directory under the main Pentaho webapp, everything works great and the chart renders. If I move this to my own web app, I initially ran into dependiency issues — which I solved by moving Pentaho's libs to 'tomcat/shared/libs'. Now it appears that dependiencies are no longer the issue. Next, I ran into some NullPointerExceptions — which I was able to (partially) get rid of by borrowing some portions of the pentaho web app web.xml.
Now when I attempt to access the above described JSP page, I get the following displayed on screen:
Could not generate chart image.
Could not load chart data from advertisers/backend/top_verticals_by_avertisers.xaction And this shows up in the console/log:
ERROR 27-10 11:30:12,041 (PentahoBase.java:error:121) -86f0c3f8-a444-11dd-b4f6-7f6ff4cf4d6c:
SOLUTION-ENGINE:top_verticals_by_avertisers.xaction:
SolutionEngine.ERROR_0007 - Action sequence execution failed
Since I can move the JSP into the main pentaho app and it works fine, I'm thinking the problem lies in the initialization/configuration of Pentaho versus my custom app. Although I thought I was pointing my application to the correct (read: same) solution repository as the main pentaho app, I'm not exactly sure about everything going on in pentaho's web.xml (I've attached my hacked up web.xml for reference purposes).
I would like to know what kind of minimal configuration is required in order to setup a basic runtime environment outside the main pentaho web application. This environment does not need to support anything more than the execution of reletively simple xactions and charting. The eventual goal would be to have an separate web application to custom servlets and JSPs that extend the functionallity of the base pentaho application. My desire to keep all of these modifications outside of the pentaho web app is primarily out of respect for the open/close principle (http://en.wikipedia.org/wiki/Open/closed_principle).
Any help would be immensly appreciated!
-Jon
To test this approach, I created a simple JSP file containing the following code (not including imports or HTML):
String baseUrl = PentahoSystem.getApplicationContext().getBaseUrl();
IPentahoSession userSession = PentahoHttpSessionHelper.getPentahoSession( request );
String thisUrl = baseUrl + "./Debug?"; //$NON-NLS-1$
SimpleUrlFactory urlFactory = new SimpleUrlFactory( thisUrl );
ArrayList messages = new ArrayList();
SimpleParameterProvider parameters = new SimpleParameterProvider();
parameters.setParameter( "image-width", "600"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-height", "300"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "drill-url", "Debug?vertical={vertical}" );
parameters.setParameter( "inner-param", "vertical"); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer content = new StringBuffer();
ChartHelper.doPieChart( "advertisers",
"backend",
"vertical_count_pie.xml",
parameters, content, userSession, messages, null );
String top_verticals = content.toString();
If I put this file in the 'jsp' directory under the main Pentaho webapp, everything works great and the chart renders. If I move this to my own web app, I initially ran into dependiency issues — which I solved by moving Pentaho's libs to 'tomcat/shared/libs'. Now it appears that dependiencies are no longer the issue. Next, I ran into some NullPointerExceptions — which I was able to (partially) get rid of by borrowing some portions of the pentaho web app web.xml.
Now when I attempt to access the above described JSP page, I get the following displayed on screen:
Could not generate chart image.
Could not load chart data from advertisers/backend/top_verticals_by_avertisers.xaction And this shows up in the console/log:
ERROR 27-10 11:30:12,041 (PentahoBase.java:error:121) -86f0c3f8-a444-11dd-b4f6-7f6ff4cf4d6c:
SOLUTION-ENGINE:top_verticals_by_avertisers.xaction:
SolutionEngine.ERROR_0007 - Action sequence execution failed
Since I can move the JSP into the main pentaho app and it works fine, I'm thinking the problem lies in the initialization/configuration of Pentaho versus my custom app. Although I thought I was pointing my application to the correct (read: same) solution repository as the main pentaho app, I'm not exactly sure about everything going on in pentaho's web.xml (I've attached my hacked up web.xml for reference purposes).
I would like to know what kind of minimal configuration is required in order to setup a basic runtime environment outside the main pentaho web application. This environment does not need to support anything more than the execution of reletively simple xactions and charting. The eventual goal would be to have an separate web application to custom servlets and JSPs that extend the functionallity of the base pentaho application. My desire to keep all of these modifications outside of the pentaho web app is primarily out of respect for the open/close principle (http://en.wikipedia.org/wiki/Open/closed_principle).
Any help would be immensly appreciated!
-Jon