我正在构建一个Java EE Web应用程序。偶尔我会收到像这样的错误
JBAS011006:未安装可选组件com.example.MyServlet 由于异常:[..] DeploymentUnitProcessingException:JBAS011054: 无法找到类
的默认构造函数
但是,com.example.MyServlet对我的应用程序非常重要。我如何标记它是强制性的?
编辑:com.example.MyServlet;我以前没有把它包括在内,因为我想要一般的答案。
/**
* Class to use JSR299 in ServiceLocators
*/
@WebServlet(value = "/gwtRequest", name = "InjectingRequestFactoryServlet")
//<!-- You'll need to compile with -extras and move the symbolMaps directory
// to this location if you want stack trace deobfuscation to work -->
@WebInitParam(name = "symbolMapsDirectory", value = "WEB-INF/classes/symbolMaps/")
public class InjectingRequestFactoryServlet extends RequestFactoryServlet {
@Inject
public InjectingRequestFactoryServlet(InjectingServiceDecorator serviceDecorator) {
super(new DefaultExceptionHandler(), serviceDecorator);
}
}