You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Eranda Sooriyabandara <07...@gmail.com> on 2011/07/08 06:31:44 UTC

Got an exception when I creating the document

Hi all,
I got following error when I tried to create a document. What can be the
reason for this exceptio.

org.jcouchdb.exception.DataAccessException: error creating document
{"id":"_design\/twits","language":"javascript","lists":{},"views":{}}in
database 'TwitApp': code 500

thanks
-- 
Eranda Sooriyabandara
Blog: http://www.emsooriyabandara.blogspot.com/
LInkedIn: http://lk.linkedin.com/in/erandasooriyabandara

Re: Got an exception when I creating the document

Posted by Jens Alfke <je...@mooseyard.com>.
On Jul 10, 2011, at 11:43 PM, Randall Leeds wrote:

> I don't think CouchDB allows capital letters in your database name.
> 
> Twitapp => twitapp

Correct, it doesn’t. 

Eranda, we already pointed this out to you earlier (on the 8th, by my records). Please fix the database name and try again.

—Jens


Re: Got an exception when I creating the document

Posted by Randall Leeds <ra...@gmail.com>.
I don't think CouchDB allows capital letters in your database name.

Twitapp => twitapp

On Sun, Jul 10, 2011 at 19:55, Eranda Sooriyabandara <07...@gmail.com> wrote:
> Hi Dave,
> The log says,
>
> [Mon, 11 Jul 2011 02:44:50 GMT] [info] [<0.688.0>] 127.0.0.1 - - 'PUT'
> /Twitapp/_design%2Ftwits 500
>
> thanks
>
> Eranda
>

Re: Got an exception when I creating the document

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 11 July 2011 14:55, Eranda Sooriyabandara <07...@gmail.com> wrote:
> Hi Dave,
> The log says,
>
> [Mon, 11 Jul 2011 02:44:50 GMT] [info] [<0.688.0>] 127.0.0.1 - - 'PUT'
> /Twitapp/_design%2Ftwits 500
>
> thanks
>
> Eranda
>

Hi Eranda,


You can clearly see above that your DB name has uppercase in it; I'm
not familiar with jcouch so you'll need to work through why your
library is converting the DB name to Uppercase first. I can't
replicate CouchDB returning a 500 from this but let's deal with the
simple bits first.

Re the couchdb logs, you should see more than just what you posted
above incl all the headers. For example, here's the contents of
couch.log clearly showing the URL I tried and the headers passed
through:

[Mon, 11 Jul 2011 08:03:33 GMT] [debug] [<0.31803.54>] 'PUT'
/Newdb/_design/ddoc {1,1} from "127.0.0.1"
Headers: [{'Accept',"*/*"},
          {'Authorization',"Basic YWRtaW34675834gfdhsfdsffdsfdshj="},
          {'Content-Length',"18"},
          {'Content-Type',"application/json"},
          {'Host',"localhost:5984"},
          {'User-Agent',"curl/7.19.7 (universal-apple-darwin10.0)
libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3"}]
[Mon, 11 Jul 2011 08:03:33 GMT] [debug] [<0.31803.54>] OAuth Params: []
[Mon, 11 Jul 2011 08:03:33 GMT] [debug] [<0.31803.54>] Minor error in
HTTP request: {error,
                                                     illegal_database_name}
[Mon, 11 Jul 2011 08:03:33 GMT] [debug] [<0.31803.54>] Stacktrace:
[{io_lib_pretty,cind_tag_tuple,7},
                                    {io_lib_pretty,while_fail,3},
                                    {io_lib_pretty,print,6},
                                    {io_lib_format,build,3},
                                    {io_lib_format,build,3},
                                    {io_lib_format,build,3},
                                    {io_lib_format,build,3},
                                    {io_lib_format,build,3}]
[Mon, 11 Jul 2011 08:03:33 GMT] [info] [<0.31803.54>] 127.0.0.1 - -
'PUT' /Newdb/_design/ddoc 400
[Mon, 11 Jul 2011 08:03:33 GMT] [debug] [<0.31803.54>] httpd 400 error response:
 {"error":"illegal_database_name","reason":"Only lowercase characters
(a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and /
are allowed. Must begin with a letter."}


& here's the curl I used to generate it:

dave@akai /tmp % curl -H "Content-Type: application/json" -vX PUT
http://admin:password@localhost:5984/Newdb/_design/ddoc -d '{"butt"
:"kicked"}'
* About to connect() to localhost port 5984 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 5984 (#0)
* Server auth using Basic with user 'admin'
> PUT /Newdb/_design/ddoc HTTP/1.1
> Authorization: Basic YWRtaW34675834gfdhsfdsffdsfdshj=
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
> Host: localhost:5984
> Accept: */*
> Content-Type: application/json
> Content-Length: 18
>

< HTTP/1.1 400 Bad Request
< Server: CouchDB/1.1.0 (Erlang OTP/R14B03)
< Date: Mon, 11 Jul 2011 08:03:33 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 181
< Cache-Control: must-revalidate
<
{"error":"illegal_database_name","reason":"Only lowercase characters
(a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and /
are allowed. Must begin with a letter."}
* Connection #0 to host localhost left intact
* Closing connection #0

- can you recreate the issue with curl, or is this only with jcouchdb?
- have you tried a simple example like the ones at
http://code.google.com/p/jcouchdb/wiki/Tutorial ?
- how about posting a short segment of your code & changing the
subject to indicate that jcouch is involved?

A+
Dave

Re: Got an exception when I creating the document

Posted by Eranda Sooriyabandara <07...@gmail.com>.
Hi Dave,
The log says,

[Mon, 11 Jul 2011 02:44:50 GMT] [info] [<0.688.0>] 127.0.0.1 - - 'PUT'
/Twitapp/_design%2Ftwits 500

thanks

Eranda

Re: Got an exception when I creating the document

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 9 July 2011 10:43, Jens Alfke <je...@mooseyard.com> wrote:
>
> On Jul 7, 2011, at 9:31 PM, Eranda Sooriyabandara wrote:
>
>> org.jcouchdb.exception.DataAccessException: error creating document
>> {"id":"_design\/twits","language":"javascript","lists":{},"views":{}}in
>> database 'TwitApp': code 500
>
> Is there a way you can see the response from the server? The response body contains JSON that describes the error. As before, the library you’re using isn’t propagating that into the exception.
>
> —Jens

Set CouchDB local.ini [log] level=debug and restart. You'll see all
the headers/ responses in the couch.log file. Or put a transparent
proxy in between.

A+
Dave

Re: Got an exception when I creating the document

Posted by Eranda Sooriyabandara <07...@gmail.com>.
 Hi Jens,

Is there a way you can see the response from the server? The response body
> contains JSON that describes the error. As before, the library you’re using
> isn’t propagating that into the exception.


I am using the jcouchdb as my high level client. It does not say anything
about the error but it only shows the place where the exception thrown im my
code and the error code which I show you in my previous mail.

Eranda

Re: Got an exception when I creating the document

Posted by Jens Alfke <je...@mooseyard.com>.
On Jul 7, 2011, at 9:31 PM, Eranda Sooriyabandara wrote:

> org.jcouchdb.exception.DataAccessException: error creating document
> {"id":"_design\/twits","language":"javascript","lists":{},"views":{}}in
> database 'TwitApp': code 500

Is there a way you can see the response from the server? The response body contains JSON that describes the error. As before, the library you’re using isn’t propagating that into the exception.

—Jens