Start up error: Expected BEGIN_OBJECT but was STRING

3,256 views
Skip to first unread message

d.sin...@abertay.ac.uk

unread,
May 5, 2017, 5:36:57 AM5/5/17
to pwm-general
Hi,

I've just updated my PWM install from pwm-1.8.0-SNAPSHOT-2016-09-16T23:55:51Z, to pwm-1.8.0-SNAPSHOT-2017-04-13T17:41:45Z.

Everything was going great until I looked at the audit logs and got an error which corresponds to this error in the tomcat logs:

May 04, 2017 4:41:32 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Jersey REST Service] in context with path [/pwm] threw exception [javax.servlet.ServletException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $] with root cause
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:183)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at password.pwm.util.java.JsonUtil.deserializeStringMap(JsonUtil.java:100)
at password.pwm.svc.event.LocalDbAuditVault.deSerializeRecord(LocalDbAuditVault.java:145)
at password.pwm.svc.event.LocalDbAuditVault.access$200(LocalDbAuditVault.java:46)
at password.pwm.svc.event.LocalDbAuditVault$IteratorWrapper.next(LocalDbAuditVault.java:126)
at password.pwm.svc.event.LocalDbAuditVault$IteratorWrapper.next(LocalDbAuditVault.java:111)
at password.pwm.ws.server.rest.RestAppDataServer.doGetAppAuditData(RestAppDataServer.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
(lots more of stuff here)

Now after a restart, the application doesn't start up, giving this error:

5082 ERROR_STARTUP_ERROR (unexpected error instantiating service class 'password.pwm.svc.event.AuditService', cannot load, error: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $, cause: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $)

I'm guessing that something in the audit log in the LocalDB has changed or been broken.

Any way to fix this? I'm guessing that wiping out the LocalDB would fix it, but I'm hoping there's a better way.

(Is there a safe way to backup this database, or browse its contents?)

Cheers,


Duncan.


jason.e...@gmail.com

unread,
May 7, 2017, 9:55:39 AM5/7/17
to pwm-general
Within WEB-INF there is a script, command.sh or command.bat depending on your environment. You might also need to make the script exec if on linux. You can run that script alone and it will output the list of available commands, one of them is to import/export database.

D.Sin...@abertay.ac.uk

unread,
May 8, 2017, 7:25:20 AM5/8/17
to pwm-general, jason.e...@gmail.com
Thanks Jason, thanks useful to know.

Unfortunately, as its a binary dump, I'm still stuck on how to edit or wipe out the audit trail without wiping out the whole of the LocalDB.

Cheers,


Duncan.

Jason Everling

unread,
May 8, 2017, 8:14:29 AM5/8/17
to d.sin...@abertay.ac.uk, pwm-general
For some reason, I thought you can export to csv?

From: D.Sin...@abertay.ac.uk <D.Sin...@abertay.ac.uk>
Sent: Monday, May 8, 2017 6:25:20 AM
To: pwm-general
Cc: jason.e...@gmail.com
Subject: Re: Start up error: Expected BEGIN_OBJECT but was STRING
 

Jason Everling

unread,
May 8, 2017, 8:18:34 AM5/8/17
to d.sin...@abertay.ac.uk, pwm-general
Oh wait, you can export your questions and answers then just delete the locals and have own create a new one? That might be easier then use the script to import them back.

From: D.Sin...@abertay.ac.uk <D.Sin...@abertay.ac.uk>
Sent: Monday, May 8, 2017 6:25:20 AM
To: pwm-general
Cc: jason.e...@gmail.com
Subject: Re: Start up error: Expected BEGIN_OBJECT but was STRING
 

Jason Rivard

unread,
May 8, 2017, 8:58:58 AM5/8/17
to pwm-general, jason.e...@gmail.com
The export file is a gziped csv.  You can un-gzip, edit and then re-gzip and import.   

The other thing you might try is setting the 'LocalDB Audit Events Storage Max Events' (events.audit.maxEvents) to zero to clear out the events.

D.Sin...@abertay.ac.uk

unread,
May 8, 2017, 11:01:02 AM5/8/17
to pwm-general, jason.e...@gmail.com
Ah, I should have realised when I couldn't find any text at all in the exported file.

Editing out the audit records and re-importing fixed my problem.

Thanks all!
Reply all
Reply to author
Forward
0 new messages