PDA

View Full Version : need help: integration problem with portlet



luo_haihua
03-01-2006, 10:01 PM
Hi dear all,
I am using liferay 3.6.1 (integrated with tomcat 5) as my portlet container and I am going to integrate mondrian as a portlet. However, when I followed the link given inside the sample index.jsp, (e.g. testpage.jsp?request=mondrian), which will return to the start page of my portlet!
Any idea why this happens? Thanks a lot in advance!!!

sgwood
03-02-2006, 05:29 AM
I did a port of JPivot to JBoss Portal, which is checked into JPivot CVS, but not part of the standard distribution. I have not tried to do this for other portal implementations. Do you want to try it out?
Sherman Wood
JasperSoft

luo_haihua
03-02-2006, 08:32 PM
o, thanks for your great news! Yes, sure I will try it out! :)
The question is only: is there any specific implementation depending on JBoss Portal?
p.s., do you mean the portlet in cvs/jboss-portlet?

sgwood
03-03-2006, 02:43 AM
I did this originally with JBoss Portal 2.0/JBoss 4.0.2. There are configuration files specific to JBoss Portal, and there was a single place in the generation of PDFs and Excel files that used a JBoss Portal specific method to send the generated bytes to the response - see the end of GetChartImage.
Sherman
JasperSoft

luo_haihua
03-03-2006, 05:07 AM
Hi,
in JPivotPortlet.init() it reads an init param "ServletContextProvider" which is specified in WEB-INF/portlet.xml:
********
...
<init-param>
<name>ServletContextProvider</name>
<value>org.jboss.portal.bridge.JBossServletContextProvider</value>
</init-param>
...
********
This seems to be a JBoss portal specification, isn't it? And to simply remove this line will cause exception "Portlet is incorrectly configured." Would u have any suggestions?
kindest regards,
Haihua

sgwood
03-03-2006, 05:17 AM
Sorry, I missed that issue. This is to get the JPivot portlet WAR integrated into the portal. I don't know anything about Liferay portal configuration in this area.
Sherman
JasperSoft

luo_haihua
03-03-2006, 09:09 AM
It doesn't matter.
Another point is that, on the top of inside each .jsp there is one line like <@page ... extends="org.jboss.portal...PortalJsp"> (sorry, I don't remember exactly the code and I have no source code now on this pc). Anyway, it seems another specification of jboss portal. Have you any idea what that class does?
Also, each .jsp doesn't start with <html> and <body>, but ends with </body> and </html>. I guess the class PortalJsp will interprete the .jsp with those start tag, right?
best regards,
Haihua

sgwood
03-03-2006, 10:24 AM
For <@page ... extends="org.jboss.portal...PortalJsp">: Is there a Liferay equivalent?
Only index.jsp has the </body> and </html>. This will be ignored by the portal - you can drop it.
Sherman

luo_haihua
03-04-2006, 12:59 AM
As I know, it is not neccessary to add such additional setting for portlet .jsp to run under liferay. But I have no idea if there could lead to potential problem when this line is removed...
Anyway, I have removed the @page settings, and I can also access the index.jsp in my liferay portlet. However, when I click each link, it returns to the index page without any exception in web browser or backend.
kindest regards,
Haihua

sgwood
03-04-2006, 02:07 AM
Maybe the wcf:include tag in the testpage.jsp is not working. The aim of the tag is to include one of the /WEB-INF/queries JSPs. Can you try replacing the include tag with a jp:mondrianQuery tag instead, just to see whether that is the problem?
Sherman

luo_haihua
03-05-2006, 09:46 PM
HI,
I followed your suggestion and even put those tags in the index.jsp:
----------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"
http://www.w3.org/TR/REC-html40/strict.dtd
">
<%@ page session="true" contentType="text/html; charset=ISO-8859-1" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
<%@ taglib uri="
http://java.sun.com/portlet
" prefix="portlet" %>
<%@ taglib uri="
http://www.tonbeller.com/jpivot
" prefix="jp" %>
<%@ taglib uri="
http://www.tonbeller.com/wcf
" prefix="wcf" %>
<%@ taglib prefix="c" uri="
http://java.sun.com/jstl/core
" %>
<%@ page isELIgnored ="false" %>
<%
System.out.println("come to index.jsp!!!");
%>
<portlet:defineObjects/>
<jp:mondrianQuery id="query01" jdbcDriver="net.sourceforge.jtds.jdbc.Driver" jdbcUrl="jdbc:jtds:sqlserver://...(some secret here,;))..." catalogUri="/WEB-INF/queries/bismt.xml">
select {[Measures].[Number of Messages], [Measures].[Failure Rate]} ON COLUMNS,
{[Workflow].[All Workflows]} ON ROWS
from [MT]
</jp:mondrianQuery>
----------
This leads to an exception:
----------
09:40:24,148 ERROR [com.tonbeller.jpivot.tags.OlapModelTag]
com.tonbeller.wcf.controller.EmptyThreadLocalStackException
at com.tonbeller.wcf.controller.ThreadLocalStack.peek(ThreadLocalStack.java:35)
at com.tonbeller.wcf.controller.RequestContext.instance(RequestContext.java:56)
at com.tonbeller.jpivot.tags.OlapModelTag.doEndTag(OlapModelTag.java:56)
at org.apache.jsp.index_jsp._jspx_meth_jp_mondrianQuery_0(index_jsp.java:145)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:96)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:510)
at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.jav
a:210)
at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.jav
a:77)
at org.apache.myfaces.context.portlet.PortletExternalContextImpl.dispatch(PortletExternalCon
textImpl.java:169)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:
242)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
at org.apache.myfaces.portlet.MyFacesGenericPortlet.nonFacesRequest(MyFacesGenericPortlet.ja
va:293)
at org.apache.myfaces.portlet.MyFacesGenericPortlet.facesRender(MyFacesGenericPortlet.java:3
50)
at org.apache.myfaces.portlet.MyFacesGenericPortlet.doView(MyFacesGenericPortlet.java:259)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
at com.liferay.portal.servlet.PortletServlet.service(PortletServlet.java:78)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:510)
...
----------
Any ideas or suggestions where should I begin?

