【发布时间】:2018-07-12 14:12:42
【问题描述】:
在我的本地服务器上,我可以对我的服务器进行 api 调用,并且我可以看到这些值正在保存到数据库中。 但是当上线并使用实际的域地址时,我收到以下错误:
java.lang.NoClassDefFoundError: Could not initialize class d.d.util.HibernateUtil
我的 HibernateUtil.java 是:
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static final SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
return new Configuration().configure().buildSessionFactory();
}
catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static void shutdown() {
// Close caches and connection pools
getSessionFactory().close();
}
}
来自亚马逊的日志向我展示了其他东西:
Exception occurred during processing request: uid is required
java.lang.Exception: uid is required
at d.d.Pamper.action.GetUserProfileAction.execute(GetUserProfileAction.java:16) ~[classes/:?]
如果 UID 为 null,这是我自己抛出的异常。
【问题讨论】:
标签: java hibernate amazon-elastic-beanstalk