首页 \ 问答 \ Grails GPARS升级(Grails GPARS upgrade)

Grails GPARS升级(Grails GPARS upgrade)

我正在使用Grails 1.4.0.M1,我正在尝试升级gpars的版本以与我的应用程序一起使用。

所以我加入了BuildConfig.groovy:

dependencies{
    build 'org.codehaus.gpars:gpars:0.11'
}

但是,当我使用run-app时,这会带来以下异常:

Exception in thread "Thread-4" java.lang.ClassCastException: groovyx.gpars.ThreadLocalPools cannot be cast to groovy.lang.GroovyObject
  at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
  at groovyx.gpars.Parallelizer.retrieveCurrentPool(Parallelizer.groovy:62)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

我怀疑它可能与旧版本中使用此lib的grails框架相关联,并且版本不兼容。

任何想法我怎么能解决这个问题?

谢谢。


I am using Grails 1.4.0.M1 and I am trying to upgrade the version of gpars to use with my app.

So I added in BuildConfig.groovy:

dependencies{
    build 'org.codehaus.gpars:gpars:0.11'
}

This however brings me the following exception when I use run-app:

Exception in thread "Thread-4" java.lang.ClassCastException: groovyx.gpars.ThreadLocalPools cannot be cast to groovy.lang.GroovyObject
  at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
  at groovyx.gpars.Parallelizer.retrieveCurrentPool(Parallelizer.groovy:62)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I suspect it could be linked to the grails framework using this lib in an older version and the versions being incompatible.

Any idea how I could overcome this issue?

Thanks.


原文:https://stackoverflow.com/questions/7055571
更新时间:2023-10-06 13:10

最满意答案

如果您使用的是编程语言,则可以简化SQL:

"SELECT username, id, Days FROM Users ORDER BY Days DESC";

然后使用编程语言处理行号:

if ($result->num_rows > 0) {
$rowNumber=0;
echo "<table><tr><th>ID</th><th>Name</th><th>Days</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
    $rowNumber++;
    echo "<tr><td>" . $rowNumber "</td><td>" . $row["username"]. "</td><td>" . $row["Days"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}

If you are using a programming language, you can keep your SQL simple:

"SELECT username, id, Days FROM Users ORDER BY Days DESC";

Then process the row number using the programming language:

if ($result->num_rows > 0) {
$rowNumber=0;
echo "<table><tr><th>ID</th><th>Name</th><th>Days</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
    $rowNumber++;
    echo "<tr><td>" . $rowNumber "</td><td>" . $row["username"]. "</td><td>" . $row["Days"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}

相关问答

更多