liferay重新部署:重新部署时根上下文为空

liferay重新部署:重新部署时根上下文为空,liferay,root,liferay-6,applicationcontext,redeploy,Liferay,Root,Liferay 6,Applicationcontext,Redeploy,我有一个web应用程序,几乎没有spring Portlet。每个portlet都有一个xml及其声明的控制器,但控制器使用的服务放在applicationContext.xml中。我知道,对于每个portlet,都创建了一个spring应用程序上下文(来自自己的xml文件),并且每个该上下文都有一个根上下文,即从applicationContext.xml创建的spring应用程序上下文。也就是说,applicationContext.xml中声明的所有bean对于所有portlet都是通用的

我有一个web应用程序,几乎没有spring Portlet。每个portlet都有一个xml及其声明的控制器,但控制器使用的服务放在applicationContext.xml中。我知道,对于每个portlet,都创建了一个spring应用程序上下文(来自自己的xml文件),并且每个该上下文都有一个根上下文,即从applicationContext.xml创建的spring应用程序上下文。也就是说,applicationContext.xml中声明的所有bean对于所有portlet都是通用的

让我们举个例子:

portlet的xml文件示例portlet.xml: ...

controller示例controller.java

package example.controller;
@Controller
@RequestMapping(value = "VIEW")
public class NavigareController {

@Autowired
private ExampleService es;
...
}
...
<context:component-scan base-package="example.service />
...
package example.service;
@Service
public class ExampleServiceImpl implements ExampleService {
...
}
applicationContext.xml

package example.controller;
@Controller
@RequestMapping(value = "VIEW")
public class NavigareController {

@Autowired
private ExampleService es;
...
}
...
<context:component-scan base-package="example.service />
...
package example.service;
@Service
public class ExampleServiceImpl implements ExampleService {
...
}
当服务器启动内部的应用程序时,应用程序启动,一切正常。重新部署应用程序时,我有一个错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exampleController'...
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private example.service.ExampleService...
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [example.service.ExampleService]...
结果,portlet没有启动

我已经调试了lifery的源代码,发现了以下代码:

package org.springframework.web.portlet
...
public abstract class FrameworkPortlet extends GenericPortletBean
implements ApplicationListener<ContextRefreshedEvent> {
...
protected ApplicationContext initPortletApplicationContext() {
ApplicationContext parent = PortletApplicationContextUtils.getWebApplicationContext(getPortletContext());
ApplicationContext pac = createPortletApplicationContext(parent);
...
Object attr = pc.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
因此,在第一种情况下,该属性在portlet上下文中,但在第二种情况下,它不在portlet上下文中。问题很明显,在null父级中找不到exampleService bean


问题是:热部署过程中是否存在任何bug?。请帮帮我

您对Liferay的看法是什么?如果是6.1.1,则这是一个已知问题

如果只需要部署一次portlet,请按照票证中的建议手动更改web.xml中侦听器的顺序


如果您需要重新部署Portlet(用于开发),那么以前的解决方案非常耗时,最简单的方法是从6.2.0分支向后移植修复程序。

您能给出所得到错误的完整堆栈跟踪吗?liferay的版本是什么?哪一个liferay捆绑包tomcat、jboss或glassfish等?您是否可以通过以下方式获得解决此问题的提示: