2012-10-20 2 views
-1

Снова возникает проблема с тем же, когда вы вызываете одну функцию добавления с другим пользовательским портлетом. У меня есть один метод в моем классе портлетов с addrestaurant (ресторан), и когда я вызываю это из своего представления, чтобы добавить данные, это дает мне следующую ошибку.Как решить этот java.lang.NoSuchMethodException: com.liferay.util.bridges.mvc.MVCPortlet. #######?

05:27:42,752 ERROR [http-bio-8080-exec-4][render_portlet_jsp:154] java.lang.NoSuchMethodException: com.liferay.util.bridges.mvc.MVCPortlet.addrestaurant(javax.portlet.ActionRequest, javax.portlet.ActionResponse) 
    at java.lang.Class.getMethod(Class.java:1605) 
    at com.liferay.portal.kernel.util.MethodCache._get(MethodCache.java:123) 
    at com.liferay.portal.kernel.util.MethodCache.get(MethodCache.java:45) 
    at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:149) 
    at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:250) 
    at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:80) 
    at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:220) 
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70) 
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48) 
    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) 

я был проверить все вещи, но до сих пор нет причин я обнаружил, что, почему это happening..dont знать каждый его приход, когда я создать новый портлет ..

Ниже мой класс restaurantportlet.java

public class RestaurantPortlet extends MVCPortlet { 

    private static Log log = LogFactory.getLog(RestaurantPortlet.class); 
    private static String errorJSP="/jsps/error.jsp" ; 

    public void addrestaurant(ActionRequest request, ActionResponse response) { 

     log.info("Inside addRegistration"); 
     List<String> errors=new ArrayList<String>(); 


     restaurant rest=RestaurantActionUtil.getRestaurantFromRequest(request); 
     boolean bookValid=RestaurantValidator.validateRestaurant(rest,errors); 
     if(bookValid) { 
      try { 
       log.info(rest); 
       restaurant test=restaurantLocalServiceUtil.addrestaurant(rest); 
       if(test==null) { 
        log.error("Restaurant was Found Null"); 
        response.setRenderParameter("jspPage", errorJSP); 
        return ; 
       } 
      } catch (SystemException e) { 
       log.error(e); 
       /*If there is an error then divert the control to the error page.*/ 
       response.setRenderParameter("jspPage", errorJSP); 
       return ; 
      } 
      SessionMessages.add(request,"restaurant-added"); 
      return ; 
     } 
     else { 
      for (String error : errors) { 
        SessionErrors.add(request, error); 
       } 
       SessionErrors.add(request, "error-while-adding"); 
       request.setAttribute("rest",rest); 
       return ; 
     } 

    } 

Ниже мой restaurantImpl.java класс

*/ 
public class restaurantLocalServiceImpl extends restaurantLocalServiceBaseImpl { 
    /* 
    * NOTE FOR DEVELOPERS: 
    * 
    * Never reference this interface directly. Always use {@link emenu.advertise.database.service.restaurantLocalServiceUtil} to access the restaurant local service. 
    */ 
    public restaurant addrestaurant(restaurant restParam) { 
     restaurant restVar; 

     try { 
      restVar = restaurantPersistence.create(counterLocalService 
        .increment(advertise.class.toString())); 
     } catch (SystemException e) { 
      e.printStackTrace(); 
      return restVar = null; 
     } 

     try { 
      resourceLocalService.addResources(restParam.getGroupId(), restParam.getUserId(), 
        advertise.class.getName(), false); 
     } catch (PortalException e) { 
      e.printStackTrace(); 
      return restVar = null; 
     } catch (SystemException e) { 
      e.printStackTrace(); 
      return restVar = null; 
     } 

     restVar.setName(restParam.getName()); 
     restVar.setAdress(restParam.getAdress()); 
     restVar.setCity(restParam.getCity()); 
     restVar.setPin(restParam.getPin()); 
     restVar.setState(restParam.getState()); 
     restVar.setCountry(restParam.getCountry()); 
     restVar.setContactno(restParam.getContactno()); 
     restVar.setEmail(restParam.getEmail()); 
     restVar.setWebsite(restParam.getWebsite()); 
     restVar.setCuisinetype(restParam.getCuisinetype()); 
     restVar.setPersonalmail(restParam.getPersonalmail()); 
     restVar.setPersonalname(restParam.getPersonalname()); 
     restVar.setPersonalPhone(restParam.getPersonalPhone()); 
     restVar.setNoofemenuagent(restParam.getNoofemenuagent()); 
     restVar.setLicensekey(restParam.getLicensekey()); 
     restVar.setRestregId(restParam.getRestId()); 
     restVar.setNoofdiningtable(restParam.getNoofdiningtable()); 
     restVar.setAvgnoofcustomermonthly(restParam.getAvgnoofcustomermonthly()); 
     restVar.setAveragroupagevisit(restParam.getAveragroupagevisit()); 
     restVar.setImpoflocation(restParam.getImpoflocation()); 
     restVar.setAvgmonthlycheckamount(restParam.getAvgmonthlycheckamount()); 
     restVar.setCostperthousandimpression(restParam.getCostperthousandimpression()); 
     restVar.setAdtypeId(restParam.getAdtypeId()); 
     //restVar.setNoofdiningtable(restParam.getNoofdiningtable()); 
     //restVar.setAvgnoofcustomermonthly(restParam.getAvgnoofcustomermonthly()); 


     restVar.setIsactive(restParam.getIsactive()); 
     restVar.setCreateddate(restParam.getCreateddate()); 
     restVar.setLastmodifiedby(restParam.getLastmodifiedby()); 
     restVar.setModifieddate(restParam.getModifieddate()); 
     restVar.setGroupId(restParam.getGroupId()); 
     restVar.setUserId(restParam.getUserId()); 
     restVar.setIsdeleted(restParam.getIsdeleted()); 
     restVar.setRestregId(restParam.getRestregId()); 

     //restVar.setOrganizationId(restParam.getOrganizationId()); 

     try { 
      return restaurantPersistence.update(restVar, false); 
     } catch (SystemException e) { 
      e.printStackTrace(); 
      return restVar = null; 
     } 
    } 

Далее Мой restuarntActionutil класс

public class RestaurantActionUtil { 



