Foren

Problem using <portlet:defineObjects /> with portlet 2.0 spec

thumbnail
Harold Christopher Felder, geändert vor 15 Jahren.

Problem using <portlet:defineObjects /> with portlet 2.0 spec

New Member Beiträge: 20 Beitrittsdatum: 05.03.09 Neueste Beiträge
I am having a problem using the <portlet:defineObjects /> in my portlet’s JSP in Liferay 5.2.2. I’ve included the <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> at the top of my jsp with <portlet:defineObjects /> on the following line. I included the util-taglib.jar in my WEB-INF/lib directory, yet I get the following error whenever I try to add the portlet to a page:


SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
	at com.sun.portal.portletcontainer.taglib.DefineObjectsTag.doStartTag(DefineObjectsTag.java:94)
	at org.apache.jsp.treeview_jsp._jspService(treeview_jsp.java:106)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)


I even modifed the web.xml file by adding:

<taglib>
		<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
		<taglib-location>/WEB-INF/tlds/portlet_2_0.tld</taglib-location>
	</taglib>



and copying the tld for 2.0 from the portletcontainer.jar file that came with the Liferay/tomcat bundle and put it in /WEB-INF/tlds/portlet_2_0.tld yet I get the same error. Can anyone show me the error of my ways?
Jakub Holy, geändert vor 15 Jahren.

RE: Problem using <portlet:defineObjects /> with portlet 2.0 spec

New Member Beiträge: 2 Beitrittsdatum: 19.03.09 Neueste Beiträge
For me <portlet:defineObjects /> works without problems however my setup differs from yours:
  • I have NOT put any liferay lib into my WEB-INF/lib, so util-taglib.jar also isn't there.
  • I do not have any taglib reference for the portlet taglib in my web.xml. Actually I had problems when it was there. Now I only have '<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>' in a JSP page and that's all. I suppose that the taglib implementation is stored somewhere on the classpath and that it includes the metadata that assigns it to the URI http://java.sun.com/portlet_2_0 and therefore no such entry in web.xml is needed. UPDATE: See <TOMCAT>/common/lib/ext/portlet-container.jar/META-INF/sun-portlet_2_0.tld -


I use Liferay 5.2.2 running on Tomcat 5.5.27 (as downloaded from Liferay.com).
Luca Andreatta, geändert vor 12 Jahren.

RE: Problem using <portlet:defineObjects /> with portlet 2.0 spec

Junior Member Beiträge: 33 Beitrittsdatum: 16.02.09 Neueste Beiträge
Hi Harold,
I have a similar problem as you, did you find a solution?
thumbnail
Felix J Christy, geändert vor 12 Jahren.

RE: Problem using <portlet:defineObjects /> with portlet 2.0 spec

Regular Member Beiträge: 111 Beitrittsdatum: 26.08.09 Neueste Beiträge
Hi,

Instead of <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

please try this


<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>

Thanks,
Felix
Luca Andreatta, geändert vor 12 Jahren.

RE: Problem using <portlet:defineObjects /> with portlet 2.0 spec

Junior Member Beiträge: 33 Beitrittsdatum: 16.02.09 Neueste Beiträge
Thank you,
but the problem was that my jsp was extending another class that caused the problem:
extends="it.eng.spago.dispatching.httpchannel.AbstractHttpJspPagePortlet"

Removing it solved the problem.

Thanks to all.