Hibernate version:3.0.5 (also happens in 3.1)
Full stack trace of any exception that occurs:
java.lang.NullPointerException
at org.hibernate.engine.PersistenceContext.getSnapshot(PersistenceContext.java:832)
at org.hibernate.collection.AbstractPersistentCollection.getSnapshot(AbstractPersistentCollection.java:289)
at org.hibernate.collection.PersistentSet.needsInserting(PersistentSet.java:290)
at insl.db.farm.UserFarm.setUser(UserFarm.java:526)
at insl.web.action.UserAction.doUserSubmitSave(UserAction.java:791)
at insl.web.action.UserAction.doUserSubmit(UserAction.java:599)
at insl.web.action.UserAction.execute(UserAction.java:105)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
There is no further log4j output even though I've set Hibernate logging to Debug level
Name and version of the database you are using: MySQL 4.1
Where the error happens:
try {
session.setFlushMode(FlushMode.COMMIT);
// Audit
oldObject = (User)session.get(user.getClass().getName(), user.getId());
// Audit
AuditFarm.setAudit(AuditUtil.createAudit(httpSession, user.getDomain().getId(), user.getCompany().getId(), AuditType.DB_INTEREST, user.getId(), AuditType.USER_UPDATE, oldObject, user));
session.merge(user);
// for updated users just check the aliases for introduced duplicates.
org.hibernate.collection.PersistentSortedSet aliases =
(org.hibernate.collection.PersistentSortedSet) user.getAliases();
if (aliases != null) {
try {
for (Iterator iterator = aliases.iterator(); iterator.hasNext();) {
Object o = (Object) iterator.next();
/*error here*/ if (aliases.needsInserting(o, 0, Hibernate.STRING)) {
checkForDuplicates(session, (String) o);
} else if (aliases.needsUpdating(o, 0, Hibernate.STRING)) {
checkForDuplicates(session, (String) o);
}
}
s_log.info("Updating User - " + user);
} catch (DuplicateDBEntryException e) {
throw e;
}
}
} finally {
session.setFlushMode(FlushMode.AUTO);
}
Where aliases is defined and used
public class User implements Auditable, PolicyContainer, com.insl.webmail.bo.User, Serializable {
private static final Logger s_log = Logger.getLogger(User.class);
private int userId;
private int webmailUserId;
private String emailAddr;
private String fullName;
private boolean admin, adminINSL, adminSuper, auditor, developer;
private boolean mySQLUser;
private int uid, gid;
private String phone, mobile;
private String mailServer, mailbox, quarAddr, location, country;
private int aliasId;
private boolean reportAccess = false;
private boolean logSearchAccess = false;
private boolean adminDeletable = true;
private String groupName;
private Policy policy;
private Company company;
private OU domain;
/**
* This is a set of strings.
*/
private SortedSet aliases = new TreeSet();
/**
* This is a set of strings.
*/
private SortedSet aliases = new TreeSet();
...
...
...
/**
* Returns a set of Strings. These are the aliases for this user.
*
* @return the sorted aliases.
*/
public SortedSet getAliases() {
return aliases;
}
Any ideas/comments Very much appreciated as this is a live problem.
Cheers
Rfee42
|