dtolabs / yana2

Yet Another Node Authority ... because you wanted an agile Real-Time Service Model (RTSM)
8 stars 1 forks source link

Attributes API error when using PUT method #105

Closed ahonor closed 12 years ago

ahonor commented 12 years ago

Error running the following example:

curl --verbose --request PUT --header "Content-Type: application/json" -d "{id:22,name:'New Name',description:'this is the description',filter.id:'1'}" http://localhost:8080/api/attribute/none --cookie cookies.txt

$ curl --verbose --request PUT --header "Content-Type: application/json" -d "{id:1,name:'New Name',description:'this is the description',filter.id:'1'}" http://localhost:8080/api/attribute/none --cookie cookies.txt
* About to connect() to localhost port 8080 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> PUT /api/attribute/none HTTP/1.1
> User-Agent: curl/7.21.2 (x86_64-apple-darwin10.5.0) libcurl/7.21.2 OpenSSL/1.0.0c zlib/1.2.6 libidn/1.19
> Host: localhost:8080
> Accept: */*
> Cookie: JSESSIONID=84080664EE53E677217780E5EBF7CB39
> Content-Type: application/json
> Content-Length: 74
> 
< HTTP/1.1 500 Internal Server Error
< Server: Apache-Coyote/1.1
< Content-Type: text/html;charset=UTF-8
< Content-Language: en-US
< Transfer-Encoding: chunked
< Date: Tue, 22 May 2012 15:21:31 GMT
< Connection: close
< 
<!DOCTYPE html>
<html>
  <head>
    <title>YANA Grails Runtime Exception</title>
    <link rel="stylesheet" href="/static/css/yana.css" />
    <link rel="shortcut icon" href="/static/images/favicon.ico?v=2" />

    <link href="/static/css/jquery-ui-1.8.19.custom.css" type="text/css" rel="stylesheet" media="screen, projection" />
<script src="/static/plugins/jquery-1.7.1/js/jquery/jquery-1.7.1.min.js" type="text/javascript" ></script>
<script src="/static/plugins/jquery-ui-1.8.15/jquery-ui/js/jquery-ui-1.8.15.custom.min.js" type="text/javascript" ></script>

    <script src="/js/jquery.json-2.3.js" type="text/javascript"></script>

        <meta name="layout" content="main">
        <link rel="stylesheet" href="/static/css/errors.css" type="text/css">

    <link rel="stylesheet" type="text/css" href="/static/css/superfish.css" />
    <script type="text/javascript" src="/js/hoverIntent.js"></script>
    <script type="text/javascript" src="/js/superfish.js"></script>

    <script type="text/javascript">
    // initialise plugins
    jQuery(function(){
        jQuery('ul.sf-menu').superfish();
    });
    </script>

    <script type="text/javascript">
    $(document).ready(function() {
        $('ul.sf-menu').superfish({
            delay:       250,                            // one second delay on mouseout
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
            speed:       'fast',                          // faster animation speed
            autoArrows:  false,                           // disable generation of arrow mark-up
            dropShadows: false                            // disable drop shadows
        });
    });

    </script>

  </head>
  <body>

<div id="fullheightcontainer">
  <div id="wrapper">
    <div id="outer">
      <div id="float-wrap">
        <div id="center">
          <div id="clearheadercenter"></div>
          <div id="container-center">
            <div id="header">
<br><br>
<table border=0 cellspacing=0 cellpadding=0 width='100%' valign=top>
    <tr>
        <td width="27">&nbsp;</td>
        <td align=left class="logo">&nbsp;</td>
        <td class="header_spacer"><div style="width:300px;padding-right:0px;margin:0px;position:relative;top:4px;left:20px;"><div style='width:400px;font:bold 12px Helvetica, Arial, sans-serif;color:#ffffff;padding:0px 5px 3px 5px;'><a href="/attribute/index">attribute</a> > <div style="color:#ff6600;display:inline">api</div></div></div></td>
        <td class="header_login_corner">&nbsp;</td>
        <td class="header_login_body">

                Welcome back, admin | <a href="/logout/index">Logout</a>

        </td>
    </tr>
    <tr>
        <td class="header_login_corner2">&nbsp;</td>
        <td colspan=4 rowspan=2 class="header_search">
            <center>
            <div>
              <form action="/search/index" method="get" id="searchableForm" name="searchableForm" >
                  <input type="text" class="search_input" name="q" value="" size="50" id="q" /> <input class="button" type="submit" value="Search" />
              </form>
              <div style="clear: both; display: none;" class="hint">See <a href="http://lucene.apache.org/java/docs/queryparsersyntax.html">Lucene query syntax</a> for advanced queries</div>
            </div>
            </center>
        </td>
    </tr>
    <tr>
        <td class="header_login_side">&nbsp;</td>
    </tr>
    <tr>
        <td colspan=2 align=top><div class="header_bottom_corner">&nbsp;</div></td>
        <td colspan=3>
            <ul class="sf-menu">
                <li class="current"><a href="/">Nodes</a>
                    <ul>
                        <li><a href="/">List</a></li>
                        <li><a href="/node/create">Create</a></li>
                        <li class="current"><a href="/childNode/list">Node Relationships</a>
                            <ul>
                                <li class="current"><a href="/childNode/create">Create Node Relationship</a></li>
                            </ul>
                        </li>
                    </ul>

                </li>
                <li class="spacer"><img src="/static/images/pix.png" width='10' height='24'/></li>
                <li><a href="/nodeType/list">Types</a>
                    <ul>
                        <li><a href="/nodeType/list">NodeTypes</a>
                            <ul>
                                <li><a href="/nodeType/create">Create NodeType</a></li>
                            </ul>
                        </li>
                        <li><a href="/attribute/list">Attributes</a>
                            <ul>
                                <li><a href="/attribute/create">Create Attribute</a></li>
                            </ul>
                        </li>
                        <li><a href="/filter/list">Filters</a>
                            <ul>
                                <li><a href="/filter/create">Create Filter</a></li>
                            </ul>
                        </li>
                        <li><a href="/nodeTypeRelationship/list">Nodetype Relationship</a>
                            <ul>
                                <li><a href="/nodeTypeRelationship/create">Create Nodetype Relationship</a></li>
                            </ul>
                        </li>
                    </ul>
                </li>
                <li class="spacer"><img src="/static/images/pix.png" width='10' height='24'/></li>
                <li><a href="/webhook/list">Webhooks</a>
                    <ul>
                        <li><a href="/webhook/list">List</a></li>
                        <li><a href="/webhook/create">Create</a></li>
                    </ul>
                </li>
                <li class="spacer"><img src="/static/images/pix.png" width='10' height='24'/></li>
                <li><a href="http://localhost:8080/import">Admin</a>
                    <ul>
                        <li><a href="/import/importxml">Import Resources</a></li>
                        <li><a href="/user/search">Users</a>
                            <ul>
                                <li><a href="/user/create">Create User</a></li>
                            </ul>
                        </li>
                        <li><a href="/role/search">Roles</a>
                            <ul>
                                <li><a href="/role/create">Create Role</a></li>
                            </ul>
                        </li>
                    </ul>
                </li>
            </ul>
        </td>
    </tr>
</table>

</div>
            <div id="body">

                <table border=0 width='100%' height='100%' cellspacing=0 cellpadding=20 valign=top align=middle>
                    <tr><td width=100% height=100% valign=top>
        <h1>Error 500: Internal Server Error</h1>
<dl class="error-details">
<dt>URI</dt><dd>/api/attribute/none</dd>
<dt>Class</dt><dd>org.hibernate.HibernateException</dd><dt>Message</dt><dd>identifier of an instance of com.dtosolutions.Filter was altered from 5 to 1</dd></dl><h2>Around line 170 of <span class="filename">grails-app/controllers/com/dtosolutions/AttributeController.groovy</span></h2>
<pre class="snippet"><code class="line"><span class="lineNumber">167:</span></code><code class="line"><span class="lineNumber">168:</span>        attributeInstance.properties = params</code><code class="line"><span class="lineNumber">169:</span></code><code class="line error"><span class="lineNumber">170:</span>        if (!attributeInstance.save(flush: true)) {</code><code class="line"><span class="lineNumber">171:</span>            render(view: &quot;edit&quot;, model: [attributeInstance: attributeInstance])</code><code class="line"><span class="lineNumber">172:</span>            return</code><code class="line"><span class="lineNumber">173:</span>        }</code></pre><h2>Around line 29 of <span class="filename">grails-app/controllers/com/dtosolutions/AttributeController.groovy</span></h2>
<pre class="snippet"><code class="line"><span class="lineNumber">26:</span>             break</code><code class="line"><span class="lineNumber">27:</span>          case &quot;PUT&quot;:</code><code class="line"><span class="lineNumber">28:</span>              def json = request.JSON</code><code class="line error"><span class="lineNumber">29:</span>              this.update()</code><code class="line"><span class="lineNumber">30:</span>              break</code><code class="line"><span class="lineNumber">31:</span>          case &quot;DELETE&quot;:</code><code class="line"><span class="lineNumber">32:</span>               def json = request.JSON</code></pre><h2>Trace</h2><pre class="stack">   Line | Method
-&gt;&gt; 170 | update  in AttributeController.groovy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    29 | api     in     &#39;&#39;
|   886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run     in     &#39;&#39;
^   680 | run . . in java.lang.Thread
</pre>
    </td></tr>
                </table>

            </div>
            <div id="footer">
<div style="height:1px;"><img src="/static/images/pix.gif" width='1' height='1'/></div>
<div class="foot_style">
<center>&copy; Copyright 2010 <a href="https://github.com/dtolabs">DTO Labs</a>. DTO Labs is affiliated with <a href="http://dtosolutions.com/">DTO Solutions</a>. All rights reserved.</center>
</div>
<div style="height:1px;"><img src="/static/images/pix.gif" width='1' height='20'/></div>
<br>

</div>
          </div>
          <div id="clearfootercenter"></div>
        </div>
        <div id="left">
          <div id="clearheaderleft"></div>
          <div id="container-left">&nbsp;</div>
          <div id="clearfooterleft"></div>
        </div>
      </div>
      <div id="right">
        <div id="clearheaderright"></div>
        <div id="container-right">&nbsp;</div>
        <div id="clearfooterright"></div>
      </div>
      <div class="clear">&nbsp;</div>
    </div>
    <div id="gfx_bg_middle">&nbsp;</div>
  </div>
  <div class="clear">&nbsp;</div>
</div>

  </body>
* Closing connection #0
</html>alexh@strongbad:~/tmp/yana2 [529]
$ 
ahonor commented 12 years ago

This bug was probably environment related.