Forums de discussion

error while deploying spring portlet

ngo linh, modifié il y a 11 années.

error while deploying spring portlet

New Member Publications: 3 Date d'inscription: 15/12/12 Publications récentes
Hi all
I am creating a portlet using Spring and Hibernate to manage department infomation
I deployed my portlet, it available to install but when I install it on lifery, it throws an error like this:
ERROR [DispatcherPortlet:568] Could not complete request
javax.portlet.UnavailableException: No matching handler method found for portlet request: mode 'view', phase 'RENDER_PHASE', parameters map[[empty]]
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter$PortletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:438)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:327)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:318)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleRender(AnnotationMethodHandlerAdapter.java:266)
at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:742)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:531)
at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:479)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:534)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:607)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:359)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1207)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:97)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.doDispatch(PACLRequestDispatcherWrapper.java:90)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.include(PACLRequestDispatcherWrapper.java:54)
at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:5158)
at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:1569)
....
this is my controller class
import javax.portlet.ActionResponse;
import javax.portlet.RenderResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Validator;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.portlet.bind.annotation.ActionMapping;
import org.springframework.web.portlet.bind.annotation.RenderMapping;
import doan.dao.InstituteDAOImpl;
import doan.model.*;
@Controller(value="home")
@RequestMapping(value="VIEW")
public class HomeController {
@Autowired
private InstituteDAOImpl officeService;
public void setOfficeService(InstituteDAOImpl officeService){
this.officeService= officeService;
}
@RenderMapping
public String showHome(RenderResponse response){
return "home";
}
@ExceptionHandler({ Exception.class })
public String handleException() {
return "errorPage";
}
@ModelAttribute(value="offices")
public List<TBL_PHONG> getOffice(){
return officeService.list();
}
}
I built this portlet based on the Portlet in Action 's source code (chapter 8) and that example working fine
Can anyone help me please ?
I'm using spring 3.0.0 RELEASE
Thanks
thumbnail
jelmer kuperus, modifié il y a 11 années.

RE: error while deploying spring portlet

Liferay Legend Publications: 1191 Date d'inscription: 10/03/10 Publications récentes
What does your application context look like ?

Also make sure you use spring 3.0.5 or up , earlier versions have some nasty problems.
ngo linh, modifié il y a 11 années.

RE: error while deploying spring portlet

New Member Publications: 3 Date d'inscription: 15/12/12 Publications récentes
Hi jelmer
This is my application context
<?xml version="1.0"?>

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<context:component-scan base-package="doan"/>
<context:annotation-config/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
<property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property>
</bean>

<!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="dataSource">
<ref bean="myDataSource"></ref>
</property>
</bean> -->
<!-- <jee:jndi-lookup jndi-name="java:comp/env/jdbc/doan"
id="myDataSource" /> -->
<bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3307/doan"></property>
<property name="username" value="root"></property>
<property name="password" value="luckymouse"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="myDataSource"/>
<property name="annotatedClasses">
<list>
<value>doan.model.TBL_CONGTRINH</value>
<value>doan.model.TBL_DBLUONG</value>
<value>doan.model.TBL_DONVI</value>
<value>doan.model.TBL_HSLUONG</value>
<value>doan.model.TBL_KTKL</value>
<value>doan.model.TBL_LYLICH</value>
<value>doan.model.TBL_NHATKY</value>
<value>doan.model.TBL_PHONG</value>
</list>
</property>
</bean>
</beans>
I'm new to spring so I'm not sure this application context is right
And I followed your advice using spring 3.0.5 but I can't even deploy my portlet and getting this warning
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server: OfficeManagement-portlet' did not find a matching property.
ngo linh, modifié il y a 11 années.

RE: error while deploying spring portlet

New Member Publications: 3 Date d'inscription: 15/12/12 Publications récentes
I have even try using spring 3.1.3 but also get the same error
org.springframework.web.portlet.NoHandlerFoundException: No matching handler method found for portlet request: mode 'view', phase 'RENDER_PHASE', parameters map['p_v_g_id' -> array<String>['10179'], 'cmd' -> array<String>['add'], 'dataType' -> array<String>['json'], 'currentURL' -> array<String>['/'], 'doAsUserId' -> array<String>['']]
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter$PortletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:507)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:355)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:345)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleRender(AnnotationMethodHandlerAdapter.java:288)
at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:734)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:522)
at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:470)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
.......
thumbnail
Abhishek Jain, modifié il y a 6 années.

RE: error while deploying spring portlet

Regular Member Publications: 226 Date d'inscription: 20/08/16 Publications récentes
Did you find any solution? I am also facing the same problem.
thumbnail
Manish Yadav, modifié il y a 6 années.

RE: error while deploying spring portlet

Expert Publications: 493 Date d'inscription: 26/05/12 Publications récentes
Check Application context xml , might be you have not specified correct path of controller
thumbnail
Abhishek Jain, modifié il y a 6 années.

RE: error while deploying spring portlet

Regular Member Publications: 226 Date d'inscription: 20/08/16 Publications récentes
Hi Manish.. thanks for reply. But I gave correct path to my controller class and the portlet is also working fine. But when I restart the server, I get this NoHandlerException.. Do you have any idea about this?