     public static restaurant getRestaurantFromRequest(ActionRequest request) { 
      ThemeDisplay themeDisplay = (ThemeDisplay) request 
        .getAttribute(WebKeys.THEME_DISPLAY); 
      String name = ParamUtil.getString(request, "name", 
        "name Not Availible"); 
        restaurant rest = new restaurantImpl(); 
      rest.setName(name); 
      rest.setLicensekey(ParamUtil.getString(request, "licesnce_key")); 
      rest.setCity(ParamUtil.getString(request, "city")); 
      rest.setPin(ParamUtil.getString(request, "pin")); 
      rest.setAdress(ParamUtil.getString(request, "adress")); 
      rest.setState(ParamUtil.getString(request, "state")); 
      rest.setCountry(ParamUtil.getString(request, "country")); 
      rest.setContactno(ParamUtil.getString(request, "contact_no")); 
      rest.setEmail(ParamUtil.getString(request, "email")); 
      rest.setWebsite(ParamUtil.getString(request, "website")); 
      rest.setCuisinetype(ParamUtil.getString(request, "cuisine_type")); 
      rest.setNoofemenuagent(ParamUtil.getInteger(request, "no_of_emenu_agent")); 
      rest.setNoofdiningtable(ParamUtil.getInteger(request, "no_of_dining_table")); 
      rest.setPersonalname(ParamUtil.getString(request, "personal_name")); 
      rest.setPersonalPhone(ParamUtil.getString(request, "personal_phone")); 
      rest.setPersonalmail(ParamUtil.getString(request, "personal_mail")); 
      rest.setAveragroupagevisit(ParamUtil.getInteger(request, "avg_age_group_people")); 
      rest.setImpoflocation(ParamUtil.getString(request, "imp_of_location")); 
      rest.setAvgnoofcustomermonthly(ParamUtil.getInteger(request, "avg_no_of_cust_monthly")); 
      rest.setAvgmonthlycheckamount(ParamUtil.getInteger(request, "avg_monthly_check_amount")); 
      rest.setAvgmonthlycheckamount(ParamUtil.getLong(request, "cost_per_thousand_impressions")); 
      rest.setAdtypeId(ParamUtil.getInteger(request, "ad_type")); 
      rest.setIsactive(ParamUtil.getBoolean(request, "isactive")); 
      rest.setGroupId(themeDisplay.getLayout().getGroupId()); 
      rest.setUserId(themeDisplay.getUserId()); 
      rest.setCreateddate(Calendar.getInstance().getTime()); 
      rest.setModifieddate(Calendar.getInstance().getTime()); 
      rest.setLastmodifiedby(themeDisplay.getUserId()); 
      rest.setRestregId((ParamUtil.getLong(request, "licensekey"))); 
      rest.setIsdeleted(false); 



         return rest; 
     } 


    } 

Ниже мой View.jsp код, из которого вызывается этот метод ..

<liferay-portlet:actionURL name="addrestaurant" var="addrestoURL"></liferay-portlet:actionURL> 

         <form class="form_validation_ttip" action="<%= addrestoURL.toString()%>" method="post">    

это моя кнопка в форме.

<button class="btn" name="btnback" >Save</button> 

пожалуйста, кто может вести меня ?? Мне нужно найти основную причину this..so со следующего времени я буду иметь в виду, о том, где я делаю ошибку ..

ответ

0

Вы можете поставить свой portlet.xml Вот? Похоже, что вы не указали свой класс, поэтому Liferay попытался использовать класс MVCPortlet по умолчанию. И, конечно, нет метода addrestaurant(). Это не проблема с кодом, а проблема с конфигурацией.

Смежные вопросы