1
我試圖在jboss-portal-2.7.2上部署我的應用程序,給我以下錯誤:java.lang.NoSuchMethodError:org.springframework.web.portlet.context.ConfigurablePortletApplicationContext.setId(Ljava/lang/String;)V
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
有誰知道如何解決這個問題?
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";
}
}
我使用Spring MVC框架3.0.4.RELEASE。我的pom.xml:http://pastebin.com/35Efzzrc – abg 2012-07-26 03:41:08
你使用profile local_test嗎?請確保您使用的是JBoss服務器正確春季版(JBoss的/ lib目錄),或從項目的pom.xml提供 簡單地刪除(下輪廓local_test)。 –
yorkw
2012-07-26 03:52:07
我檢查了portlet的內容。實際上有兩個版本的spring-context - http://3.firepic.org/3/images/2012-07/26/uqb65sn5veam.png我不明白他是如何進入portlet的。我刪除下輪廓local_test提供 從pom.xml的,但它沒有任何效果。 –
abg
2012-07-26 06:21:22