Project

General

Profile

groovy.lang.MissingPropertyException: No such property: command for class: org.eclipse.jetty.server.Request

bao qf
Added over 4 years ago

I use tigase server 5.2.0.

init.properties file content is :

config-type=--gen-config-def
--admins=admin@test.xmpp
--virt-hosts=test.xmpp
--debug=server,cluster
--user-db=mysql
--user-db-uri=jdbc:mysql://192.168.3.210/tigase?user=root&password=135246&useUnicode=true&characterEncoding=UTF-8
--comp-name-1=rest
--comp-class-1=tigase.http.rest.RestMessageReceiver

client code is:

        Credentials defaultcreds = new UsernamePasswordCredentials("admin@test.xmpp", "123456");
        cient.getState().setCredentials(AuthScope.ANY, defaultcreds);
        PostMethod post = new PostMethod("http://192.168.3.100:8080/rest/adhoc/sess-man@test.xmpp");
        String body = "<command>  <node>http://jabber.org/protocol/admin#get-active-users</node>  <fields>    <item>      <var>sess-man@test.xmpp</var>      <value>test.xmpp</value>    </item>    <item>      <var>max_items</var>      <value>25</value>    </item>  </fields></command>";
        post.setRequestBody(body);
        post.setRequestHeader("Content-type", "application/xml; charset=utf-8");
        int result = cient.executeMethod(post);
        System.out.println(post.getResponseBodyAsString());

when run this client code ,the tigase server error print out is :

2014-06-30 11:06:30.473 [qtp1482472870-121 - /rest/adhoc/sess-man@test.xmpp]  java_util_logging_Logger$warning.call()  WARNING: got calling with params = [tigase.http.rest.RestMessageReceiver@5a815e0c, tigase.http.rest.RestSerlvet$_execute_closure4@7532ce5a, admin@test.xmpp, (POST /rest/adhoc/sess-man@test.xmpp)@1518973650 org.eclipse.jetty.server.Request@5a89b2d2, sess-man, test.xmpp]
2014-06-30 11:06:30.473 [qtp1482472870-121 - /rest/adhoc/sess-man@test.xmpp]  java_util_logging_Logger$log.call()  SEVERE: exception processing request
groovy.lang.MissingPropertyException: No such property: command for class: org.eclipse.jetty.server.Request
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
    at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
    at tigase.rest.adhoc.AdHocHandler$_closure2.doCall(AdHoc.groovy:87)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at org.codehaus.groovy.runtime.metaclass.TransformMetaMethod.invoke(TransformMetaMethod.java:55)
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass$1.invoke(ClosureMetaClass.java:259)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at tigase.http.rest.RestSerlvet.execute(RestServlet.groovy:281)
    at tigase.http.rest.RestSerlvet$execute.callCurrent(Unknown Source)
    at tigase.http.rest.RestSerlvet.executeAsync(RestServlet.groovy:174)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
    at tigase.http.rest.RestSerlvet$_processRequest_closure3.doCall(RestServlet.groovy:143)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
    at groovy.lang.Closure.call(Closure.java:411)
    at groovy.lang.Closure.call(Closure.java:427)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1326)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1298)
    at org.codehaus.groovy.runtime.dgm$148.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at tigase.http.rest.RestSerlvet.processRequest(RestServlet.groovy:116)
    at tigase.http.rest.RestSerlvet$processRequest.callCurrent(Unknown Source)
    at tigase.http.rest.RestSerlvet.service(RestServlet.groovy:79)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:457)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1077)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:364)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:488)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:943)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1004)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Unknown Source)

client receive response is:

selectAuthScheme(org.apache.commons.httpclient.auth.AuthChallengeProcessor:100) basic authentication scheme selected
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 Server Error</title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rest/adhoc/sess-man@test.xmpp. Reason:

Powered by Jetty://

What reson this problem?


Replies (3)

Added by Wojciech Kapcia TigaseTeam over 4 years ago

  • does the same happen with latest nightlies?

  • can you try with proper content-type without charset? i.e.:

post.setRequestHeader("Content-type", "text/xml");

Added by bao qf over 4 years ago

Thank you very much.

If don't set Content-type ,server has error "No signature of method".So i search a article in stackover ,it sugguest me to set "application/xml".

Yes,use "post.setRequestHeader("Content-type", "text/xml");" is ok.

Added by Wojciech Kapcia TigaseTeam over 4 years ago

You have to set Content-type@! But as indicated in [Usage examples](https://projects.tigase.org/projects/tigase-http-api/wiki/Usage_examples) in HTTP-API component, a proper Content type is either @application/json or @text/xml@.

    (1-3/3)