Artemis setup with REST on Jetty

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Artemis setup with REST on Jetty

Dennis Staiger
I am trying to run Artemis with REST support but I am missing the step that links the war file from my jetty container to my existing Artemis instance. Here are the steps I have taken:

First I created a simple broker instance:

bin/artemis create mybroker

In “etc/bootstrap.xml”, I changed <web bind="http://localhost:8161" …> to my IP address in order to make the web UI accessible from my network. The same I did inside of “etc/jolokia-access.xml” for the <allow-origin> tag. So far, everything seems to be working fine.

I then installed a jetty servlet container using the default configuration. Next I followed the instructions from the Artemis manual on how to create a war file required to configure REST support:

Instructions were taken from http://activemq.apache.org/artemis/docs/latest/rest.html, chapter “Installing Within Pre-configured Environment”. The required jar files I took from building an example rest project. The project structure is like this:

|-- pom.xml
`-- src
   `-- main
       `-- webapp
           `-- WEB-INF
                `-- lib (contains all my RESTEasy jar files)
               `-- web.xml

I then went ahead and build the war with maven: mvn install
Now I dropped the resulting war file into the jetty webapps folder, started my broker instance and started jetty.

Jetty now is throwing an exception:
java.lang.RuntimeException: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]

I think that the missing piece is to tell jetty about my broker instance, but I do not know how and where to do so. What am I missing?

Thanks for your help!
Reply | Threaded
Open this post in threaded view
|

Re: Artemis setup with REST on Jetty

jbertram
Check out the "REST Configuration" section of that documentation you
linked.  I believe you need to add the XML config file with the appropriate
"url" of your Artemis instance.

Out of curiosity, are you deploying the REST war to the Jetty instance
embedded in Artemis or to an independent Jetty instance?


Justin

On Wed, Dec 12, 2018 at 5:28 PM Dennis Staiger <[hidden email]>
wrote:

> I am trying to run Artemis with REST support but I am missing the step
> that links the war file from my jetty container to my existing Artemis
> instance. Here are the steps I have taken:
>
> First I created a simple broker instance:
>
> bin/artemis create mybroker
>
> In “etc/bootstrap.xml”, I changed <web bind="http://localhost:8161" …> to
> my IP address in order to make the web UI accessible from my network. The
> same I did inside of “etc/jolokia-access.xml” for the <allow-origin> tag.
> So far, everything seems to be working fine.
>
> I then installed a jetty servlet container using the default
> configuration. Next I followed the instructions from the Artemis manual on
> how to create a war file required to configure REST support:
>
> Instructions were taken from
> http://activemq.apache.org/artemis/docs/latest/rest.html, chapter
> “Installing Within Pre-configured Environment”. The required jar files I
> took from building an example rest project. The project structure is like
> this:
>
> |-- pom.xml
> `-- src
>    `-- main
>        `-- webapp
>            `-- WEB-INF
>                 `-- lib (contains all my RESTEasy jar files)
>                `-- web.xml
>
> I then went ahead and build the war with maven: mvn install
> Now I dropped the resulting war file into the jetty webapps folder,
> started my broker instance and started jetty.
>
> Jetty now is throwing an exception:
> java.lang.RuntimeException:
> ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007:
> Cannot connect to server(s). Tried with all available servers.]
>
> I think that the missing piece is to tell jetty about my broker instance,
> but I do not know how and where to do so. What am I missing?
>
> Thanks for your help!
>