Are you sure that you postgres is rightly configured ?
I mean, are you sure that a user
demo with no password can access to the libresource database ?
You can give a try to run java code with JDBC and the postgresql driver available in JONAS_ROOT/lib/ext/xxx.jar