Couple of questions/comments:
* What version of PostgreSQL are you running? The newest version of PostgreSQL apparently stopped supporting the backslash-escaped single quote in scripts, although this may change/may have changed with later RC versions of that release.
* What version of XNAT are you trying to install? The newer versions of XNAT use the double single-quote means of escaping and so should avoid that issue, e.g. I just ran builds on both Windows and Mac and am seeing the single quotes escaped with double single quotes in the script, i.e. instead of (\'pg_catalog\', \'pg_toast\'), I see (''pg_catalog'', ''pg_toast'').
* You shouldn't need to run psql with sudo. psql does its own authentication based on the -U parameter. I'm wondering if something might be getting bollixed up with the permissions because of that.
* Regarding following the instructions "to a T", on one error message I see this: "psql:sql/DBNAME.sql" and on another I see this: "psql:sql/niaimbackup.sql". Are you actually running anything with DBNAME in there literally?
Hi,
Best,
Vanessa
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.
________________________________
The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
Re: #2, there's a problem in the parameters being passed into the SessionXMLRebuilderJob, which I'm pretty certain has its root cause in the problem you're seeing in your #4. And I suspect that the #4 has its root cause in your SQL issues in your first email.
Re: #3, that's a pretty standard error message from Axis. It really should be a warning instead of an error, but we have no control over that really.
-----Original Message-----
From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of VS
Sent: Sunday, September 04, 2011 10:22 PM
To: xnat_discussion
A few more notes:
3) axis.log:
4) xdat.log:
--
* What version of PostgreSQL are you running? The newest version of PostgreSQL apparently stopped supporting the backslash-escaped single quote in scripts, although this may change/may have changed with later RC versions of that release.
* What version of XNAT are you trying to install? The newer versions of XNAT use the double single-quote means of escaping and so should avoid that issue, e.g. I just ran builds on both Windows and Mac and am seeing the single quotes escaped with double single quotes in the script, i.e. instead of (\'pg_catalog\', \'pg_toast\'), I see (''pg_catalog'', ''pg_toast'').
* You shouldn't need to run psql with sudo. psql does its own authentication based on the -U parameter. I'm wondering if something might be getting bollixed up with the permissions because of that.
* Regarding following the instructions "to a T", on one error message I see this: "psql:sql/DBNAME.sql" and on another I see this: "psql:sql/niaimbackup.sql". Are you actually running anything with DBNAME in there literally?
I'm still looking into your last email to see what's working for us.
I just saw something else in this. I created a simple SQL script (shown below) to do some tests around this issue. If I convert the \' sequences to '', my script works just fine. With the \', it's another matter. In the postgresql.conf, there's a setting called standard_conforming_strings I'm playing with that lets you tailor the way Postgres handles strings and especially escaping characters. If I set standard_conforming_strings = off, then when I run my script, I get this warning:
WARNING: nonstandard use of \' in a string literal
LINE 16: '
^
HINT: Use '' to write quotes in strings, or use the escape string syntax (E'...').
Query returned successfully with no result in 61 ms.
Now, a warning is all it is. My table has been created and populated and the function has been created. If I set standard_conforming_strings = on, then when I run my script, I get this warning:
ERROR: syntax error at or near "OOF"
LINE 22: ...ecord IN SELECT * FROM test WHERE thing NOT IN (\'OOF\', \'U...
This time no function or table is created.
What's interesting here is that neither one of those is the problem you're seeing. In fact, it just looks like something's completely fouled up in your scripts. What's really happening there isn't even related to how PostgreSQL processes the escape of single quotes, but is related to the script itself. It's not a bad string sequence, it's a bad COMMAND:
psql:sql/DBNAME.sql:81384: invalid command \')
It's not seeing that \') as part of the command in front of it, but as its own stand-alone command that is, for obvious reasons, meaningless. So the issue here really has nothing to do with \' vs. '', but instead stems from a parsing error because of a new line in the middle of that string.
So here's what we're thinking: your installation is completely and irretrievably screwed up. I suspect that the use of sudo in there may have gotten you into trouble. I haven't been on the XNAT team for too long and when I first started and was learning the system, I managed to get into lots of trouble by messing up the permissions on various parts of the installation. The errors from this sort of thing can be really weird and unpredictable, which sounds like what you're seeing. So here's what I'd suggest doing:
1) Drop your xnat database and re-create it.
2) Delete your xnat_builder folder and restore from the downloaded archive (alternatively, you can just do "rm -r deployments projects plugin-resources/cache work").
3) Run through the installation procedure again.
But let me add one more thing here: your best results will come from having the user that runs tomcat owning the XNAT build folder (in the installation instructions, this is referred to as XNAT_HOME), as well as the archive, prearchive, and cache folders. For example, on the VM images we use internally, we have a user named xnatdev who owns the Tomcat home folder (actually ~xnatdev IS the Tomcat home folder) and is used as the user for running the Tomcat service.
So, without messing with the Tomcat configuration and changing the user and supposing that your Tomcat user is named tomcat (you can look in the tomcat*.conf, it's probably something like /etc/tomcat6/tomcat6.conf, but I'm not sure how the RPM-installed Tomcat manages that), you could do the following:
tar xzf xnat_1_5_2.tar.gz
chown -R tomcat:tomcat xnat_1_5_2
cd xnat_1_5_2
sudo bash
su tomcat
From here, you should be able to run everything as straight up commands, e.g.:
bin/setup.sh -Ddeploy=true
StoreXML -etc blah bar:foo ad=nauseum
Then everything generated will be generated as belonging to tomcat and the conflicts should go away. When you go to run psql, you'll just do the command verbatim:
psql -U xnat -d xnat -f sql/xnat.sql
As I mentioned previously, psql has its own authentication outside of any permissions, so you generally don't need any elevation of authorization to access it, just the appropriate credentials.
Let me know if this helps you at all!
For testing purposes, here's the script I was running to test:
DROP TABLE IF EXISTS test;
CREATE TABLE test
(
thing character varying(255)
);
INSERT INTO test VALUES ('OOF');
INSERT INTO test VALUES ('UGH');
INSERT INTO test VALUES ('FILTH');
INSERT INTO test VALUES ('FLARN');
INSERT INTO test VALUES ('FILTH');
CREATE OR REPLACE FUNCTION mess_with_test()
RETURNS TEXT AS
'
declare
record RECORD;
fullText TEXT;
BEGIN
FOR record IN SELECT * FROM test WHERE thing NOT IN (\'OOF\', \'UGH\') LOOP
fullText := fullText || \' \' || record.thing;
END LOOP;
RETURN fullText;
END;
'
LANGUAGE 'plpgsql' VOLATILE;
-----Original Message-----
From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of VS
Sent: Sunday, September 04, 2011 10:13 PM
To: xnat_discussion
Subject: [XNAT Discussion] Error Creating Database and Views
Hi,
Best,
Vanessa
--
Careful there, latkas are a scarce resource, best to hold onto them until you really need them J
I’m glad this worked for you. As I said before, the permissions issues were one of the things that really bit me early on working with XNAT. The manifestations of problems there can show in all kinds of subtle (aka infuriatingly obscure) ways.
If you have any other issues, don’t hesitate to ask!
FYI, I've modified the installation instructions to encourage UNIX users to adjust the file system permissions for the XNAT_HOME (builder) and archive/prearchive/cache directories to be the same as the user who will execute Tomcat.
Thanks for identifying the issue.
Tim