异常Java EE,GlassFish突然重新启动
我正在学习Java EE
首先,我将写一些我发现的例外情况,以及我解决它们的方法然后我将询问当前的异常
为了实现记录每个类和方法访问的方法,我编写了一个本地文件。首先我试了一下文件。编写类,然后我意识到它报告了一个EOFEException。我解决这个问题的方法是使用BufferedWriter:
private void writeLogToFile(String text, File file) throws IOException {
BufferedWriter output = null;
output = new BufferedWriter(new FileWriter(file, true));
output.write(text);
output.close();
}
然后,为了实现会话持久性,我设法将创建的课程和评估存储在用户的HttpSession中。然而,我看到它报告了isNotSerializable异常。为了解决这个问题,我在这两个类中都实现了Serializable,我们在会话中将其持久化为:
public class Evaluacion implements Serializable {
为了实现查看所有程序日志的页面,我使用了一个单例。然后,为了在用户每次访问页面时跟踪所有页面的统计信息,我们使用了另一个单例。困难在于,每次GlassFish启动时,第一个单例都会使用第二个单例,而JNDI无法找到它,因为它尚未部署。然后我使用@DependsOn标签
此外,GlassFish警告我,因为它很难钝化Statefull beans,因为我在方法中用@PrePassivate标记了一个对statistics Singleton的引用。所以我不得不移除身体的内容物。 其他类似问题:Passivation issue with Stateful Session Bean
现在的困难来了:每次我访问一个状态完整的数据库时,GlassFish都会突然重启
我的日志是:
Grave: The Class frontController.EvaluacionCommand having annotation javax.servlet.annotation.WebServlet need to be a derived class of javax.servlet.http.HttpServlet.
symbol: TYPE location: class frontController.EvaluacionCommand
Grave: The Class frontController.AlumnosCommand having annotation javax.servlet.annotation.WebServlet need to be a derived class of javax.servlet.http.HttpServlet.
symbol: TYPE location: class frontController.AlumnosCommand
Grave: The Class frontController.CuestionarioCommand having annotation javax.servlet.annotation.WebServlet need to be a derived class of javax.servlet.http.HttpServlet.
symbol: TYPE location: class frontController.CuestionarioCommand
Grave: The Class frontController.EncuestaCommand having annotation javax.servlet.annotation.WebServlet need to be a derived class of javax.servlet.http.HttpServlet.
symbol: TYPE location: class frontController.EncuestaCommand
Grave: The Class frontController.CourseInfoCommand having annotation javax.servlet.annotation.WebServlet need to be a derived class of javax.servlet.http.HttpServlet.
symbol: TYPE location: class frontController.CourseInfoCommand
我已经搜索过了,这是因为每个使用@WebServlet的类都需要实现HttpServlet
然而,我正在实现FrontServlet模式,我需要从FrontCommand抽象类扩展每个命令
所以我不能这样做:
class AlumnosCommand extends HttpServlet implements FrontCommand
我们怎样才能解决这个困难
谢谢你的帮助
共 (0) 个答案