在tomcet tomcat中部署的j2ee应用程序中出错

时间:2011-04-19 09:19:43

标签: tomcat servlets

  

可能重复:
  Java application stops working and giving exception

嗨其实我之前也发过这个问题,tomcat给出了以下错误

java.lang.NoClassDefFoundError
com.lexmark.efoundations.lxpd.gui.struts.ActionServlet.init(Unknown Source)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
java.lang.Thread.run(Thread.java:595)

但是一旦我检查了班级" com.lexmark.efoundations.lxpd.gui.struts.ActionServlet"在" init"方法下面的代码部分未加载 -

static {
    try {
        // Create SessionFactory
        sessionFactory = new Configuration().configure().buildSessionFactory();
    } catch (HibernateException ex) {
        Log.fatal("Hibernate Configuration Problem: " + ex.getMessage());
        throw new RuntimeException("Probleme de configuration : " + ex.getMessage());
    }
}

public static final ThreadLocal session = new ThreadLocal();

public static Session currentSession() throws HibernateException {
    Session s = (Session) session.get();
    System.out.println("into current session");
    // Ouvre une nouvelle Session, si ce Thread n'en a aucune
    if (s == null) {
        s = sessionFactory.openSession();
        session.set(s);
    }
    return s;
}

上面的代码是从init方法调用的。 任何人都可以建议为什么?

0 个答案:

没有答案