---
title: "WebLogic10部署struts2使用注解问题 "
author: "zhouxingfu520"
date: "2013-05-08T15:18:03Z"
tags: []
categories: ["编程语言"]
slug: "weblogic10-struts2"
draft: false
lastmod: "2013-05-08T15:18:50Z"
id: 1863526
url: "https://zhoualine.iteye.com/blog/1863526"
---

这两天部署了一个使用了convention约定插件的SSH项目到WebLogic10，打开后第一个登陆页面，控制台报错

NullPointerException at org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownActionMethod

 问题的原因：weblogic10以后在加载项目时会把WEB-INF下的classes目录打成jar包。并删除classes目录下的内容。   
  struts2.18的Action注解要找jar包，需要jar包内有META-INF/Manifest文件，内容无所谓但要有，因此会造成一般的 struts项目放到Webligic上后注解不生效，报错提示There is no Action mapped for namespace / and action name XXX。

解决办法：

改动在src目录下添加META-INF/Manifest文件，我是直接用解压软件打开项目的WAR包，拖入目录META-INF，然后保存

![](http://img.my.csdn.net/uploads/201209/07/1347006051_2919.JPG)

在struts.xml添加如下设置：

&lt;constant name="struts.convention.action.includeJars" value=".\*\_wl\_cls\_gen.\*"/&gt;  
&lt;constant name="struts.convention.action.fileProtocols" value="jar,zip" /&gt;

 

原文 http://blog.csdn.net/gl74gs48/article/details/7955533