[Liferay]springMVC在Liferay中出现过的问题:The requested resource () is not available
2013-08-14 12:00
543 查看
Spring 版本 3.0.5
Liferay 版本 6.1 GA2
在使用spring MVC 开发 portlet 时出现很奇怪的问题
完成配置文件,写Controller如下(未完成):
出现的异常 java.io.FileNotFoundException: The requested resource (/springmvc-sample-portlet/WEB-INF/servlet/view/portal/addressBooks) is not available
web.xml
其他配置文件没有任何问题,Liferay论坛上找到解决办法
在Liferay部署单个portlet的时候,会修改portlet里的web.xml,为了使portlet在Liferay中运行而加一些属性。这时候会产生个bug,自动添加的 listener 顺序不正确,所以为了解决这个问题我们需要手动修改server目录中的web.xml文件
例如:
修改为
问题解决
Liferay出现这个bug,估计是因为这个版本问题,之前开发spring mvc portlet使用的liferya版本为6.0-sp1,并未出现类似情况
Liferay 版本 6.1 GA2
在使用spring MVC 开发 portlet 时出现很奇怪的问题
完成配置文件,写Controller如下(未完成):
@Controller @RequestMapping("VIEW") public class ViewController { private final AddressBookService addressBookService; public ViewController() { this(new AddressBookServiceImpl()); } public ViewController(AddressBookService addressBookService) { this.addressBookService = addressBookService; } @RequestMapping public String listAddressBook(ModelMap model) { model.addAttribute( "addressBooks", this.addressBookService.getAllAddressBooks()); return "addressBooks"; } @RequestMapping(params = "action=view") public String viewAddressBook( @RequestParam("addressBook") int addressBookId, ModelMap model) { model.addAttribute("addressBook", this.addressBookService.getAddressBook(addressBookId)); return "addressBookView"; } }
出现的异常 java.io.FileNotFoundException: The requested resource (/springmvc-sample-portlet/WEB-INF/servlet/view/portal/addressBooks) is not available
web.xml
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>ViewRendererServlet</servlet-name> <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>ViewRendererServlet</servlet-name> <url-pattern>/WEB-INF/servlet/view</url-pattern> </servlet-mapping>
其他配置文件没有任何问题,Liferay论坛上找到解决办法
在Liferay部署单个portlet的时候,会修改portlet里的web.xml,为了使portlet在Liferay中运行而加一些属性。这时候会产生个bug,自动添加的 listener 顺序不正确,所以为了解决这个问题我们需要手动修改server目录中的web.xml文件
例如:
tomcat/webapps/your-portlet/WEB-INF/web.xml
修改为
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener</listener-class> </listener> <listener> <listener-class>com.liferay.portal.kernel.servlet.PluginContextListener</listener-class> </listener>
问题解决
Liferay出现这个bug,估计是因为这个版本问题,之前开发spring mvc portlet使用的liferya版本为6.0-sp1,并未出现类似情况
相关文章推荐
- "The requested resource (... processLogin.action) is not available"的问题所在及解决办法
- The requested resource (Servlet action is not available) is not available.这个问题让我通宵了一个晚上
- javaee中.jsp的文件存放错误出现jsp the requested resource is not available.
- 使用struts2后出现“The requested resource is not available”
- 8、arcserver中出现Error: HTTP Status 404 /arcgis/rest: The requested resource (/arcgis/rest/) is not available
- SSH+Oracle整合问题7,description The requested resource (/PetDogIMS/open) is not available.
- struts2 The requested resource is not available.问题
- Tomcat6.0.18下出现The requested resource(/)is not available
- jsp java web使用struts2后出现“The requested resource is not available”
- jsp出现404(The requested resource is not available.)
- eclipse新建web项目运行时出现The requested resource is not available异常
- Spring项目中The requested resource is not available问题
- Tomcat6.0.18下出现The requested resource(/)is not available
- servlet web.xml配置好以后还会出现 the requested resource is not available错误的可能原因
- Tomcat6.0.18下出现The requested resource(/)is not available
- 出现The requested resource is not available.错误
- 因配置不对,导致出现The requested resource is not available的解决方法
- tomcat与struts2配置,解决了The requested resource is not available问题
- Tomcat7下出现The requested resource(/)is not available
- eclipse新建web项目运行时出现The requested resource is not available异常