I followed the Artemis REST Interface documentation and managed to get
Artemis running with the REST interface and I can successfully call the
create URL. I do get the msg-create-next and can keep posting new messages
without issue. But that it seems that is all I can do. The documentation
suggests using the base URL/queues/queueName to query for other URLs such as
msg-pull-consumers. However whenever I attempt this I just get a 500 Server
Error with exception data. I am new to Artemis/ActiveMQ in general so maybe
it's something obvious to regular users.

My question is this: is there some part of the configuration where that
specifically enables or disables that part of the rest interface? or am I
missing a library in the war file I created?

Example response when using create:
$ curl -verbose --data "123"
http://localhost:8081/testrest/queues/exampleQueue/create
  % Total    % Received % Xferd  Average Speed   Time    Time     Time 
Current
                                 Dload  Upload   Total   Spent    Left 
Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--    
0*   Trying 127.0.0.1:8081...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8081 (#0)
> POST /testrest/queues/exampleQueue/create HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.68.0
> Accept: */*
> Referer: rbose
> Content-Length: 3
> Content-Type: application/x-www-form-urlencoded
>
} [3 bytes data]
* upload completely sent off: 3 out of 3 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< Date: Thu, 26 Mar 2020 20:18:12 GMT
< msg-create-next: http://localhost:8081/testrest/queues/exampleQueue/create
< msg-create-next-type: */*
< Content-Length: 0
<
100     3    0     0  100     3      0    333 --:--:-- --:--:-- --:--:--  
375
* Connection #0 to host localhost left intact

Example response when trying to query base url:
$ curl -verbose http://localhost:8081/testrest/queues/exampleQueue
  % Total    % Received % Xferd  Average Speed   Time    Time     Time 
Current
                                 Dload  Upload   Total   Spent    Left 
Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--    
0<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body>
HTTP ERROR 500

<p>Problem accessing /testrest/queues/exampleQueue. Reason:
<pre>    Server Error</pre></p>
Caused by:
<pre>org.jboss.resteasy.spi.UnhandledException:
java.lang.AbstractMethodError: Receiver class
org.jboss.resteasy.specimpl.ResponseBuilderImpl does not define or inherit
an implementation of the resolved method &apos;abstract
javax.ws.rs.core.Response$ResponseBuilder status(int,
java.lang.String)&apos; of abstract class
javax.ws.rs.core.Response$ResponseBuilder.
        at
org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:77)
        at
org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:220)
        at
org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:175)
        at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:418)
        at
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:247)
        at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:225)
        at
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:62)
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)
        at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
        at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
        at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
        at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
        at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at
org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.eclipse.jetty.server.Server.handle(Server.java:564)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
        at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        at
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
        at
org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
        at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.AbstractMethodError: Receiver class
org.jboss.resteasy.specimpl.ResponseBuilderImpl does not define or inherit
an implementation of the resolved method &apos;abstract
javax.ws.rs.core.Response$ResponseBuilder status(int,
java.lang.String)&apos; of abstract class
javax.ws.rs.core.Response$ResponseBuilder.
        at
javax.ws.rs.core.Response$ResponseBuilder.status(Response.java:921)
        at javax.ws.rs.core.Response.status(Response.java:592)
        at javax.ws.rs.core.Response.status(Response.java:603)
        at javax.ws.rs.core.Response.ok(Response.java:638)
        at javax.ws.rs.core.Response.ok(Response.java:650)
        at
org.apache.activemq.artemis.rest.queue.QueueResource.get(QueueResource.java:60)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
        at
org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
        at
org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
        at
org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)
        at
org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)
        at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:402)
        ... 29 more
</pre>
Caused by:
<pre>java.lang.AbstractMethodError: Receiver class
org.jboss.resteasy.specimpl.ResponseBuilderImpl does not define or inherit
an implementation of the resolved method &apos;abstract
javax.ws.rs.core.Response$ResponseBuilder status(int,
java.lang.String)&apos; of abstract class
javax.ws.rs.core.Response$ResponseBuilder.
        at
javax.ws.rs.core.Response$ResponseBuilder.status(Response.java:921)
        at javax.ws.rs.core.Response.status(Response.java:592)
        at javax.ws.rs.core.Response.status(Response.java:603)
        at javax.ws.rs.core.Response.ok(Response.java:638)
        at javax.ws.rs.core.Response.ok(Response.java:650)
        at
org.apache.activemq.artemis.rest.queue.QueueResource.get(QueueResource.java:60)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
        at
org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
        at
org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
        at
org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:138)
        at
org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)
        at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:402)
        at
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:247)
        at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:225)
        at
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:62)
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)
        at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
        at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
        at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
        at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
        at
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
        at org.eclipse*   Trying 127.0.0.1:8081...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /testrest/queues/exampleQueue HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.68.0
> Accept: */*
> Referer: rbose
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Server Error
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Type: text/html;charset=iso-8859-1
< Content-Length: 9213
< Connection: close
<
{ [1296 bytes data]
100  9213  100  9213    0     0   562k      0 --:--:-- --:--:-- --:--:-- 
562k.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at
org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.eclipse.jetty.server.Server.handle(Server.java:564)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
        at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        at
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
        at
org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
        at java.base/java.lang.Thread.run(Thread.java:830)
</pre>

</body>
</html>

* Closing connection 0


Follows some of my configuration files...

web.xml
<web-app>
<listener>
      <listener-class>
         org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
      </listener-class>
   </listener>

   <listener>
      <listener-class>
        
org.apache.activemq.artemis.rest.integration.ActiveMQBootstrapListener
      </listener-class>
   </listener>

   <listener>
      <listener-class>
        
org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener
      </listener-class>
   </listener>

   <filter>
      <filter-name>Rest-Messaging</filter-name>
      <filter-class>
         org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
      </filter-class>
   </filter>

   <filter-mapping>
      <filter-name>Rest-Messaging</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>
</web-app>


broker.xml
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
   <core xmlns="urn:activemq:core">

      <persistence-enabled>false</persistence-enabled>
      <security-enabled>false</security-enabled>

      <acceptors>
         <acceptor name="in-vm">vm://0</acceptor>
         <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
      </acceptors>
      <addresses>
         <address name="exampleQueue">
            <anycast>
               <queue name="exampleQueue"/>
            </anycast>
         </address>
      </addresses>
   </core>
</configuration>

bootstrap.xml
   <jaas-security domain="activemq"/>

   
   <server
configuration="file:/C:/Program%20Files/Apache/Artemis/testrest/testrest_broker/etc/broker.xml"/>

   
   <web bind="http://localhost:8081"; path="web">
       <app url="activemq-branding" war="activemq-branding.war"/>
       <app url="artemis-plugin" war="artemis-plugin.war"/>
       <app url="console" war="console.war"/>
        <app url="testrest" war="activemq-rest.war"/>
   </web>


-Phil



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Reply via email to