Yesterday I upgraded to Version 2.6.2_06.
In addition I compared the spring configuration of this project with other projects. I think I found the solution. Now the error isn't happening anymore.
I don't understand it fully.
This are the annotations of the config class:
@SpringBootApplication
@EnableSpringConfigured
@EnableJpaRepositories("at.co.pjm.tracker.data")
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
@Import(RepositoryHazelcastConfig.class)
What I added is the @EnableSpringConfigured annotation. It just doesn't makes sense. In this project we aren't using AspectJ enhanced @Configurable classes. Yeah but now the error went away. I think it's a bug in Spring. @EnableTransactionManagement(mode = AdviceMode.ASPECTJ) should be enough to to tell Spring that the DAOs are enhanced by AspectJ. I really have no idea why this lead to a such a weird behavior. In fact the transaction manager which is also responsible for assigning exactly one entity manager to every transaction stops to work correctly. I also found multiple examples on the Internet where they don't have to use this workaround.
I also had a look on an older revision with XML configuration. We haven't had the XML counterpart of @EnableSpringConfigured there.
One thing is still happening.
public void login(TrackerUser loggedInUser, AccessType accessType, String note) {
LoginEvent event = new LoginEvent();
event.setAccessType(AccessType.REST);
event.setNote(note);
event.setTimestamp(new Date());
if(accessType != null) {
event.setAccessType(accessType);
}
event.setTrackerUser(loggedInUser);
loggedInUser.setLastLogin(event.getTimestamp());
trackerUserDAO.persistUser(loggedInUser);
loginDAO.save(event);
}
This is the only method in which we persist an LoginEvent. Again it's only happening in this project. Our frontend webapp also calls this on every login. The exception is rather unusual because it doesn't say where in the code it's happening.
com.objectdb.o.UserException: Attempt to reuse an existing primary key value (at.co.pjm.tracker.persistence.LoginEvent:0)
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.PPW.ao(PPW.java:207)
at com.objectdb.o.PGW.aj(PGW.java:211)
at com.objectdb.o.UPT.C(UPT.java:134)
at com.objectdb.o.UPT.l(UPT.java:110)
at com.objectdb.o.TSK.i(TSK.java:145)
at com.objectdb.o.TSK.f(TSK.java:95)
at com.objectdb.o.UPT.s(UPT.java:157)
at com.objectdb.o.PGT.q(PGT.java:109)
at com.objectdb.o.UPT.C(UPT.java:121)
at com.objectdb.o.UPT.l(UPT.java:110)
at com.objectdb.o.TSK.i(TSK.java:145)
at com.objectdb.o.TSK.f(TSK.java:95)
at com.objectdb.o.UPT.s(UPT.java:157)
at com.objectdb.o.PGT.q(PGT.java:109)
at com.objectdb.o.UPT.C(UPT.java:121)
at com.objectdb.o.URT.l(URT.java:171)
at com.objectdb.o.TSK.i(TSK.java:145)
at com.objectdb.o.TSK.f(TSK.java:95)
at com.objectdb.o.TSM.e(TSM.java:86)
at com.objectdb.o.UTT.A(UTT.java:370)
at com.objectdb.o.UTT.l(UTT.java:208)
at com.objectdb.o.TSK.i(TSK.java:145)
at com.objectdb.o.TSK.f(TSK.java:95)
at com.objectdb.o.TSM.e(TSM.java:86)
at com.objectdb.o.MST.Vh(MST.java:1393)
at com.objectdb.o.WRA.Vh(WRA.java:396)
at com.objectdb.o.WSM.Vh(WSM.java:184)
at com.objectdb.o.WRA.Vh(WRA.java:396)
at com.objectdb.o.WSN.Vh(WSN.java:661)
at com.objectdb.o.STC.v(STC.java:514)
at com.objectdb.o.SHN.an(SHN.java:562)
at com.objectdb.o.SHN.K(SHN.java:169)
at com.objectdb.o.HND.run(HND.java:133)
at java.lang.Thread.run(Thread.java:745)
It only happens from time to time. Not at every login. Before upgrading to _06 i thought it might be bug 256 but its obviously not.
Additionally this exception got raised multiple times during the day:
com.objectdb.o.InternalException: Error reading UTF string
at com.objectdb.o.BYR.N(BYR.java:1216)
at com.objectdb.o.BYR.N(BYR.java:522)
at com.objectdb.o.BYR.M(BYR.java:503)
at com.objectdb.o.BYR.T(BYR.java:630)
at com.objectdb.o.TRS.k(TRS.java:273)
at com.objectdb.o.QRS.u(QRS.java:350)
at com.objectdb.o.CST.Vb(CST.java:610)
at com.objectdb.o.QRR.g(QRR.java:247)
at com.objectdb.o.QRR.f(QRR.java:153)
at com.objectdb.jpa.JpaQuery.getSingleResult(JpaQuery.java:747)