sgwood
03-05-2006, 11:26 PM
Could you look at your web.xml? A lot of the configuration that JPivot needs in a normal WAR goes away with the portlet version. There should be no JPivot filters etc in the portlet web.xml. Here is mine:
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"
http://java.sun.com/dtd/web-app_2_3.dtd
">
<web-app>
<taglib>
<taglib-uri>http://www.tonbeller.com/wcf</taglib-uri>
<taglib-location>/WEB-INF/wcf/wcf-tags.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://www.tonbeller.com/jpivot</taglib-uri>
<taglib-location>/WEB-INF/jpivot/jpivot-tags.tld</taglib-location>
</taglib>
</web-app>
Sherman
JasperSoft

luo_haihua
03-06-2006, 04:19 AM
Hi Sherman,
I have removed filter part of the web.xml:
------
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "
http://java.sun.com/dtd/web-app_2_3.dtd
">
<web-app>
<display-name>MondrianPortlet</display-name>
<distributable/>
<context-param>
<param-name>company_id</param-name>
<param-value>liferay.com</param-value>
</context-param>
<listener>
<listener-class>com.liferay.portal.servlet.PortletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>Mondrian</servlet-name>
<servlet-class>com.liferay.portal.servlet.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-class</param-name>
<param-value>com.seeburger.portlet.mondrian.MondrianPortlet</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Mondrian</servlet-name>
<url-pattern>/Mondrian/*</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://java.sun.com/portlet</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://www.tonbeller.com/wcf</taglib-uri>
<taglib-location>/WEB-INF/wcf/wcf-tags.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://www.tonbeller.com/jpivot</taglib-uri>
<taglib-location>/WEB-INF/jpivot/jpivot-tags.tld</taglib-location>
</taglib>
</web-app>
------
but the problem still exists.:(
Haihua

luo_haihua
03-06-2006, 07:40 AM
One add-on: The remaining part in my web.xml seems to be neccessary to liferay, otherwise the portlet cannot be shown in the portal.
I am really stuck by this problem. It seems that many other users have met the same problem:
http://sourceforge.net/forum/forum.php?thread_id=1438498&forum_id=197390
kindest regards,
Haihua

sgwood
03-07-2006, 01:41 AM
It could be a Liferay issue, or something that is missing with your new portlet class. Also, the JPivot portlet replaces the WCF com.tonbeller.wcf.controller.RequestFilter, and uses the same set of parameters. There is a lot of hard coding of those parameters in the portlet at the moment - for example, the "testpage.jsp". You may want to look at parameterizing and refactoring the portlet for your needs.
Sherman
JasperSoft

luo_haihua
03-07-2006, 01:47 AM
Hi Sherman,
ok, thanks a lot for your great help!
I also agree that it is really needed to refactor the JPivot portlet class, since it utilizes jboss portal classes in many places...
cheers,
Haihua

luo_haihua
03-07-2006, 08:17 AM
Hihi,
one more question: why has the WCF RequestFilter been replaced in the JPivot portlet?
Haihua

sgwood
03-07-2006, 09:03 AM
Filters do not work in portals - at least with JBoss Portal.
Sherman

luo_haihua
03-08-2006, 04:39 AM
Hihi,
I am going towards the right way...I have rewrite the getHttpServletRequest/Response() in a "liferay-style" and can access the mondrian request page now! However, it looks ugly due to missing button images there. In HTML code it tried to locate the navigator image, for instance, under the path "/jpivot/toolbar/cube-up.png". Any idea why it cannot find the images?
kindest regards,
Haihua

luo_haihua
03-08-2006, 09:21 AM
oh, I have found a solution with a trick: put the folder /jpivot/toolbar under %TOMCAT_HOME%/webapps as a dummy webapp "jpivot", then the images can be found.

sgwood
03-09-2006, 02:25 AM
This is not much of a solution in a portal environment. The is a XSL variable {$context} provided by the WCF framework that is used for URL generation in the rendering of the JPivot UI components like the toolbar. This is available in JBoss Portal and the URLs do have the proper path to the images etc in the portlet WAR, without having to do your workaround. It seems that there is something not right in the Liferay environment you have.
Sherman

luo_haihua
03-09-2006, 04:00 AM
Yes, you are right. Although the static images and xsl could be found, the button actions still do not work. Where has the variable {$context} been set in the JPivot portlet? Maybe here inside doView()?
----------
...
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException {
// log if necessary
if (logger.isInfoEnabled())
logRequest(request);
// DelegateContext root = new DelegateContext(); //<- here?
// request.setAttribute(PortalJsp.CTX_REQUEST, root); //<- or here?
...
-------
I have to remove them in my portlet, since it invokes jboss portal stuffs.
Haihua

luo_haihua
03-09-2006, 10:00 PM
ok, I have resolved the main problem standing in the way to the button fct!
Actually the $context has already been saved in another place in my liferay portlet (the same as jpivot portlet), but cannot be accessed by wcf controller, but it seems until now not an important issue to let the whole tool work. ;)
To Sherman: thanks again for your warm-hearted help! :)
Cheers,
Haihua

kingczar
11-09-2006, 03:00 AM
Hi,
Does your port of JPivot to JBoss Portal work in verion 2.6? Did anybody try it?
I modified the portlets and the description files and tried to run them under JBoss Portlet 2.6, but it doesn't seem to work:(
I have an error:
javax.portlet.PortletException: org.apache.jasper.JasperException: Exception in JSP: /testpage.jsp:60 57: 58: 59: <%-- define table, navigator and forms --%> 60: 61: 62: 63: Stacktrace:
javax.portlet.PortletException: org.apache.jasper.JasperException: Exception in JSP: /testpage.jsp:60
57:
58:
59: <%-- define table, navigator and forms --%>
60:
61:
62:
63:
Stacktrace:
at org.jboss.portal.portlet.impl.jsr168.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:116)
at com.tonbeller.jpivot.jboss.portlet.JPivotPortlet$MyHandler.include(JPivotPortlet.java:406)
at com.tonbeller.jpivot.jboss.portlet.JPivotPortlet$MyHandler.normalRequest(JPivotPortlet.java:356)
at com.tonbeller.wcf.controller.RequestSynchronizer.handleRequest(RequestSynchronizer.java:127)
at com.tonbeller.jpivot.jboss.portlet.JPivotPortlet.doView(JPivotPortlet.java:199)...
AND FURTHER
...
javax.servlet.ServletException: javax.servlet.jsp.JspException: query "#{query01}" not found
javax.servlet.ServletException: javax.servlet.jsp.JspException: query "#{query01}" not found
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java:356)...
It seems that it doesn't recognize #{query01} ?
Any suggestions?
Thanks for any help!
ps. Do this portlets work fine in liferay?

kreynaldo
02-09-2007, 04:47 PM
It seems to me that you already solve the problem of porting the jpivot portlet to liferay.
Can you publish your results so every body can benefit of it?
Sincerly,
Karel.

smruti.mehta
10-16-2007, 09:27 AM
I followed this conversation step by step.

testpage is coming but on clicking of button are not reflecting!

Can any one help me please!

Special request to luo_haihua :confused:

chorly_2000
10-18-2007, 07:19 PM
Could someone provide me with some information on how to deploy JPivot portlet on JBoss portal? My JBoss is jboss-portal-2.6.1.GA-bundled. JPivot is 1.7.0. I read the readme file in jpivot-1.7.0\jpivot-1.7.0\src\jboss-portlet and downloaded and installed ANT. But the build failed. If someone knows how to do it, a step-by-step instruction will be very helpful. Thanks very much!