Closed henning-gerhardt closed 8 years ago
Affected version: Goobi.Production CE 1.11.x, current GitHub master and maybe Goobi.Production CE 1.10.x
As far as I understand ExportXmlLog
ll. 240−244 catching and throwing away the exception should result in the intended behaviour.
This may be an inconsitency between the two methods of database access. StepObject
declares bearbeitungsbenutzer
as int
, which so can never be null
. It is persisted in MySQLHelper
ll. 270−280. May be that a step without a user associated may be set to 0
here, and the Hibernate part then tries to load an absent user with row number 0
. Do you eventually have debug log lines from MySQLHelper containing saving step:
which can prove this?
Hibernate bug HHH-7205. Hibernate should return null
here and not throw an exception. Recommended work-around is to wrap the problematic section in a try/catch block.
I can't follow your analysis.
ExportXmlLog in lines L218-L250 are using bean based objects, so object s
is from de.sub.goobi.beans.Schritte
and has method getBearbeitungsbenutzer()
. Method getBearbeitungsbenutzer()
is returning a class object Benutzer
from de.sub.goobi.beans.Benutzer
which have a method called getNachVorname()
.
Why now calling s.getBearbeitungsbenutzer().getNachVorname()
is causing an error, is a good question.
I set a debugging breakpoint in MySQL Helper method updateStep()
but this method is never called while printing a docket for a batch nor a message got logged.
This is due to how hibernate works. The object returned from s.getBearbeitungsbenutzer()
is in fact a subclass of the Benutzer
object generated by Hibernate at runtime (class name: Benutzer_$$_javassist_12
). This so-called proxy object does not contain any data, just the row number from the BearbeitungsBenutzerID
field of the Schritt
object. The real object is not loaded from the database until it is accessed. This is called lazy initialization. In the moment you access getNachVorname()
Hibernate tries to load the object, finds out that there is no row 0
in the table benutzer
and throws an exception. (This behaviour is also reflected in the stack trace.)
My analysis was about how the 0
could have come into the BearbeitungsBenutzerID
field. It should not be there, I think, the field value should probably be null
, obviously 0
is interpreted as an acceptable row number. Or someone deleted the user account which was row 0
on your system. But I assume the 0
came there automatically. If so, it’s a bug.
Thank you for this explanation. I saw while debugging some lazy init usage but misinterpreted this.
I will debug this deeper to get some more information.
Maybe I found an explanation why there is a 0
instead of NULL
:
NULL
if this step must be worked onBearbeitungsBenutzerID
is some integer valueBearbeitungsBenutzerID
has value 0
which trigger an exception.I see there tree different solutions:
BearbeitungsBenutzerID
is 0
and not NULL
In commit https://github.com/henning-gerhardt/goobi-production/commit/431369beef6f7684eb1bc1ca72fea2b2e69efa8c I implemented solution three.
Maybe there is an way to implement solution one?
@matthias-ronge : Want is your opinion to my change or in general my proposed solutions?
Some notes and maybe possible bugs:
BearbeitungsBenutzerID
with value NULL
(default value inside database)BearbeitungsbenutzerID
with value 0
in progress
to open
does not reset BearbeitungsBenutzerID
to NULL
.An other curiosity: automatic steps could have an user assigned with id 0
. This id value caused even a hibernate exception.
After selecting a batch and start to print a docket of this selected batch, the browser shows only a 404 error page (File not found) as generating of PDF are failing.
docket_multipage.xsl
is inside configuredxsltFolder
directory and is not modified.I could track it down to line 240 in ExportXmlLog class.
If I sorround this piece of code with a try catch block and let me output the stack trace, following trace appear
Mentioned line 241 in ExportXmlLog is line 240 in unmodified file.