我有一个成功部署的Liferay SpringMVC Portlet,但我必须将此portlet放在包含另外32个组件的其他portlet中。 在此组件内部,未部署我的portlet,导致以下错误:
12:36:11,780 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ibermutua-portlet].[view-servlet]] (http-localhost/127.0.0.1:8080-4) JBWEB000236: Servlet.service() for servlet view-servlet threw exception: javax.servlet.ServletException: Could not complete render request: View is null
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) 12:36:11,791 ERROR [http-localhost/127.0.0.1:8080-4][render_portlet_jsp:132] null
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) javax.portlet.PortletException
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:614)
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:677)
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:379)
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1201)
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:69)
12:36:11,791 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:365)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:309)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:242)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:832)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:718)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:655)
12:36:11,792 INFO [stdout] (http-localhost/127.0.0.1:8080-4) at com.liferay.portal.servlet.DirectServletPathRegisterDispatcher.include(DirectServletPathRegisterDispatcher.java:55)
我的liferay-portlet.xml。
<portlet>
<portlet-name>33</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
<private-session-attributes>false</private-session-attributes>
<header-portlet-css>/css/main.css</header-portlet-css>
<header-portlet-javascript>/js/jquery-1.12.1.min.js</header-portlet-javascript>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
</portlet>
我的web.xml
<servlet>
<servlet-name>view-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>view-servlet</servlet-name>
<url-pattern>/33/*</url-pattern>
</servlet-mapping>
我的portlet.xml
<portlet>
<portlet-name>33</portlet-name>
<display-name>AgregadoresContenidos</display-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/portlets/33-agregadores-contenidos/confInicial.jsp</value>
</init-param>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/contexts/AgregadoresContenidos-portlet.xml</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
<resource-bundle>content.Language</resource-bundle>
<portlet-info>
<title>AgregadoresContenidos</title>
<short-title>AgregadoresContenidos</short-title>
<keywords>AgregadoresContenidos</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
KInd问候,