java.lang.NoSuchMethodError:org.springframework.web.portlet.context.ConfigurablePortletApplicationContext.setId(Ljava/lang/String;)V [英] java.lang.NoSuchMethodError: org.springframework.web.portlet.context.ConfigurablePortletApplicationContext.setId(Ljava/lang/String;)V

查看:146
本文介绍了java.lang.NoSuchMethodError:org.springframework.web.portlet.context.ConfigurablePortletApplicationContext.setId(Ljava/lang/String;)V的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在jboss-portal-2.7.2上部署我的应用程序,这给了我以下错误:

I'm trying to deploy my application on jboss-portal-2.7.2, and it is giving me the following error:

04:17:23,879 INFO  [DispatcherPortlet] FrameworkPortlet 'my_portlet': initialization started
04:17:23,882 ERROR [LifeCycle] Cannot start object
org.jboss.portal.portlet.container.PortletInitializationException: The portlet my_portlet threw an error during init
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:292)
    at org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle.invokeStart(PortletContainerLifeCycle.java:76)
    at org.jboss.portal.portlet.impl.container.LifeCycle.managedStart(LifeCycle.java:92)
    at org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle.startDependents(PortletApplicationLifeCycle.java:351)
...
    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
Caused by: java.lang.NoSuchMethodError: org.springframework.web.portlet.context.ConfigurablePortletApplicationContext.setId(Ljava/lang/String;)V
    at org.springframework.web.portlet.FrameworkPortlet.createPortletApplicationContext(FrameworkPortlet.java:345)
    at org.springframework.web.portlet.FrameworkPortlet.initPortletApplicationContext(FrameworkPortlet.java:294)
    at org.springframework.web.portlet.FrameworkPortlet.initPortletBean(FrameworkPortlet.java:268)
    at org.springframework.web.portlet.GenericPortletBean.init(GenericPortletBean.java:116)
    at javax.portlet.GenericPortlet.init(GenericPortlet.java:107)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.initPortlet(PortletContainerImpl.java:417)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:256)
    ... 76 more

有人知道如何解决此问题吗?

Does anyone know how to fix this?

MainController:

MainController:

package myportlet.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.portlet.bind.annotation.RenderMapping;
import org.apache.commons.lang.StringUtils;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
import javax.portlet.PortletSession;
import java.util.LinkedList;
import java.util.List;

@RequestMapping(value = "VIEW")
@Controller(value = "mainController")
public class MainController {

    @RenderMapping
    public String init(@RequestParam(value = "key", required = false) String key, Model model, PortletRequest request) throws Exception {
        PortletSession session = request.getPortletSession();

        /* Get Key from Portlet Preferences */
        PortletPreferences preferences = request.getPreferences();
        String preferencesKey = preferences.getValue(constants.KEY, constants.FACTORY);
        if(StringUtils.isEmpty(key)) {
            key = preferencesKey;
        }

        /* Save current KEY into session */
        session.setAttribute(constants.KEY, key, PortletSession.APPLICATION_SCOPE);

        model.addAttribute("entityList", getEntities());
        model.addAttribute("preferencesKey", preferencesKey);
        return "index";
    }
}

pom.xml

推荐答案

Caused by: java.lang.NoSuchMethodError: org.springframework.web.portlet.context.ConfigurablePortletApplicationContext.setId(Ljava/lang/String;)V

听起来您正在使用旧版本的spring-context.jar

It sounds like you are using a old version of spring-context.jar Spring Context API - Version 2.0.x.

尝试使用更高版本 Spring上下文API-版本3.0.x .

这篇关于java.lang.NoSuchMethodError:org.springframework.web.portlet.context.ConfigurablePortletApplicationContext.setId(Ljava/lang/String;)V的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