You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Julien d <ju...@iki.fi> on 2016/04/26 18:00:48 UTC

Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Hi everyone,

Sorry for bothering, I am having some troubles working with Artemis,
more particularly
org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
would like to know if someone here could give me a hand please. I did
not find this part documented, I could document it after understanding
it better.

Where should I put the broker.xml ?
I have started a project where I have
org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
org.myproject packages in the same directory.

At the moment my program is as simple as that since it is my first time
working with Artemis :

public static void main(String[] args) throws Exception{

    EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }

Thank you very much in advance,

-- 
Julien D.

Alternative email address : julien.d@protonmail.ch


Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Posted by Julien d <ju...@iki.fi>.
Thanks a lot! :)

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 09:29 PM, Justin Bertram wrote:
> I'm not exactly sure why you're getting that exception.  I just created a simple, Mavenized example demonstrating how to create an embedded REST server here [1].  Try that out.
>
>
> Justin
>
> [1] https://github.com/jbertram/activemq-artemis/commit/875b8764aabb13794578c8c436b4cdc527502d59
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 12:50:17 PM
> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Here it is :
>
>     /usr/lib/jvm/java-8-openjdk/bin/java -Didea.launcher.port=7533
>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>     -Dfile.encoding=UTF-8 -classpath
>     /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/johnny/IdeaProjects/activemq-artemis-master/artemis-rest/target/classes:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.16.Final/resteasy-jaxrs-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.16.Final/resteasy-jaxb-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.16.Final/resteasy-jackson-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.16.Final/resteasy-atom-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.16.Final/tjws-3.0.16.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.3.0-SNAPSHOT/artemis-server-1.3.0-20160426.031638-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.3.0-SNAPSHOT/artemis-commons-1.3.0-20160426.030416-44.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.3.0-SNAPSHOT/artemis-selector-1.3.0-20160426.030831-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.3.0-SNAPSHOT/artemis-journal-1.3.0-20160426.031147-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.3.0-SNAPSHOT/artemis-native-1.3.0-20160426.031126-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jdbc-store/1.3.0-SNAPSHOT/artemis-jdbc-store-1.3.0-20160426.031157-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.3.0-SNAPSHOT/artemis-core-client-1.3.0-20160426.030751-43.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.8.Final/jgroups-3.6.8.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.3.0-SNAPSHOT/artemis-jms-server-1.3.0-20160426.032135-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.3.0-SNAPSHOT/artemis-jms-client-1.3.0-20160426.031055-43.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.3.0-SNAPSHOT/artemis-service-extensions-1.3.0-20160426.031945-43.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>     com.intellij.rt.execution.application.AppMain fi.julien.artemisrest.Main
>     [Fatal Error] :2:6: The processing instruction target matching
>     "[xX][mM][lL]" is not allowed.
>     Exception in thread "main" org.xml.sax.SAXParseException;
>     lineNumber: 2; columnNumber: 6; The processing instruction target
>     matching "[xX][mM][lL]" is not allowed.
>         at
>     com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>         at
>     com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.readerToElement(XMLUtil.java:86)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.stringToElement(XMLUtil.java:52)
>         at
>     org.apache.activemq.artemis.core.config.FileDeploymentManager.readConfiguration(FileDeploymentManager.java:76)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.initStart(EmbeddedActiveMQ.java:127)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.start(EmbeddedActiveMQ.java:115)
>         at
>     org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ.start(EmbeddedRestActiveMQ.java:59)
>         at fi.julien.artemisrest.Main.main(Main.java:37)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>     Process finished with exit code 1
>
> I am using Github's master branch from last week Wednesday, 1.3.0-SNAPSHOT
> Thanks
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/26/2016 08:01 PM, Justin Bertram wrote:
>> Can you provide the full stack-trace?
>>
>> Also, what version of Artemis are you using?
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, April 26, 2016 11:34:20 AM
>> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>
>> Thank you for your answer Justin.
>> When using the following one :
>>
>> <?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
>> (ASF) under one or more contributor license agreements. See the NOTICE
>> file distributed with this work for additional information regarding
>> copyright ownership. The ASF licenses this file to you under the Apache
>> License, Version 2.0 (the "License"); you may not use this file except
>> in compliance with the License. You may obtain a copy of the License at
>> http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
>> law or agreed to in writing, software distributed under the License is
>> distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> KIND, either express or implied. See the License for the specific
>> language governing permissions and limitations under the License. -->
>> <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
>> /schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
>> queue used by the example--> <queue name="orders"/> </jms> <core
>> xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
>> name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
>> <!--security for example queue--> <security-setting match="#">
>> <permission type="createDurableQueue" roles="guest"/> <permission
>> type="deleteDurableQueue" roles="guest"/> <permission
>> type="createNonDurableQueue" roles="guest"/> <permission
>> type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
>> roles="guest"/> <permission type="send" roles="guest"/>
>> </security-setting> </security-settings> </core> </configuration>
>>
>>
>> I get the following error :
>>
>> [Fatal Error] :2:6: The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>> Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
>> columnNumber: 6; The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>>     at
>> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>>
>> Would you know why?
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/26/2016 07:13 PM, Justin Bertram wrote:
>>> You should be able to put the broker.xml anywhere on the application's classpath.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Tuesday, April 26, 2016 11:00:48 AM
>>> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>>
>>> Hi everyone,
>>>
>>> Sorry for bothering, I am having some troubles working with Artemis,
>>> more particularly
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
>>> would like to know if someone here could give me a hand please. I did
>>> not find this part documented, I could document it after understanding
>>> it better.
>>>
>>> Where should I put the broker.xml ?
>>> I have started a project where I have
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
>>> org.myproject packages in the same directory.
>>>
>>> At the moment my program is as simple as that since it is my first time
>>> working with Artemis :
>>>
>>> public static void main(String[] args) throws Exception{
>>>
>>>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>>>
>>> Thank you very much in advance,
>>>


Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Posted by Julien d <ju...@iki.fi>.
Hello everyone,

Yesterday's example works, here is the stacktrace :

    Apr 27, 2016 10:39:52 AM
    org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
    parseMainConfig
    WARN: AMQ222018: AIO was not located on this platform, it will fall
    back to using pure Java NIO. If your platform is Linux, install
    LibAIO to enable the AIO journal
    Apr 27, 2016 10:39:53 AM
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
    INFO: AMQ221000: live Message Broker is starting with configuration
    Broker Configuration
    (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
    Apr 27, 2016 10:39:53 AM
    org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
    <init>
    INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
    protocol support for: CORE
    Apr 27, 2016 10:39:53 AM
    org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
    INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
    [CORE]
    Apr 27, 2016 10:39:53 AM
    org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
    INFO: AMQ221007: Server is now live
    Apr 27, 2016 10:39:53 AM
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
    INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
    1.3.0-SNAPSHOT [localhost, nodeID=3ad9edc7-0c4b-11e6-bf5e-60672022829f]
    [Wed Apr 27 10:39:53 EEST 2016] Servlet for path '/' already defined
    and no default will be used.

However when running the example PostOrder from
examples/features/standard/rest/dup-send with

http://localhost:61616/queues/jms.queue.orders

It seems not communicating to the server and just hangs.

By debugging, I found out it hangs in this function :

ClientResponse res = request.head();

in

private native int socketRead0(FileDescriptor fd, byte b[], int off, int len, int timeout)

On the server side, I have no further display. Any idea of what goes
wrong and why the server does not respond to the head request? Thanks in
advance and have a nice day.

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 09:29 PM, Justin Bertram wrote:
> I'm not exactly sure why you're getting that exception.  I just created a simple, Mavenized example demonstrating how to create an embedded REST server here [1].  Try that out.
>
>
> Justin
>
> [1] https://github.com/jbertram/activemq-artemis/commit/875b8764aabb13794578c8c436b4cdc527502d59
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 12:50:17 PM
> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Here it is :
>
>     /usr/lib/jvm/java-8-openjdk/bin/java -Didea.launcher.port=7533
>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>     -Dfile.encoding=UTF-8 -classpath
>     /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/johnny/IdeaProjects/activemq-artemis-master/artemis-rest/target/classes:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.16.Final/resteasy-jaxrs-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.16.Final/resteasy-jaxb-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.16.Final/resteasy-jackson-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.16.Final/resteasy-atom-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.16.Final/tjws-3.0.16.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.3.0-SNAPSHOT/artemis-server-1.3.0-20160426.031638-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.3.0-SNAPSHOT/artemis-commons-1.3.0-20160426.030416-44.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.3.0-SNAPSHOT/artemis-selector-1.3.0-20160426.030831-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.3.0-SNAPSHOT/artemis-journal-1.3.0-20160426.031147-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.3.0-SNAPSHOT/artemis-native-1.3.0-20160426.031126-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jdbc-store/1.3.0-SNAPSHOT/artemis-jdbc-store-1.3.0-20160426.031157-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.3.0-SNAPSHOT/artemis-core-client-1.3.0-20160426.030751-43.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.8.Final/jgroups-3.6.8.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.3.0-SNAPSHOT/artemis-jms-server-1.3.0-20160426.032135-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.3.0-SNAPSHOT/artemis-jms-client-1.3.0-20160426.031055-43.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.3.0-SNAPSHOT/artemis-service-extensions-1.3.0-20160426.031945-43.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>     com.intellij.rt.execution.application.AppMain fi.julien.artemisrest.Main
>     [Fatal Error] :2:6: The processing instruction target matching
>     "[xX][mM][lL]" is not allowed.
>     Exception in thread "main" org.xml.sax.SAXParseException;
>     lineNumber: 2; columnNumber: 6; The processing instruction target
>     matching "[xX][mM][lL]" is not allowed.
>         at
>     com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>         at
>     com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.readerToElement(XMLUtil.java:86)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.stringToElement(XMLUtil.java:52)
>         at
>     org.apache.activemq.artemis.core.config.FileDeploymentManager.readConfiguration(FileDeploymentManager.java:76)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.initStart(EmbeddedActiveMQ.java:127)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.start(EmbeddedActiveMQ.java:115)
>         at
>     org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ.start(EmbeddedRestActiveMQ.java:59)
>         at fi.julien.artemisrest.Main.main(Main.java:37)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>     Process finished with exit code 1
>
> I am using Github's master branch from last week Wednesday, 1.3.0-SNAPSHOT
> Thanks
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/26/2016 08:01 PM, Justin Bertram wrote:
>> Can you provide the full stack-trace?
>>
>> Also, what version of Artemis are you using?
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, April 26, 2016 11:34:20 AM
>> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>
>> Thank you for your answer Justin.
>> When using the following one :
>>
>> <?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
>> (ASF) under one or more contributor license agreements. See the NOTICE
>> file distributed with this work for additional information regarding
>> copyright ownership. The ASF licenses this file to you under the Apache
>> License, Version 2.0 (the "License"); you may not use this file except
>> in compliance with the License. You may obtain a copy of the License at
>> http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
>> law or agreed to in writing, software distributed under the License is
>> distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> KIND, either express or implied. See the License for the specific
>> language governing permissions and limitations under the License. -->
>> <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
>> /schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
>> queue used by the example--> <queue name="orders"/> </jms> <core
>> xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
>> name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
>> <!--security for example queue--> <security-setting match="#">
>> <permission type="createDurableQueue" roles="guest"/> <permission
>> type="deleteDurableQueue" roles="guest"/> <permission
>> type="createNonDurableQueue" roles="guest"/> <permission
>> type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
>> roles="guest"/> <permission type="send" roles="guest"/>
>> </security-setting> </security-settings> </core> </configuration>
>>
>>
>> I get the following error :
>>
>> [Fatal Error] :2:6: The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>> Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
>> columnNumber: 6; The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>>     at
>> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>>
>> Would you know why?
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/26/2016 07:13 PM, Justin Bertram wrote:
>>> You should be able to put the broker.xml anywhere on the application's classpath.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Tuesday, April 26, 2016 11:00:48 AM
>>> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>>
>>> Hi everyone,
>>>
>>> Sorry for bothering, I am having some troubles working with Artemis,
>>> more particularly
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
>>> would like to know if someone here could give me a hand please. I did
>>> not find this part documented, I could document it after understanding
>>> it better.
>>>
>>> Where should I put the broker.xml ?
>>> I have started a project where I have
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
>>> org.myproject packages in the same directory.
>>>
>>> At the moment my program is as simple as that since it is my first time
>>> working with Artemis :
>>>
>>> public static void main(String[] args) throws Exception{
>>>
>>>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>>>
>>> Thank you very much in advance,
>>>

Re: Embedded REST - Missing msg-pull-subscriptions when request HEAD

Posted by Justin Bertram <jb...@apache.com>.
What documentation are you reading?  The documentation at http://activemq.apache.org/artemis/docs/1.2.0/rest.html indicates that you will receive this exact kind of response when you send a HEAD request to a queue.  The "msg-pull-consumers" and "msg-push-consumers" are what you need to create a consumer on a queue as noted in the documentation under the "Queue Resource Response Headers" heading.  This process is also outlined in the documentation under the "Creating an Auto-Ack Consumer or Subscription" heading.

I believe you are getting confused between a queue and a topic.  Inspect the documentation more closely and I think you'll find the information you need.


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Wednesday, May 4, 2016 10:30:48 AM
Subject: Re: Embedded REST - Missing msg-pull-subscriptions when request HEAD

Hi,

I am facing an unexpected issue. As I understand from the documentation
I have to register consumers subscribing. However using curl, how could
I do that?
At the moment when I issue  curl --head
http://localhost:8081/queues/orders, I obtain as response :

    HTTP/1.1 200 Ok
    connection: keep-alive
    msg-create-with-id: http://localhost:8081/queues/orders/create/{id}
    date: Wed, 04 May 2016 11:38:58 GMT
    server: D. Rogatkin's TJWS based on Acme.Serve/Version 1.70,
    $Revision: 1.194 $
    msg-pull-consumers: http://localhost:8081/queues/orders/pull-consumers
    msg-create: http://localhost:8081/queues/orders/create
    msg-push-consumers: http://localhost:8081/queues/orders/push-consumers
    keep-alive: timeout=30, max=100
    mime-version: 1.0

URLs mentioned in the documentation :

    |msg-pull-subscriptions:
    http://example.com/topics/jms.topic.foo/pull-subscriptions
    msg-push-subscriptions:
    http://example.com/topics/jms.topic.foo/push-subscriptions|

are not present. I want to be able to receive messages sent to a queue
from cURL.

How can I have the needed URL path enabled and functional in my case for
cURL in my case?

Best regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 11:55 PM, Justin Bertram wrote:
> One important thing to realize is that the body of a message is just a byte array.  Try this:
>
>   byte[] body = new byte[message2.getBodySize()];
>   msg.getBodyBuffer().readBytes(body);
>   System.out.println(new String(body));
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, May 3, 2016 2:46:53 PM
> Subject: Re: Embedded REST - monitor queues (without JMS)
>
> Thanks, now it works much better however I do not get what I expected as
> output.
>
> ClientSession session = clientSessionFactory.createSession(); session.start(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(); System.out.println(message2.getBodyBuffer().toString()); consumer.close(); session.close();
>
> is my current code I get as output following my request :
>
>     org.apache.activemq.artemis.core.buffers.impl.ResetLimitWrappedActiveMQBuffer@45385f75
>
>
> And if I do :
>
> System.out.println(message2.getBodyBuffer().readString());
>
> I get this error :
>
>     [Tue May 03 22:40:44 EEST 2016] Servlet for path '/' already defined
>     and no default will be used. Exception in thread "main"
>     java.lang.OutOfMemoryError: Java heap space     at
>     org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readSimpleStringInternal(ChannelBufferWrapper.java:89)
>         at
>     org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readStringInternal(ChannelBufferWrapper.java:113)
>         at
>     org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readString(ChannelBufferWrapper.java:96)
>         at
>     org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:44)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)     at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 
>
> I am sending this : <order>    <name>Bill</name>    <item>iPhone
> 4</item>    <cost>$199.99</cost> </order> through : curl -X POST
> -d@test.xml http://localhost:8081/queues/orders/create <order>   
> <name>Bill</name>    <item>iPhone 4</item>    <cost>$199.99</cost>
> </order> Why would not it display the message content?
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/03/2016 10:27 PM, Justin Bertram wrote:
>>> Did I do anything wrong?
>> Yes. :)
>>
>> First, you aren't protecting against an NPE in the case where consumer.receive(1000) times out and returns null.
>>
>> Second, you aren't calling start() on your session so there's no possibility of you receiving messages.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, May 3, 2016 2:15:44 PM
>> Subject: Re: Embedded REST - monitor queues (without JMS)
>>
>> Hi again,
>>
>> Using the consumer method (which is best for my case) I run into a
>> NullPointer exception when  accessing my message body :
>>
>>     [Tue May 03 22:10:25 EEST 2016] Servlet for path '/' already defined
>>     and no default will be used.
>>     Exception in thread "main" java.lang.NullPointerException
>>         at
>>     org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:49)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>         at
>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>         at
>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>
>>
>> Here is my code:
>>
>> Restserver.start(); QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1); ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); ClientSession session = clientSessionFactory.createSession(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(1000); System.out.println(message2.getBodyBuffer().toString()); <------- Error happens here consumer.close();
>>
>>
>> Did I do anything wrong?
>>
>> Regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 05/03/2016 04:38 PM, Justin Bertram wrote:
>>> You can use the new URL methods to make connections simpler, e.g. 
>>>
>>>   ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0");
>>>   ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory();
>>>
>>> Then once you receive the message you can use org.apache.activemq.artemis.api.core.Message#getBodyBuffer().
>>>
>>> If you want to see what's in the queue periodically without actually consuming the messages you can use a queue browser or the management interface.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Tuesday, May 3, 2016 2:50:44 AM
>>> Subject: Re: Embedded REST - monitor queues (without JMS)
>>>
>>> Hello Justin,
>>>
>>> About my yesterday's questions :
>>>
>>>
>>>     I am posting the following to
>>>     http://localhost:8081/queues/orders/create :
>>>
>>>         <order>
>>>            <name>Bill</name>
>>>            <item>iPhone 4</item>
>>>            <cost>$199.99</cost>
>>>         </order>
>>>
>>>      1.  How can I access, internally in the program, the message that I
>>>         receive upon reception?
>>>      2.  How can I, still upon reception, send the following message to
>>>         all subscribers of "queue2"?
>>>
>>>     <state>received</state>
>>>
>>> As I understand about my two previous questions I would need to whether
>>> 1 / Be able to handle response -
>>> https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
>>> referring to here, I get the following issues :
>>>
>>> ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
>>>         new TransportConfiguration(
>>>                 InVMConnectorFactory.class.getName()));
>>>
>>> --> ActiveMQClient.createClientSessionFactory method does not exist in 
>>> org.apache.activemq.artemis.api.core.TransportConfiguration
>>>
>>> message.getBody()
>>>
>>> -->cannot be resolved
>>>
>>>>> Was there any change that implied this current issue?
>>> 2/ Be able to access the list of the elements in a queue periodically
>>> (not the best way I guess) however I cannot find a way to access the
>>> core queue management from the REST embedded server
>>>
>>>
>>> Best regards,
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 05/03/2016 12:07 AM, Julien d wrote:
>>>> Thank you so much for your help Justin.
>>>> I now understand much better.
>>>>
>>>> As far as queues are concerned, I am now doing it this way in order to
>>>> create one :
>>>> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
>>>> I guess that's quite the right way to do it.
>>>> What about if I want to use broker.xml ? Since in the example it was
>>>> the JMS way :
>>>>
>>>> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
>>>> <queue name="orders"/> </jms>
>>>>
>>>> And most important and very likely my last questions :)
>>>>
>>>> I am posting the following to http://localhost:8081/queues/orders/create :
>>>>
>>>>     <order>
>>>>        <name>Bill</name>
>>>>        <item>iPhone 4</item>
>>>>        <cost>$199.99</cost>
>>>>     </order>
>>>>
>>>>  1.  How can I access, internally in the program, the message that I
>>>>     receive upon reception?
>>>>  2.  How can I, still upon reception, send the following message to
>>>>     all subscribers of "queue2"?
>>>>
>>>>         <state>received</state>
>>>>
>>>> Regards,
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>>>>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>>>>
>>>>>
>>>>> Justin
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Julien d" <ju...@iki.fi>
>>>>> To: dev@activemq.apache.org
>>>>> Sent: Monday, May 2, 2016 10:02:05 AM
>>>>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>>
>>>>> I do not have one on either side at the moment. Should it be on server
>>>>> side? Would you please have any documentation link?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Julien D.
>>>>>
>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>
>>>>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>>>>> How is your login.config configured?
>>>>>>
>>>>>>
>>>>>> Justin
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: "Julien d" <ju...@iki.fi>
>>>>>> To: dev@activemq.apache.org
>>>>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>>>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I get the  following stacktrace on dup-send's side when querying the
>>>>>> REST embedded server. I have been checking around and it should work
>>>>>> since I have artemis-roles/users.proprieties in my Java path.
>>>>>> Following are the stacktraces [1].
>>>>>>
>>>>>> Anyone having the issue or would know what is actually happening? Justin?
>>>>>>
>>>>>> Thank you in advance and hope you had a nice May Day.
>>>>>>
>>>>>> Regards,
>>>>>> Julien
>>>>>>
>>>>>>
>>>>>> [1]:
>>>>>> Server :
>>>>>>
>>>>>>     May 02, 2016 12:23:43 PM
>>>>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>>>>     parseMainConfig
>>>>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>>>>     back to using pure Java NIO. If your platform is Linux, install
>>>>>>     LibAIO to enable the AIO journal
>>>>>>     May 02, 2016 12:23:44 PM
>>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>>>>     Broker Configuration
>>>>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>>>>     May 02, 2016 12:23:44 PM
>>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>>>>     <init>
>>>>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>>>>     protocol support for: CORE
>>>>>>     May 02, 2016 12:23:45 PM
>>>>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>>>>     [CORE]
>>>>>>     May 02, 2016 12:23:45 PM
>>>>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>>>>     INFO: AMQ221007: Server is now live
>>>>>>     May 02, 2016 12:23:45 PM
>>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>>>>     and no default will be used.
>>>>>>     May 02, 2016 12:23:51 PM
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>>>>     handleCreateSession
>>>>>>     ERROR: AMQ224018: Failed to create session
>>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>>>>         at
>>>>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>>         at
>>>>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>>
>>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>         at
>>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>>>         at
>>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>>>>         ... 11 more
>>>>>>
>>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>>>>     java.net.Socket
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Client :
>>>>>>
>>>>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>>>>     -Dfile.encoding=UTF-8 -classpath
>>>>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>>>>>
>>>>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>>>>>
>>>>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>>>>>
>>>>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>>>>>
>>>>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>>>>>
>>>>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>>>>     Send Bill's order...
>>>>>>     Exception in thread "main" java.lang.NullPointerException
>>>>>>         at PostOrder.main(PostOrder.java:36)
>>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>         at
>>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>>>         at
>>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>>>>         at
>>>>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>>>>
>>>>>>     Process finished with exit code 1
>>>>>>
>>>>>> Julien D.
>>>>>>
>>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>>
>>>>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>>>>
>>>>>>>
>>>>>>> Justin
>>>>>>>
>>>>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>> From: "Julien d" <ju...@iki.fi>
>>>>>>> To: dev@activemq.apache.org
>>>>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>>>>> Subject: Re: Embedding REST
>>>>>>>
>>>>>>> Thank you Justin.
>>>>>>> Where do you think it would be best to document embedding REST once I am
>>>>>>> more familiar with it?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Julien D.
>>>>>>>
>>>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>>>
>>>>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>>>>

Re: Embedded REST - Missing msg-pull-subscriptions when request HEAD

Posted by Julien d <ju...@iki.fi>.
Hi,

I am facing an unexpected issue. As I understand from the documentation
I have to register consumers subscribing. However using curl, how could
I do that?
At the moment when I issue  curl --head
http://localhost:8081/queues/orders, I obtain as response :

    HTTP/1.1 200 Ok
    connection: keep-alive
    msg-create-with-id: http://localhost:8081/queues/orders/create/{id}
    date: Wed, 04 May 2016 11:38:58 GMT
    server: D. Rogatkin's TJWS based on Acme.Serve/Version 1.70,
    $Revision: 1.194 $
    msg-pull-consumers: http://localhost:8081/queues/orders/pull-consumers
    msg-create: http://localhost:8081/queues/orders/create
    msg-push-consumers: http://localhost:8081/queues/orders/push-consumers
    keep-alive: timeout=30, max=100
    mime-version: 1.0

URLs mentioned in the documentation :

    |msg-pull-subscriptions:
    http://example.com/topics/jms.topic.foo/pull-subscriptions
    msg-push-subscriptions:
    http://example.com/topics/jms.topic.foo/push-subscriptions|

are not present. I want to be able to receive messages sent to a queue
from cURL.

How can I have the needed URL path enabled and functional in my case for
cURL in my case?

Best regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 11:55 PM, Justin Bertram wrote:
> One important thing to realize is that the body of a message is just a byte array.  Try this:
>
>   byte[] body = new byte[message2.getBodySize()];
>   msg.getBodyBuffer().readBytes(body);
>   System.out.println(new String(body));
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, May 3, 2016 2:46:53 PM
> Subject: Re: Embedded REST - monitor queues (without JMS)
>
> Thanks, now it works much better however I do not get what I expected as
> output.
>
> ClientSession session = clientSessionFactory.createSession(); session.start(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(); System.out.println(message2.getBodyBuffer().toString()); consumer.close(); session.close();
>
> is my current code I get as output following my request :
>
>     org.apache.activemq.artemis.core.buffers.impl.ResetLimitWrappedActiveMQBuffer@45385f75
>
>
> And if I do :
>
> System.out.println(message2.getBodyBuffer().readString());
>
> I get this error :
>
>     [Tue May 03 22:40:44 EEST 2016] Servlet for path '/' already defined
>     and no default will be used. Exception in thread "main"
>     java.lang.OutOfMemoryError: Java heap space     at
>     org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readSimpleStringInternal(ChannelBufferWrapper.java:89)
>         at
>     org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readStringInternal(ChannelBufferWrapper.java:113)
>         at
>     org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readString(ChannelBufferWrapper.java:96)
>         at
>     org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:44)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)     at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 
>
> I am sending this : <order>    <name>Bill</name>    <item>iPhone
> 4</item>    <cost>$199.99</cost> </order> through : curl -X POST
> -d@test.xml http://localhost:8081/queues/orders/create <order>   
> <name>Bill</name>    <item>iPhone 4</item>    <cost>$199.99</cost>
> </order> Why would not it display the message content?
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/03/2016 10:27 PM, Justin Bertram wrote:
>>> Did I do anything wrong?
>> Yes. :)
>>
>> First, you aren't protecting against an NPE in the case where consumer.receive(1000) times out and returns null.
>>
>> Second, you aren't calling start() on your session so there's no possibility of you receiving messages.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, May 3, 2016 2:15:44 PM
>> Subject: Re: Embedded REST - monitor queues (without JMS)
>>
>> Hi again,
>>
>> Using the consumer method (which is best for my case) I run into a
>> NullPointer exception when  accessing my message body :
>>
>>     [Tue May 03 22:10:25 EEST 2016] Servlet for path '/' already defined
>>     and no default will be used.
>>     Exception in thread "main" java.lang.NullPointerException
>>         at
>>     org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:49)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>         at
>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>         at
>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>
>>
>> Here is my code:
>>
>> Restserver.start(); QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1); ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); ClientSession session = clientSessionFactory.createSession(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(1000); System.out.println(message2.getBodyBuffer().toString()); <------- Error happens here consumer.close();
>>
>>
>> Did I do anything wrong?
>>
>> Regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 05/03/2016 04:38 PM, Justin Bertram wrote:
>>> You can use the new URL methods to make connections simpler, e.g. 
>>>
>>>   ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0");
>>>   ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory();
>>>
>>> Then once you receive the message you can use org.apache.activemq.artemis.api.core.Message#getBodyBuffer().
>>>
>>> If you want to see what's in the queue periodically without actually consuming the messages you can use a queue browser or the management interface.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Tuesday, May 3, 2016 2:50:44 AM
>>> Subject: Re: Embedded REST - monitor queues (without JMS)
>>>
>>> Hello Justin,
>>>
>>> About my yesterday's questions :
>>>
>>>
>>>     I am posting the following to
>>>     http://localhost:8081/queues/orders/create :
>>>
>>>         <order>
>>>            <name>Bill</name>
>>>            <item>iPhone 4</item>
>>>            <cost>$199.99</cost>
>>>         </order>
>>>
>>>      1.  How can I access, internally in the program, the message that I
>>>         receive upon reception?
>>>      2.  How can I, still upon reception, send the following message to
>>>         all subscribers of "queue2"?
>>>
>>>     <state>received</state>
>>>
>>> As I understand about my two previous questions I would need to whether
>>> 1 / Be able to handle response -
>>> https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
>>> referring to here, I get the following issues :
>>>
>>> ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
>>>         new TransportConfiguration(
>>>                 InVMConnectorFactory.class.getName()));
>>>
>>> --> ActiveMQClient.createClientSessionFactory method does not exist in 
>>> org.apache.activemq.artemis.api.core.TransportConfiguration
>>>
>>> message.getBody()
>>>
>>> -->cannot be resolved
>>>
>>>>> Was there any change that implied this current issue?
>>> 2/ Be able to access the list of the elements in a queue periodically
>>> (not the best way I guess) however I cannot find a way to access the
>>> core queue management from the REST embedded server
>>>
>>>
>>> Best regards,
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 05/03/2016 12:07 AM, Julien d wrote:
>>>> Thank you so much for your help Justin.
>>>> I now understand much better.
>>>>
>>>> As far as queues are concerned, I am now doing it this way in order to
>>>> create one :
>>>> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
>>>> I guess that's quite the right way to do it.
>>>> What about if I want to use broker.xml ? Since in the example it was
>>>> the JMS way :
>>>>
>>>> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
>>>> <queue name="orders"/> </jms>
>>>>
>>>> And most important and very likely my last questions :)
>>>>
>>>> I am posting the following to http://localhost:8081/queues/orders/create :
>>>>
>>>>     <order>
>>>>        <name>Bill</name>
>>>>        <item>iPhone 4</item>
>>>>        <cost>$199.99</cost>
>>>>     </order>
>>>>
>>>>  1.  How can I access, internally in the program, the message that I
>>>>     receive upon reception?
>>>>  2.  How can I, still upon reception, send the following message to
>>>>     all subscribers of "queue2"?
>>>>
>>>>         <state>received</state>
>>>>
>>>> Regards,
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>>>>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>>>>
>>>>>
>>>>> Justin
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Julien d" <ju...@iki.fi>
>>>>> To: dev@activemq.apache.org
>>>>> Sent: Monday, May 2, 2016 10:02:05 AM
>>>>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>>
>>>>> I do not have one on either side at the moment. Should it be on server
>>>>> side? Would you please have any documentation link?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Julien D.
>>>>>
>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>
>>>>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>>>>> How is your login.config configured?
>>>>>>
>>>>>>
>>>>>> Justin
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: "Julien d" <ju...@iki.fi>
>>>>>> To: dev@activemq.apache.org
>>>>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>>>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I get the  following stacktrace on dup-send's side when querying the
>>>>>> REST embedded server. I have been checking around and it should work
>>>>>> since I have artemis-roles/users.proprieties in my Java path.
>>>>>> Following are the stacktraces [1].
>>>>>>
>>>>>> Anyone having the issue or would know what is actually happening? Justin?
>>>>>>
>>>>>> Thank you in advance and hope you had a nice May Day.
>>>>>>
>>>>>> Regards,
>>>>>> Julien
>>>>>>
>>>>>>
>>>>>> [1]:
>>>>>> Server :
>>>>>>
>>>>>>     May 02, 2016 12:23:43 PM
>>>>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>>>>     parseMainConfig
>>>>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>>>>     back to using pure Java NIO. If your platform is Linux, install
>>>>>>     LibAIO to enable the AIO journal
>>>>>>     May 02, 2016 12:23:44 PM
>>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>>>>     Broker Configuration
>>>>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>>>>     May 02, 2016 12:23:44 PM
>>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>>>>     <init>
>>>>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>>>>     protocol support for: CORE
>>>>>>     May 02, 2016 12:23:45 PM
>>>>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>>>>     [CORE]
>>>>>>     May 02, 2016 12:23:45 PM
>>>>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>>>>     INFO: AMQ221007: Server is now live
>>>>>>     May 02, 2016 12:23:45 PM
>>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>>>>     and no default will be used.
>>>>>>     May 02, 2016 12:23:51 PM
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>>>>     handleCreateSession
>>>>>>     ERROR: AMQ224018: Failed to create session
>>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>>>>         at
>>>>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>>         at
>>>>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>>
>>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>>>>         at
>>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>>>>         at
>>>>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>         at
>>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>>>         at
>>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>>>>         at
>>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>>>>         ... 11 more
>>>>>>
>>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>>     message=AMQ119031: Unable to validate user]
>>>>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>>>>     java.net.Socket
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Client :
>>>>>>
>>>>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>>>>     -Dfile.encoding=UTF-8 -classpath
>>>>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>>>>>
>>>>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>>>>>
>>>>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>>>>>
>>>>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>>>>>
>>>>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>>>>>
>>>>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>>>>     Send Bill's order...
>>>>>>     Exception in thread "main" java.lang.NullPointerException
>>>>>>         at PostOrder.main(PostOrder.java:36)
>>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>         at
>>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>>>         at
>>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>>>>         at
>>>>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>>>>
>>>>>>     Process finished with exit code 1
>>>>>>
>>>>>> Julien D.
>>>>>>
>>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>>
>>>>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>>>>
>>>>>>>
>>>>>>> Justin
>>>>>>>
>>>>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>> From: "Julien d" <ju...@iki.fi>
>>>>>>> To: dev@activemq.apache.org
>>>>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>>>>> Subject: Re: Embedding REST
>>>>>>>
>>>>>>> Thank you Justin.
>>>>>>> Where do you think it would be best to document embedding REST once I am
>>>>>>> more familiar with it?
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Julien D.
>>>>>>>
>>>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>>>
>>>>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>>>>


Re: Embedded REST - monitor queues (without JMS)

Posted by Justin Bertram <jb...@apache.com>.
One important thing to realize is that the body of a message is just a byte array.  Try this:

  byte[] body = new byte[message2.getBodySize()];
  msg.getBodyBuffer().readBytes(body);
  System.out.println(new String(body));


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Tuesday, May 3, 2016 2:46:53 PM
Subject: Re: Embedded REST - monitor queues (without JMS)

Thanks, now it works much better however I do not get what I expected as
output.

ClientSession session = clientSessionFactory.createSession(); session.start(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(); System.out.println(message2.getBodyBuffer().toString()); consumer.close(); session.close();

is my current code I get as output following my request :

    org.apache.activemq.artemis.core.buffers.impl.ResetLimitWrappedActiveMQBuffer@45385f75


And if I do :

System.out.println(message2.getBodyBuffer().readString());

I get this error :

    [Tue May 03 22:40:44 EEST 2016] Servlet for path '/' already defined
    and no default will be used. Exception in thread "main"
    java.lang.OutOfMemoryError: Java heap space     at
    org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readSimpleStringInternal(ChannelBufferWrapper.java:89)
        at
    org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readStringInternal(ChannelBufferWrapper.java:113)
        at
    org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readString(ChannelBufferWrapper.java:96)
        at
    org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:44)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)     at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 

I am sending this : <order>    <name>Bill</name>    <item>iPhone
4</item>    <cost>$199.99</cost> </order> through : curl -X POST
-d@test.xml http://localhost:8081/queues/orders/create <order>   
<name>Bill</name>    <item>iPhone 4</item>    <cost>$199.99</cost>
</order> Why would not it display the message content?

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 10:27 PM, Justin Bertram wrote:
>> Did I do anything wrong?
> Yes. :)
>
> First, you aren't protecting against an NPE in the case where consumer.receive(1000) times out and returns null.
>
> Second, you aren't calling start() on your session so there's no possibility of you receiving messages.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, May 3, 2016 2:15:44 PM
> Subject: Re: Embedded REST - monitor queues (without JMS)
>
> Hi again,
>
> Using the consumer method (which is best for my case) I run into a
> NullPointer exception when  accessing my message body :
>
>     [Tue May 03 22:10:25 EEST 2016] Servlet for path '/' already defined
>     and no default will be used.
>     Exception in thread "main" java.lang.NullPointerException
>         at
>     org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:49)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>
> Here is my code:
>
> Restserver.start(); QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1); ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); ClientSession session = clientSessionFactory.createSession(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(1000); System.out.println(message2.getBodyBuffer().toString()); <------- Error happens here consumer.close();
>
>
> Did I do anything wrong?
>
> Regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/03/2016 04:38 PM, Justin Bertram wrote:
>> You can use the new URL methods to make connections simpler, e.g. 
>>
>>   ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0");
>>   ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory();
>>
>> Then once you receive the message you can use org.apache.activemq.artemis.api.core.Message#getBodyBuffer().
>>
>> If you want to see what's in the queue periodically without actually consuming the messages you can use a queue browser or the management interface.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, May 3, 2016 2:50:44 AM
>> Subject: Re: Embedded REST - monitor queues (without JMS)
>>
>> Hello Justin,
>>
>> About my yesterday's questions :
>>
>>
>>     I am posting the following to
>>     http://localhost:8081/queues/orders/create :
>>
>>         <order>
>>            <name>Bill</name>
>>            <item>iPhone 4</item>
>>            <cost>$199.99</cost>
>>         </order>
>>
>>      1.  How can I access, internally in the program, the message that I
>>         receive upon reception?
>>      2.  How can I, still upon reception, send the following message to
>>         all subscribers of "queue2"?
>>
>>     <state>received</state>
>>
>> As I understand about my two previous questions I would need to whether
>> 1 / Be able to handle response -
>> https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
>> referring to here, I get the following issues :
>>
>> ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
>>         new TransportConfiguration(
>>                 InVMConnectorFactory.class.getName()));
>>
>> --> ActiveMQClient.createClientSessionFactory method does not exist in 
>> org.apache.activemq.artemis.api.core.TransportConfiguration
>>
>> message.getBody()
>>
>> -->cannot be resolved
>>
>>>> Was there any change that implied this current issue?
>> 2/ Be able to access the list of the elements in a queue periodically
>> (not the best way I guess) however I cannot find a way to access the
>> core queue management from the REST embedded server
>>
>>
>> Best regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 05/03/2016 12:07 AM, Julien d wrote:
>>> Thank you so much for your help Justin.
>>> I now understand much better.
>>>
>>> As far as queues are concerned, I am now doing it this way in order to
>>> create one :
>>> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
>>> I guess that's quite the right way to do it.
>>> What about if I want to use broker.xml ? Since in the example it was
>>> the JMS way :
>>>
>>> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
>>> <queue name="orders"/> </jms>
>>>
>>> And most important and very likely my last questions :)
>>>
>>> I am posting the following to http://localhost:8081/queues/orders/create :
>>>
>>>     <order>
>>>        <name>Bill</name>
>>>        <item>iPhone 4</item>
>>>        <cost>$199.99</cost>
>>>     </order>
>>>
>>>  1.  How can I access, internally in the program, the message that I
>>>     receive upon reception?
>>>  2.  How can I, still upon reception, send the following message to
>>>     all subscribers of "queue2"?
>>>
>>>         <state>received</state>
>>>
>>> Regards,
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>>>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>>>
>>>>
>>>> Justin
>>>>
>>>> ----- Original Message -----
>>>> From: "Julien d" <ju...@iki.fi>
>>>> To: dev@activemq.apache.org
>>>> Sent: Monday, May 2, 2016 10:02:05 AM
>>>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>
>>>> I do not have one on either side at the moment. Should it be on server
>>>> side? Would you please have any documentation link?
>>>>
>>>> Regards,
>>>>
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>>
>>>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>>>> How is your login.config configured?
>>>>>
>>>>>
>>>>> Justin
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Julien d" <ju...@iki.fi>
>>>>> To: dev@activemq.apache.org
>>>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>>
>>>>> Hi,
>>>>>
>>>>> I get the  following stacktrace on dup-send's side when querying the
>>>>> REST embedded server. I have been checking around and it should work
>>>>> since I have artemis-roles/users.proprieties in my Java path.
>>>>> Following are the stacktraces [1].
>>>>>
>>>>> Anyone having the issue or would know what is actually happening? Justin?
>>>>>
>>>>> Thank you in advance and hope you had a nice May Day.
>>>>>
>>>>> Regards,
>>>>> Julien
>>>>>
>>>>>
>>>>> [1]:
>>>>> Server :
>>>>>
>>>>>     May 02, 2016 12:23:43 PM
>>>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>>>     parseMainConfig
>>>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>>>     back to using pure Java NIO. If your platform is Linux, install
>>>>>     LibAIO to enable the AIO journal
>>>>>     May 02, 2016 12:23:44 PM
>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>>>     Broker Configuration
>>>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>>>     May 02, 2016 12:23:44 PM
>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>>>     <init>
>>>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>>>     protocol support for: CORE
>>>>>     May 02, 2016 12:23:45 PM
>>>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>>>     [CORE]
>>>>>     May 02, 2016 12:23:45 PM
>>>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>>>     INFO: AMQ221007: Server is now live
>>>>>     May 02, 2016 12:23:45 PM
>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>>>     and no default will be used.
>>>>>     May 02, 2016 12:23:51 PM
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>>>     handleCreateSession
>>>>>     ERROR: AMQ224018: Failed to create session
>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>>>         at
>>>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>>>         at
>>>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>         at
>>>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>
>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>         at
>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>>>         at
>>>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>         at
>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>>         at
>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>>>         ... 11 more
>>>>>
>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>>>     java.net.Socket
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Client :
>>>>>
>>>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>>>     -Dfile.encoding=UTF-8 -classpath
>>>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>>>     Send Bill's order...
>>>>>     Exception in thread "main" java.lang.NullPointerException
>>>>>         at PostOrder.main(PostOrder.java:36)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>         at
>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>>         at
>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>>>         at
>>>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>>>
>>>>>     Process finished with exit code 1
>>>>>
>>>>> Julien D.
>>>>>
>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>
>>>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>>>
>>>>>>
>>>>>> Justin
>>>>>>
>>>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: "Julien d" <ju...@iki.fi>
>>>>>> To: dev@activemq.apache.org
>>>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>>>> Subject: Re: Embedding REST
>>>>>>
>>>>>> Thank you Justin.
>>>>>> Where do you think it would be best to document embedding REST once I am
>>>>>> more familiar with it?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Julien D.
>>>>>>
>>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>>
>>>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>>>

Re: Embedded REST - monitor queues (without JMS)

Posted by Julien d <ju...@iki.fi>.
Thanks, now it works much better however I do not get what I expected as
output.

ClientSession session = clientSessionFactory.createSession(); session.start(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(); System.out.println(message2.getBodyBuffer().toString()); consumer.close(); session.close();

is my current code I get as output following my request :

    org.apache.activemq.artemis.core.buffers.impl.ResetLimitWrappedActiveMQBuffer@45385f75


And if I do :

System.out.println(message2.getBodyBuffer().readString());

I get this error :

    [Tue May 03 22:40:44 EEST 2016] Servlet for path '/' already defined
    and no default will be used. Exception in thread "main"
    java.lang.OutOfMemoryError: Java heap space     at
    org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readSimpleStringInternal(ChannelBufferWrapper.java:89)
        at
    org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readStringInternal(ChannelBufferWrapper.java:113)
        at
    org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper.readString(ChannelBufferWrapper.java:96)
        at
    org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:44)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)     at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 

I am sending this : <order>    <name>Bill</name>    <item>iPhone
4</item>    <cost>$199.99</cost> </order> through : curl -X POST
-d@test.xml http://localhost:8081/queues/orders/create <order>   
<name>Bill</name>    <item>iPhone 4</item>    <cost>$199.99</cost>
</order> Why would not it display the message content?

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 10:27 PM, Justin Bertram wrote:
>> Did I do anything wrong?
> Yes. :)
>
> First, you aren't protecting against an NPE in the case where consumer.receive(1000) times out and returns null.
>
> Second, you aren't calling start() on your session so there's no possibility of you receiving messages.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, May 3, 2016 2:15:44 PM
> Subject: Re: Embedded REST - monitor queues (without JMS)
>
> Hi again,
>
> Using the consumer method (which is best for my case) I run into a
> NullPointer exception when  accessing my message body :
>
>     [Tue May 03 22:10:25 EEST 2016] Servlet for path '/' already defined
>     and no default will be used.
>     Exception in thread "main" java.lang.NullPointerException
>         at
>     org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:49)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>
> Here is my code:
>
> Restserver.start(); QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1); ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); ClientSession session = clientSessionFactory.createSession(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(1000); System.out.println(message2.getBodyBuffer().toString()); <------- Error happens here consumer.close();
>
>
> Did I do anything wrong?
>
> Regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/03/2016 04:38 PM, Justin Bertram wrote:
>> You can use the new URL methods to make connections simpler, e.g. 
>>
>>   ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0");
>>   ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory();
>>
>> Then once you receive the message you can use org.apache.activemq.artemis.api.core.Message#getBodyBuffer().
>>
>> If you want to see what's in the queue periodically without actually consuming the messages you can use a queue browser or the management interface.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, May 3, 2016 2:50:44 AM
>> Subject: Re: Embedded REST - monitor queues (without JMS)
>>
>> Hello Justin,
>>
>> About my yesterday's questions :
>>
>>
>>     I am posting the following to
>>     http://localhost:8081/queues/orders/create :
>>
>>         <order>
>>            <name>Bill</name>
>>            <item>iPhone 4</item>
>>            <cost>$199.99</cost>
>>         </order>
>>
>>      1.  How can I access, internally in the program, the message that I
>>         receive upon reception?
>>      2.  How can I, still upon reception, send the following message to
>>         all subscribers of "queue2"?
>>
>>     <state>received</state>
>>
>> As I understand about my two previous questions I would need to whether
>> 1 / Be able to handle response -
>> https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
>> referring to here, I get the following issues :
>>
>> ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
>>         new TransportConfiguration(
>>                 InVMConnectorFactory.class.getName()));
>>
>> --> ActiveMQClient.createClientSessionFactory method does not exist in 
>> org.apache.activemq.artemis.api.core.TransportConfiguration
>>
>> message.getBody()
>>
>> -->cannot be resolved
>>
>>>> Was there any change that implied this current issue?
>> 2/ Be able to access the list of the elements in a queue periodically
>> (not the best way I guess) however I cannot find a way to access the
>> core queue management from the REST embedded server
>>
>>
>> Best regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 05/03/2016 12:07 AM, Julien d wrote:
>>> Thank you so much for your help Justin.
>>> I now understand much better.
>>>
>>> As far as queues are concerned, I am now doing it this way in order to
>>> create one :
>>> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
>>> I guess that's quite the right way to do it.
>>> What about if I want to use broker.xml ? Since in the example it was
>>> the JMS way :
>>>
>>> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
>>> <queue name="orders"/> </jms>
>>>
>>> And most important and very likely my last questions :)
>>>
>>> I am posting the following to http://localhost:8081/queues/orders/create :
>>>
>>>     <order>
>>>        <name>Bill</name>
>>>        <item>iPhone 4</item>
>>>        <cost>$199.99</cost>
>>>     </order>
>>>
>>>  1.  How can I access, internally in the program, the message that I
>>>     receive upon reception?
>>>  2.  How can I, still upon reception, send the following message to
>>>     all subscribers of "queue2"?
>>>
>>>         <state>received</state>
>>>
>>> Regards,
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>>>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>>>
>>>>
>>>> Justin
>>>>
>>>> ----- Original Message -----
>>>> From: "Julien d" <ju...@iki.fi>
>>>> To: dev@activemq.apache.org
>>>> Sent: Monday, May 2, 2016 10:02:05 AM
>>>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>
>>>> I do not have one on either side at the moment. Should it be on server
>>>> side? Would you please have any documentation link?
>>>>
>>>> Regards,
>>>>
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>>
>>>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>>>> How is your login.config configured?
>>>>>
>>>>>
>>>>> Justin
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Julien d" <ju...@iki.fi>
>>>>> To: dev@activemq.apache.org
>>>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>>
>>>>> Hi,
>>>>>
>>>>> I get the  following stacktrace on dup-send's side when querying the
>>>>> REST embedded server. I have been checking around and it should work
>>>>> since I have artemis-roles/users.proprieties in my Java path.
>>>>> Following are the stacktraces [1].
>>>>>
>>>>> Anyone having the issue or would know what is actually happening? Justin?
>>>>>
>>>>> Thank you in advance and hope you had a nice May Day.
>>>>>
>>>>> Regards,
>>>>> Julien
>>>>>
>>>>>
>>>>> [1]:
>>>>> Server :
>>>>>
>>>>>     May 02, 2016 12:23:43 PM
>>>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>>>     parseMainConfig
>>>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>>>     back to using pure Java NIO. If your platform is Linux, install
>>>>>     LibAIO to enable the AIO journal
>>>>>     May 02, 2016 12:23:44 PM
>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>>>     Broker Configuration
>>>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>>>     May 02, 2016 12:23:44 PM
>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>>>     <init>
>>>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>>>     protocol support for: CORE
>>>>>     May 02, 2016 12:23:45 PM
>>>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>>>     [CORE]
>>>>>     May 02, 2016 12:23:45 PM
>>>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>>>     INFO: AMQ221007: Server is now live
>>>>>     May 02, 2016 12:23:45 PM
>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>>>     and no default will be used.
>>>>>     May 02, 2016 12:23:51 PM
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>>>     handleCreateSession
>>>>>     ERROR: AMQ224018: Failed to create session
>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>>>         at
>>>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>>>         at
>>>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>         at
>>>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>
>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>         at
>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>>>         at
>>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>>>         at
>>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>>>         at
>>>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>         at
>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>>         at
>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>>>         at
>>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>>>         at
>>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>>>         ... 11 more
>>>>>
>>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>>     message=AMQ119031: Unable to validate user]
>>>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>>>     java.net.Socket
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Client :
>>>>>
>>>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>>>     -Dfile.encoding=UTF-8 -classpath
>>>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>>>     Send Bill's order...
>>>>>     Exception in thread "main" java.lang.NullPointerException
>>>>>         at PostOrder.main(PostOrder.java:36)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>         at
>>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>>         at
>>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>>>         at
>>>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>>>
>>>>>     Process finished with exit code 1
>>>>>
>>>>> Julien D.
>>>>>
>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>
>>>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>>>
>>>>>>
>>>>>> Justin
>>>>>>
>>>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: "Julien d" <ju...@iki.fi>
>>>>>> To: dev@activemq.apache.org
>>>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>>>> Subject: Re: Embedding REST
>>>>>>
>>>>>> Thank you Justin.
>>>>>> Where do you think it would be best to document embedding REST once I am
>>>>>> more familiar with it?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Julien D.
>>>>>>
>>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>>
>>>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>>>

Re: Embedded REST - monitor queues (without JMS)

Posted by Justin Bertram <jb...@apache.com>.
> Did I do anything wrong?

Yes. :)

First, you aren't protecting against an NPE in the case where consumer.receive(1000) times out and returns null.

Second, you aren't calling start() on your session so there's no possibility of you receiving messages.


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Tuesday, May 3, 2016 2:15:44 PM
Subject: Re: Embedded REST - monitor queues (without JMS)

Hi again,

Using the consumer method (which is best for my case) I run into a
NullPointer exception when  accessing my message body :

    [Tue May 03 22:10:25 EEST 2016] Servlet for path '/' already defined
    and no default will be used.
    Exception in thread "main" java.lang.NullPointerException
        at
    org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:49)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)


Here is my code:

Restserver.start(); QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1); ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); ClientSession session = clientSessionFactory.createSession(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(1000); System.out.println(message2.getBodyBuffer().toString()); <------- Error happens here consumer.close();


Did I do anything wrong?

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 04:38 PM, Justin Bertram wrote:
> You can use the new URL methods to make connections simpler, e.g. 
>
>   ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0");
>   ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory();
>
> Then once you receive the message you can use org.apache.activemq.artemis.api.core.Message#getBodyBuffer().
>
> If you want to see what's in the queue periodically without actually consuming the messages you can use a queue browser or the management interface.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, May 3, 2016 2:50:44 AM
> Subject: Re: Embedded REST - monitor queues (without JMS)
>
> Hello Justin,
>
> About my yesterday's questions :
>
>
>     I am posting the following to
>     http://localhost:8081/queues/orders/create :
>
>         <order>
>            <name>Bill</name>
>            <item>iPhone 4</item>
>            <cost>$199.99</cost>
>         </order>
>
>      1.  How can I access, internally in the program, the message that I
>         receive upon reception?
>      2.  How can I, still upon reception, send the following message to
>         all subscribers of "queue2"?
>
>     <state>received</state>
>
> As I understand about my two previous questions I would need to whether
> 1 / Be able to handle response -
> https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
> referring to here, I get the following issues :
>
> ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
>         new TransportConfiguration(
>                 InVMConnectorFactory.class.getName()));
>
> --> ActiveMQClient.createClientSessionFactory method does not exist in 
> org.apache.activemq.artemis.api.core.TransportConfiguration
>
> message.getBody()
>
> -->cannot be resolved
>
>>> Was there any change that implied this current issue?
> 2/ Be able to access the list of the elements in a queue periodically
> (not the best way I guess) however I cannot find a way to access the
> core queue management from the REST embedded server
>
>
> Best regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/03/2016 12:07 AM, Julien d wrote:
>> Thank you so much for your help Justin.
>> I now understand much better.
>>
>> As far as queues are concerned, I am now doing it this way in order to
>> create one :
>> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
>> I guess that's quite the right way to do it.
>> What about if I want to use broker.xml ? Since in the example it was
>> the JMS way :
>>
>> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
>> <queue name="orders"/> </jms>
>>
>> And most important and very likely my last questions :)
>>
>> I am posting the following to http://localhost:8081/queues/orders/create :
>>
>>     <order>
>>        <name>Bill</name>
>>        <item>iPhone 4</item>
>>        <cost>$199.99</cost>
>>     </order>
>>
>>  1.  How can I access, internally in the program, the message that I
>>     receive upon reception?
>>  2.  How can I, still upon reception, send the following message to
>>     all subscribers of "queue2"?
>>
>>         <state>received</state>
>>
>> Regards,
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Monday, May 2, 2016 10:02:05 AM
>>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>
>>> I do not have one on either side at the moment. Should it be on server
>>> side? Would you please have any documentation link?
>>>
>>> Regards,
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>>> How is your login.config configured?
>>>>
>>>>
>>>> Justin
>>>>
>>>> ----- Original Message -----
>>>> From: "Julien d" <ju...@iki.fi>
>>>> To: dev@activemq.apache.org
>>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>
>>>> Hi,
>>>>
>>>> I get the  following stacktrace on dup-send's side when querying the
>>>> REST embedded server. I have been checking around and it should work
>>>> since I have artemis-roles/users.proprieties in my Java path.
>>>> Following are the stacktraces [1].
>>>>
>>>> Anyone having the issue or would know what is actually happening? Justin?
>>>>
>>>> Thank you in advance and hope you had a nice May Day.
>>>>
>>>> Regards,
>>>> Julien
>>>>
>>>>
>>>> [1]:
>>>> Server :
>>>>
>>>>     May 02, 2016 12:23:43 PM
>>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>>     parseMainConfig
>>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>>     back to using pure Java NIO. If your platform is Linux, install
>>>>     LibAIO to enable the AIO journal
>>>>     May 02, 2016 12:23:44 PM
>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>>     Broker Configuration
>>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>>     May 02, 2016 12:23:44 PM
>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>>     <init>
>>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>>     protocol support for: CORE
>>>>     May 02, 2016 12:23:45 PM
>>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>>     [CORE]
>>>>     May 02, 2016 12:23:45 PM
>>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>>     INFO: AMQ221007: Server is now live
>>>>     May 02, 2016 12:23:45 PM
>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>>     and no default will be used.
>>>>     May 02, 2016 12:23:51 PM
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>>     handleCreateSession
>>>>     ERROR: AMQ224018: Failed to create session
>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>         at
>>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>>         at
>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>>         at
>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>>         at
>>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>>         at
>>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>>         at
>>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>         at
>>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>
>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>         at
>>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>>         at
>>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>>         at
>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>>         at
>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>>         at
>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>>         at
>>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at
>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>         at
>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>         at
>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>>         at
>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>>         at
>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>>         ... 11 more
>>>>
>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>>     java.net.Socket
>>>>
>>>>
>>>>
>>>>
>>>> Client :
>>>>
>>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>>     -Dfile.encoding=UTF-8 -classpath
>>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>>     Send Bill's order...
>>>>     Exception in thread "main" java.lang.NullPointerException
>>>>         at PostOrder.main(PostOrder.java:36)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at
>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>         at
>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>>         at
>>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>>
>>>>     Process finished with exit code 1
>>>>
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>>
>>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>>
>>>>>
>>>>> Justin
>>>>>
>>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Julien d" <ju...@iki.fi>
>>>>> To: dev@activemq.apache.org
>>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>>> Subject: Re: Embedding REST
>>>>>
>>>>> Thank you Justin.
>>>>> Where do you think it would be best to document embedding REST once I am
>>>>> more familiar with it?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Julien D.
>>>>>
>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>
>>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>>

Re: Embedded REST - monitor queues (without JMS)

Posted by Julien d <ju...@iki.fi>.
Hi again,

Using the consumer method (which is best for my case) I run into a
NullPointer exception when  accessing my message body :

    [Tue May 03 22:10:25 EEST 2016] Servlet for path '/' already defined
    and no default will be used.
    Exception in thread "main" java.lang.NullPointerException
        at
    org.apache.activemq.artemis.jms.example.EmbeddedRest.main(EmbeddedRest.java:49)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)


Here is my code:

Restserver.start(); QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1); ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); ClientSession session = clientSessionFactory.createSession(); ClientConsumer consumer = session.createConsumer("orders"); ClientMessage message2 = consumer.receive(1000); System.out.println(message2.getBodyBuffer().toString()); <------- Error happens here consumer.close();


Did I do anything wrong?

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 04:38 PM, Justin Bertram wrote:
> You can use the new URL methods to make connections simpler, e.g. 
>
>   ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0");
>   ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory();
>
> Then once you receive the message you can use org.apache.activemq.artemis.api.core.Message#getBodyBuffer().
>
> If you want to see what's in the queue periodically without actually consuming the messages you can use a queue browser or the management interface.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, May 3, 2016 2:50:44 AM
> Subject: Re: Embedded REST - monitor queues (without JMS)
>
> Hello Justin,
>
> About my yesterday's questions :
>
>
>     I am posting the following to
>     http://localhost:8081/queues/orders/create :
>
>         <order>
>            <name>Bill</name>
>            <item>iPhone 4</item>
>            <cost>$199.99</cost>
>         </order>
>
>      1.  How can I access, internally in the program, the message that I
>         receive upon reception?
>      2.  How can I, still upon reception, send the following message to
>         all subscribers of "queue2"?
>
>     <state>received</state>
>
> As I understand about my two previous questions I would need to whether
> 1 / Be able to handle response -
> https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
> referring to here, I get the following issues :
>
> ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
>         new TransportConfiguration(
>                 InVMConnectorFactory.class.getName()));
>
> --> ActiveMQClient.createClientSessionFactory method does not exist in 
> org.apache.activemq.artemis.api.core.TransportConfiguration
>
> message.getBody()
>
> -->cannot be resolved
>
>>> Was there any change that implied this current issue?
> 2/ Be able to access the list of the elements in a queue periodically
> (not the best way I guess) however I cannot find a way to access the
> core queue management from the REST embedded server
>
>
> Best regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/03/2016 12:07 AM, Julien d wrote:
>> Thank you so much for your help Justin.
>> I now understand much better.
>>
>> As far as queues are concerned, I am now doing it this way in order to
>> create one :
>> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
>> I guess that's quite the right way to do it.
>> What about if I want to use broker.xml ? Since in the example it was
>> the JMS way :
>>
>> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
>> <queue name="orders"/> </jms>
>>
>> And most important and very likely my last questions :)
>>
>> I am posting the following to http://localhost:8081/queues/orders/create :
>>
>>     <order>
>>        <name>Bill</name>
>>        <item>iPhone 4</item>
>>        <cost>$199.99</cost>
>>     </order>
>>
>>  1.  How can I access, internally in the program, the message that I
>>     receive upon reception?
>>  2.  How can I, still upon reception, send the following message to
>>     all subscribers of "queue2"?
>>
>>         <state>received</state>
>>
>> Regards,
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Monday, May 2, 2016 10:02:05 AM
>>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>
>>> I do not have one on either side at the moment. Should it be on server
>>> side? Would you please have any documentation link?
>>>
>>> Regards,
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>>> How is your login.config configured?
>>>>
>>>>
>>>> Justin
>>>>
>>>> ----- Original Message -----
>>>> From: "Julien d" <ju...@iki.fi>
>>>> To: dev@activemq.apache.org
>>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>>
>>>> Hi,
>>>>
>>>> I get the  following stacktrace on dup-send's side when querying the
>>>> REST embedded server. I have been checking around and it should work
>>>> since I have artemis-roles/users.proprieties in my Java path.
>>>> Following are the stacktraces [1].
>>>>
>>>> Anyone having the issue or would know what is actually happening? Justin?
>>>>
>>>> Thank you in advance and hope you had a nice May Day.
>>>>
>>>> Regards,
>>>> Julien
>>>>
>>>>
>>>> [1]:
>>>> Server :
>>>>
>>>>     May 02, 2016 12:23:43 PM
>>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>>     parseMainConfig
>>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>>     back to using pure Java NIO. If your platform is Linux, install
>>>>     LibAIO to enable the AIO journal
>>>>     May 02, 2016 12:23:44 PM
>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>>     Broker Configuration
>>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>>     May 02, 2016 12:23:44 PM
>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>>     <init>
>>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>>     protocol support for: CORE
>>>>     May 02, 2016 12:23:45 PM
>>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>>     [CORE]
>>>>     May 02, 2016 12:23:45 PM
>>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>>     INFO: AMQ221007: Server is now live
>>>>     May 02, 2016 12:23:45 PM
>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>>     and no default will be used.
>>>>     May 02, 2016 12:23:51 PM
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>>     handleCreateSession
>>>>     ERROR: AMQ224018: Failed to create session
>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>         at
>>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>>         at
>>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>>         at
>>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>>         at
>>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>>         at
>>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>>         at
>>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>         at
>>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>
>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>         at
>>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>>         at
>>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>>         at
>>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>>         at
>>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>>         at
>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>>         at
>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>>         at
>>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>>         at
>>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at
>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>         at
>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>         at
>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>>         at
>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>>         at
>>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>>         at
>>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>>         ... 11 more
>>>>
>>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>>     org.jboss.resteasy.spi.UnhandledException:
>>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>>     message=AMQ119031: Unable to validate user]
>>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>>     java.net.Socket
>>>>
>>>>
>>>>
>>>>
>>>> Client :
>>>>
>>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>>     -Dfile.encoding=UTF-8 -classpath
>>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>>     Send Bill's order...
>>>>     Exception in thread "main" java.lang.NullPointerException
>>>>         at PostOrder.main(PostOrder.java:36)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at
>>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>         at
>>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>>         at
>>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>>
>>>>     Process finished with exit code 1
>>>>
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>>
>>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>>
>>>>>
>>>>> Justin
>>>>>
>>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Julien d" <ju...@iki.fi>
>>>>> To: dev@activemq.apache.org
>>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>>> Subject: Re: Embedding REST
>>>>>
>>>>> Thank you Justin.
>>>>> Where do you think it would be best to document embedding REST once I am
>>>>> more familiar with it?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Julien D.
>>>>>
>>>>> Alternative email address : julien.d@protonmail.ch
>>>>>
>>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>>


Re: Embedded REST - monitor queues (without JMS)

Posted by Justin Bertram <jb...@apache.com>.
You can use the new URL methods to make connections simpler, e.g. 

  ServerLocator serverLocator = ActiveMQClient.createServerLocator("vm://0");
  ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory();

Then once you receive the message you can use org.apache.activemq.artemis.api.core.Message#getBodyBuffer().

If you want to see what's in the queue periodically without actually consuming the messages you can use a queue browser or the management interface.


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Tuesday, May 3, 2016 2:50:44 AM
Subject: Re: Embedded REST - monitor queues (without JMS)

Hello Justin,

About my yesterday's questions :


    I am posting the following to
    http://localhost:8081/queues/orders/create :

        <order>
           <name>Bill</name>
           <item>iPhone 4</item>
           <cost>$199.99</cost>
        </order>

     1.  How can I access, internally in the program, the message that I
        receive upon reception?
     2.  How can I, still upon reception, send the following message to
        all subscribers of "queue2"?

    <state>received</state>

As I understand about my two previous questions I would need to whether
1 / Be able to handle response -
https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
referring to here, I get the following issues :

ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
        new TransportConfiguration(
                InVMConnectorFactory.class.getName()));

--> ActiveMQClient.createClientSessionFactory method does not exist in 
org.apache.activemq.artemis.api.core.TransportConfiguration

message.getBody()

-->cannot be resolved

>> Was there any change that implied this current issue?

2/ Be able to access the list of the elements in a queue periodically
(not the best way I guess) however I cannot find a way to access the
core queue management from the REST embedded server


Best regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 12:07 AM, Julien d wrote:
> Thank you so much for your help Justin.
> I now understand much better.
>
> As far as queues are concerned, I am now doing it this way in order to
> create one :
> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
> I guess that's quite the right way to do it.
> What about if I want to use broker.xml ? Since in the example it was
> the JMS way :
>
> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
> <queue name="orders"/> </jms>
>
> And most important and very likely my last questions :)
>
> I am posting the following to http://localhost:8081/queues/orders/create :
>
>     <order>
>        <name>Bill</name>
>        <item>iPhone 4</item>
>        <cost>$199.99</cost>
>     </order>
>
>  1.  How can I access, internally in the program, the message that I
>     receive upon reception?
>  2.  How can I, still upon reception, send the following message to
>     all subscribers of "queue2"?
>
>         <state>received</state>
>
> Regards,
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Monday, May 2, 2016 10:02:05 AM
>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>
>> I do not have one on either side at the moment. Should it be on server
>> side? Would you please have any documentation link?
>>
>> Regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>> How is your login.config configured?
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>
>>> Hi,
>>>
>>> I get the  following stacktrace on dup-send's side when querying the
>>> REST embedded server. I have been checking around and it should work
>>> since I have artemis-roles/users.proprieties in my Java path.
>>> Following are the stacktraces [1].
>>>
>>> Anyone having the issue or would know what is actually happening? Justin?
>>>
>>> Thank you in advance and hope you had a nice May Day.
>>>
>>> Regards,
>>> Julien
>>>
>>>
>>> [1]:
>>> Server :
>>>
>>>     May 02, 2016 12:23:43 PM
>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>     parseMainConfig
>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>     back to using pure Java NIO. If your platform is Linux, install
>>>     LibAIO to enable the AIO journal
>>>     May 02, 2016 12:23:44 PM
>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>     Broker Configuration
>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>     May 02, 2016 12:23:44 PM
>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>     <init>
>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>     protocol support for: CORE
>>>     May 02, 2016 12:23:45 PM
>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>     [CORE]
>>>     May 02, 2016 12:23:45 PM
>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>     INFO: AMQ221007: Server is now live
>>>     May 02, 2016 12:23:45 PM
>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>     and no default will be used.
>>>     May 02, 2016 12:23:51 PM
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>     handleCreateSession
>>>     ERROR: AMQ224018: Failed to create session
>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>         at
>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>         at
>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>         at
>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>         at
>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>         at
>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>         at
>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>         at
>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>         at java.lang.Thread.run(Thread.java:745)
>>>
>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>     org.jboss.resteasy.spi.UnhandledException:
>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>         at
>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>         at
>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>         at
>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>         at
>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>         at
>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>         at
>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>         at java.lang.Thread.run(Thread.java:745)
>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>         at
>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>         at
>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>         at
>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>         at
>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at
>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>         at
>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>         at
>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>         at
>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>         at
>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>         ... 11 more
>>>
>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>     org.jboss.resteasy.spi.UnhandledException:
>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>     java.net.Socket
>>>
>>>
>>>
>>>
>>> Client :
>>>
>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>     -Dfile.encoding=UTF-8 -classpath
>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>     Send Bill's order...
>>>     Exception in thread "main" java.lang.NullPointerException
>>>         at PostOrder.main(PostOrder.java:36)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at
>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>         at
>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>         at
>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>
>>>     Process finished with exit code 1
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>
>>>>
>>>> Justin
>>>>
>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>
>>>> ----- Original Message -----
>>>> From: "Julien d" <ju...@iki.fi>
>>>> To: dev@activemq.apache.org
>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>> Subject: Re: Embedding REST
>>>>
>>>> Thank you Justin.
>>>> Where do you think it would be best to document embedding REST once I am
>>>> more familiar with it?
>>>>
>>>> Regards,
>>>>
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>>
>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>
>

Re: Embedded REST - monitor queues (without JMS)

Posted by Justin Bertram <jb...@apache.com>.
Using org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getManager().getQueueManager().deploy(QueueDeployment) is fine.  If you want to use broker.xml just make sure it's on the classpath as previously discussed.

As for receiving and sending messages there are lots of examples of that in the examples shipped with Artemis as well as in the documentation and the test-suite.


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Monday, May 2, 2016 4:07:00 PM
Subject: Embedded REST - monitor queues (without JMS)

Thank you so much for your help Justin.
I now understand much better.

As far as queues are concerned, I am now doing it this way in order to
create one :

QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)

I guess that's quite the right way to do it.
What about if I want to use broker.xml ? Since in the example it was the
JMS way :

<jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
<queue name="orders"/> </jms>


And most important and very likely my last questions :)

I am posting the following to http://localhost:8081/queues/orders/create :

    <order>
       <name>Bill</name>
       <item>iPhone 4</item>
       <cost>$199.99</cost>
    </order>

 1.  How can I access, internally in the program, the message that I
    receive upon reception?
 2.  How can I, still upon reception, send the following message to all
    subscribers of "queue2"?

        <state>received</state>

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/02/2016 06:15 PM, Justin Bertram wrote:
> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Monday, May 2, 2016 10:02:05 AM
> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>
> I do not have one on either side at the moment. Should it be on server
> side? Would you please have any documentation link?
>
> Regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>> How is your login.config configured?
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Monday, May 2, 2016 4:28:27 AM
>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>
>> Hi,
>>
>> I get the  following stacktrace on dup-send's side when querying the
>> REST embedded server. I have been checking around and it should work
>> since I have artemis-roles/users.proprieties in my Java path.
>> Following are the stacktraces [1].
>>
>> Anyone having the issue or would know what is actually happening? Justin?
>>
>> Thank you in advance and hope you had a nice May Day.
>>
>> Regards,
>> Julien
>>
>>
>> [1]:
>> Server :
>>
>>     May 02, 2016 12:23:43 PM
>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>     parseMainConfig
>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>     back to using pure Java NIO. If your platform is Linux, install
>>     LibAIO to enable the AIO journal
>>     May 02, 2016 12:23:44 PM
>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>     Broker Configuration
>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>     May 02, 2016 12:23:44 PM
>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>     <init>
>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>     protocol support for: CORE
>>     May 02, 2016 12:23:45 PM
>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>     [CORE]
>>     May 02, 2016 12:23:45 PM
>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>     INFO: AMQ221007: Server is now live
>>     May 02, 2016 12:23:45 PM
>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>     and no default will be used.
>>     May 02, 2016 12:23:51 PM
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>     handleCreateSession
>>     ERROR: AMQ224018: Failed to create session
>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>         at
>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>         at
>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>         at
>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>         at
>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>         at
>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>         at
>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>         at
>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>         at java.lang.Thread.run(Thread.java:745)
>>
>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>     org.jboss.resteasy.spi.UnhandledException:
>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>         at
>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>         at
>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>         at
>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>         at
>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>         at
>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>         at
>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>         at java.lang.Thread.run(Thread.java:745)
>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>         at
>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>         at
>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>         at
>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>         at
>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>         at
>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>         at
>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>         at
>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>         at
>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>         ... 11 more
>>
>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>     org.jboss.resteasy.spi.UnhandledException:
>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>     java.net.Socket
>>
>>
>>
>>
>> Client :
>>
>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>     -Dfile.encoding=UTF-8 -classpath
>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-client-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>     com.intellij.rt.execution.application.AppMain PostOrder
>>     Send Bill's order...
>>     Exception in thread "main" java.lang.NullPointerException
>>         at PostOrder.main(PostOrder.java:36)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>         at
>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>         at
>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>
>>     Process finished with exit code 1
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>
>>>
>>> Justin
>>>
>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>> Subject: Re: Embedding REST
>>>
>>> Thank you Justin.
>>> Where do you think it would be best to document embedding REST once I am
>>> more familiar with it?
>>>
>>> Regards,
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>

Re: Embedded REST - monitor queues (without JMS)

Posted by Julien d <ju...@iki.fi>.
Hello Justin,

About my yesterday's questions :


    I am posting the following to
    http://localhost:8081/queues/orders/create :

        <order>
           <name>Bill</name>
           <item>iPhone 4</item>
           <cost>$199.99</cost>
        </order>

     1.  How can I access, internally in the program, the message that I
        receive upon reception?
     2.  How can I, still upon reception, send the following message to
        all subscribers of "queue2"?

    <state>received</state>

As I understand about my two previous questions I would need to whether
1 / Be able to handle response -
https://github.com/apache/activemq-artemis/blob/beae4265a24832873b782303385b64fc1b2452b1/docs/user-manual/en/embedding-activemq.md
referring to here, I get the following issues :

ClientSessionFactory nettyFactory =  ActiveMQClient.createClientSessionFactory(
        new TransportConfiguration(
                InVMConnectorFactory.class.getName()));

--> ActiveMQClient.createClientSessionFactory method does not exist in 
org.apache.activemq.artemis.api.core.TransportConfiguration

message.getBody()

-->cannot be resolved

>> Was there any change that implied this current issue?

2/ Be able to access the list of the elements in a queue periodically
(not the best way I guess) however I cannot find a way to access the
core queue management from the REST embedded server


Best regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/03/2016 12:07 AM, Julien d wrote:
> Thank you so much for your help Justin.
> I now understand much better.
>
> As far as queues are concerned, I am now doing it this way in order to
> create one :
> QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)
> I guess that's quite the right way to do it.
> What about if I want to use broker.xml ? Since in the example it was
> the JMS way :
>
> <jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
> <queue name="orders"/> </jms>
>
> And most important and very likely my last questions :)
>
> I am posting the following to http://localhost:8081/queues/orders/create :
>
>     <order>
>        <name>Bill</name>
>        <item>iPhone 4</item>
>        <cost>$199.99</cost>
>     </order>
>
>  1.  How can I access, internally in the program, the message that I
>     receive upon reception?
>  2.  How can I, still upon reception, send the following message to
>     all subscribers of "queue2"?
>
>         <state>received</state>
>
> Regards,
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
> On 05/02/2016 06:15 PM, Justin Bertram wrote:
>> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Monday, May 2, 2016 10:02:05 AM
>> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>
>> I do not have one on either side at the moment. Should it be on server
>> side? Would you please have any documentation link?
>>
>> Regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>>> How is your login.config configured?
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Monday, May 2, 2016 4:28:27 AM
>>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>>
>>> Hi,
>>>
>>> I get the  following stacktrace on dup-send's side when querying the
>>> REST embedded server. I have been checking around and it should work
>>> since I have artemis-roles/users.proprieties in my Java path.
>>> Following are the stacktraces [1].
>>>
>>> Anyone having the issue or would know what is actually happening? Justin?
>>>
>>> Thank you in advance and hope you had a nice May Day.
>>>
>>> Regards,
>>> Julien
>>>
>>>
>>> [1]:
>>> Server :
>>>
>>>     May 02, 2016 12:23:43 PM
>>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>>     parseMainConfig
>>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>>     back to using pure Java NIO. If your platform is Linux, install
>>>     LibAIO to enable the AIO journal
>>>     May 02, 2016 12:23:44 PM
>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>>     Broker Configuration
>>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>>     May 02, 2016 12:23:44 PM
>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>>     <init>
>>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>>     protocol support for: CORE
>>>     May 02, 2016 12:23:45 PM
>>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>>     [CORE]
>>>     May 02, 2016 12:23:45 PM
>>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>>     INFO: AMQ221007: Server is now live
>>>     May 02, 2016 12:23:45 PM
>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>>     and no default will be used.
>>>     May 02, 2016 12:23:51 PM
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>>     handleCreateSession
>>>     ERROR: AMQ224018: Failed to create session
>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>         at
>>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>>         at
>>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>>         at
>>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>>         at
>>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>>         at
>>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>>         at
>>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>         at
>>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>         at java.lang.Thread.run(Thread.java:745)
>>>
>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>>     org.jboss.resteasy.spi.UnhandledException:
>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>         at
>>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>>         at
>>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>>         at
>>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>>         at
>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>>         at
>>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>>         at
>>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>>         at java.lang.Thread.run(Thread.java:745)
>>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>>         at
>>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>>         at
>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>>         at
>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>>         at
>>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>>         at
>>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at
>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>         at
>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>         at
>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>>         at
>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>>         at
>>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>>         at
>>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>>         ... 11 more
>>>
>>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>>     org.jboss.resteasy.spi.UnhandledException:
>>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>>     message=AMQ119031: Unable to validate user]
>>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>>     java.net.Socket
>>>
>>>
>>>
>>>
>>> Client :
>>>
>>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>>     -Dfile.encoding=UTF-8 -classpath
>>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repo
>>> sitory/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-clie
>>> nt-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repositor
>>> y/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_
>>> spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun
>>> /xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>>     com.intellij.rt.execution.application.AppMain PostOrder
>>>     Send Bill's order...
>>>     Exception in thread "main" java.lang.NullPointerException
>>>         at PostOrder.main(PostOrder.java:36)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at
>>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>         at
>>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>         at
>>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>
>>>     Process finished with exit code 1
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>>
>>>>
>>>> Justin
>>>>
>>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>>
>>>> ----- Original Message -----
>>>> From: "Julien d" <ju...@iki.fi>
>>>> To: dev@activemq.apache.org
>>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>>> Subject: Re: Embedding REST
>>>>
>>>> Thank you Justin.
>>>> Where do you think it would be best to document embedding REST once I am
>>>> more familiar with it?
>>>>
>>>> Regards,
>>>>
>>>> Julien D.
>>>>
>>>> Alternative email address : julien.d@protonmail.ch
>>>>
>>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>>
>


Embedded REST - monitor queues (without JMS)

Posted by Julien d <ju...@iki.fi>.
Thank you so much for your help Justin.
I now understand much better.

As far as queues are concerned, I am now doing it this way in order to
create one :

QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1)

I guess that's quite the right way to do it.
What about if I want to use broker.xml ? Since in the example it was the
JMS way :

<jms xmlns="urn:activemq:jms"> <!--the queue used by the example-->
<queue name="orders"/> </jms>


And most important and very likely my last questions :)

I am posting the following to http://localhost:8081/queues/orders/create :

    <order>
       <name>Bill</name>
       <item>iPhone 4</item>
       <cost>$199.99</cost>
    </order>

 1.  How can I access, internally in the program, the message that I
    receive upon reception?
 2.  How can I, still upon reception, send the following message to all
    subscribers of "queue2"?

        <state>received</state>

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/02/2016 06:15 PM, Justin Bertram wrote:
> The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Monday, May 2, 2016 10:02:05 AM
> Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>
> I do not have one on either side at the moment. Should it be on server
> side? Would you please have any documentation link?
>
> Regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 05/02/2016 05:51 PM, Justin Bertram wrote:
>> How is your login.config configured?
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Monday, May 2, 2016 4:28:27 AM
>> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>>
>> Hi,
>>
>> I get the  following stacktrace on dup-send's side when querying the
>> REST embedded server. I have been checking around and it should work
>> since I have artemis-roles/users.proprieties in my Java path.
>> Following are the stacktraces [1].
>>
>> Anyone having the issue or would know what is actually happening? Justin?
>>
>> Thank you in advance and hope you had a nice May Day.
>>
>> Regards,
>> Julien
>>
>>
>> [1]:
>> Server :
>>
>>     May 02, 2016 12:23:43 PM
>>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>>     parseMainConfig
>>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>>     back to using pure Java NIO. If your platform is Linux, install
>>     LibAIO to enable the AIO journal
>>     May 02, 2016 12:23:44 PM
>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>     INFO: AMQ221000: live Message Broker is starting with configuration
>>     Broker Configuration
>>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>>     May 02, 2016 12:23:44 PM
>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>>     <init>
>>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>>     protocol support for: CORE
>>     May 02, 2016 12:23:45 PM
>>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>>     [CORE]
>>     May 02, 2016 12:23:45 PM
>>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>>     INFO: AMQ221007: Server is now live
>>     May 02, 2016 12:23:45 PM
>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>>     and no default will be used.
>>     May 02, 2016 12:23:51 PM
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>>     handleCreateSession
>>     ERROR: AMQ224018: Failed to create session
>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>         at
>>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>>         at
>>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>>         at
>>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>>         at
>>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>>         at
>>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>>         at
>>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>         at
>>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>         at java.lang.Thread.run(Thread.java:745)
>>
>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>>     org.jboss.resteasy.spi.UnhandledException:
>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>         at
>>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>>         at
>>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>>         at
>>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>>         at
>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>>         at
>>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>>         at
>>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>>         at java.lang.Thread.run(Thread.java:745)
>>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>>         at
>>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>>         at
>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>>         at
>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>>         at
>>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>>         at
>>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>         at
>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>         at
>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>>         at
>>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>>         at
>>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>>         at
>>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>>         ... 11 more
>>
>>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>>     org.jboss.resteasy.spi.UnhandledException:
>>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>>     message=AMQ119031: Unable to validate user]
>>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>>     Connection reset in processing a request from /127.0.0.1:8081 /
>>     java.net.Socket
>>
>>
>>
>>
>> Client :
>>
>>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>>     -Dfile.encoding=UTF-8 -classpath
>>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-client-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>>     com.intellij.rt.execution.application.AppMain PostOrder
>>     Send Bill's order...
>>     Exception in thread "main" java.lang.NullPointerException
>>         at PostOrder.main(PostOrder.java:36)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>         at
>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>         at
>>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>
>>     Process finished with exit code 1
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>>> I recommend you put the documentation in the existing chapter on REST [1].
>>>
>>>
>>> Justin
>>>
>>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Friday, April 29, 2016 3:12:22 PM
>>> Subject: Re: Embedding REST
>>>
>>> Thank you Justin.
>>> Where do you think it would be best to document embedding REST once I am
>>> more familiar with it?
>>>
>>> Regards,
>>>
>>> Julien D.
>>>
>>> Alternative email address : julien.d@protonmail.ch
>>>
>>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>>


Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user

Posted by Justin Bertram <jb...@apache.com>.
The login.config is a server-side configuration file for the broker's security manager.  See more at http://activemq.apache.org/artemis/docs/1.2.0/security.html.  You can put a login.config on your classpath or you can configure it programmatically by calling org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) before you start it.  There are lots of examples of programmatic configuration in the test-suite.


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Monday, May 2, 2016 10:02:05 AM
Subject: Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user

I do not have one on either side at the moment. Should it be on server
side? Would you please have any documentation link?

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/02/2016 05:51 PM, Justin Bertram wrote:
> How is your login.config configured?
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Monday, May 2, 2016 4:28:27 AM
> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>
> Hi,
>
> I get the  following stacktrace on dup-send's side when querying the
> REST embedded server. I have been checking around and it should work
> since I have artemis-roles/users.proprieties in my Java path.
> Following are the stacktraces [1].
>
> Anyone having the issue or would know what is actually happening? Justin?
>
> Thank you in advance and hope you had a nice May Day.
>
> Regards,
> Julien
>
>
> [1]:
> Server :
>
>     May 02, 2016 12:23:43 PM
>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>     parseMainConfig
>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>     back to using pure Java NIO. If your platform is Linux, install
>     LibAIO to enable the AIO journal
>     May 02, 2016 12:23:44 PM
>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>     INFO: AMQ221000: live Message Broker is starting with configuration
>     Broker Configuration
>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>     May 02, 2016 12:23:44 PM
>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>     <init>
>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>     protocol support for: CORE
>     May 02, 2016 12:23:45 PM
>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>     [CORE]
>     May 02, 2016 12:23:45 PM
>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>     INFO: AMQ221007: Server is now live
>     May 02, 2016 12:23:45 PM
>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>     and no default will be used.
>     May 02, 2016 12:23:51 PM
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>     handleCreateSession
>     ERROR: AMQ224018: Failed to create session
>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>         at
>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>         at
>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>         at
>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>         at
>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>         at
>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>         at
>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at
>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
>
>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>     org.jboss.resteasy.spi.UnhandledException:
>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>         at
>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>         at
>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>         at
>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>         at
>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>         at
>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>         at
>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>         at java.lang.Thread.run(Thread.java:745)
>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>         at
>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>         at
>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>         at
>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>         at
>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>         at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>         at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>         ... 11 more
>
>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>     org.jboss.resteasy.spi.UnhandledException:
>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>     Connection reset in processing a request from /127.0.0.1:8081 /
>     java.net.Socket
>
>
>
>
> Client :
>
>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>     -Dfile.encoding=UTF-8 -classpath
>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-client-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>     com.intellij.rt.execution.application.AppMain PostOrder
>     Send Bill's order...
>     Exception in thread "main" java.lang.NullPointerException
>         at PostOrder.main(PostOrder.java:36)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>     Process finished with exit code 1
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>> I recommend you put the documentation in the existing chapter on REST [1].
>>
>>
>> Justin
>>
>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Friday, April 29, 2016 3:12:22 PM
>> Subject: Re: Embedding REST
>>
>> Thank you Justin.
>> Where do you think it would be best to document embedding REST once I am
>> more familiar with it?
>>
>> Regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>
>

Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user

Posted by Julien d <ju...@iki.fi>.
I do not have one on either side at the moment. Should it be on server
side? Would you please have any documentation link?

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 05/02/2016 05:51 PM, Justin Bertram wrote:
> How is your login.config configured?
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Monday, May 2, 2016 4:28:27 AM
> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user
>
> Hi,
>
> I get the  following stacktrace on dup-send's side when querying the
> REST embedded server. I have been checking around and it should work
> since I have artemis-roles/users.proprieties in my Java path.
> Following are the stacktraces [1].
>
> Anyone having the issue or would know what is actually happening? Justin?
>
> Thank you in advance and hope you had a nice May Day.
>
> Regards,
> Julien
>
>
> [1]:
> Server :
>
>     May 02, 2016 12:23:43 PM
>     org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
>     parseMainConfig
>     WARN: AMQ222018: AIO was not located on this platform, it will fall
>     back to using pure Java NIO. If your platform is Linux, install
>     LibAIO to enable the AIO journal
>     May 02, 2016 12:23:44 PM
>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>     INFO: AMQ221000: live Message Broker is starting with configuration
>     Broker Configuration
>     (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
>     May 02, 2016 12:23:44 PM
>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
>     <init>
>     INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
>     protocol support for: CORE
>     May 02, 2016 12:23:45 PM
>     org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
>     INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
>     [CORE]
>     May 02, 2016 12:23:45 PM
>     org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
>     INFO: AMQ221007: Server is now live
>     May 02, 2016 12:23:45 PM
>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
>     INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
>     1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
>     [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
>     and no default will be used.
>     May 02, 2016 12:23:51 PM
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
>     handleCreateSession
>     ERROR: AMQ224018: Failed to create session
>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>         at
>     org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
>         at
>     org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
>         at
>     org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
>         at
>     org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
>         at
>     org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
>         at
>     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at
>     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
>
>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
>     org.jboss.resteasy.spi.UnhandledException:
>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>         at
>     org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
>         at
>     org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
>         at
>     org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
>         at
>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
>         at
>     org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
>         at
>     org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>         at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
>         at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
>         at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
>         at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
>         at java.lang.Thread.run(Thread.java:745)
>     Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
>         at
>     org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
>         at
>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
>         at
>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
>         at
>     org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
>         at
>     org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
>         at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
>         at
>     org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
>         at
>     org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
>         ... 11 more
>
>     [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
>     org.jboss.resteasy.spi.UnhandledException:
>     ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
>     message=AMQ119031: Unable to validate user]
>     [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
>     Connection reset in processing a request from /127.0.0.1:8081 /
>     java.net.Socket
>
>
>
>
> Client :
>
>     /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>     -Dfile.encoding=UTF-8 -classpath
>     /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-client-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>     com.intellij.rt.execution.application.AppMain PostOrder
>     Send Bill's order...
>     Exception in thread "main" java.lang.NullPointerException
>         at PostOrder.main(PostOrder.java:36)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>     Process finished with exit code 1
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/29/2016 11:26 PM, Justin Bertram wrote:
>> I recommend you put the documentation in the existing chapter on REST [1].
>>
>>
>> Justin
>>
>> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Friday, April 29, 2016 3:12:22 PM
>> Subject: Re: Embedding REST
>>
>> Thank you Justin.
>> Where do you think it would be best to document embedding REST once I am
>> more familiar with it?
>>
>> Regards,
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>>
>


Re: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user

Posted by Justin Bertram <jb...@apache.com>.
How is your login.config configured?


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Monday, May 2, 2016 4:28:27 AM
Subject: Embedded REST queried from the dupsend/PostOrder example - Unable to validate user

Hi,

I get the  following stacktrace on dup-send's side when querying the
REST embedded server. I have been checking around and it should work
since I have artemis-roles/users.proprieties in my Java path.
Following are the stacktraces [1].

Anyone having the issue or would know what is actually happening? Justin?

Thank you in advance and hope you had a nice May Day.

Regards,
Julien


[1]:
Server :

    May 02, 2016 12:23:43 PM
    org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
    parseMainConfig
    WARN: AMQ222018: AIO was not located on this platform, it will fall
    back to using pure Java NIO. If your platform is Linux, install
    LibAIO to enable the AIO journal
    May 02, 2016 12:23:44 PM
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
    INFO: AMQ221000: live Message Broker is starting with configuration
    Broker Configuration
    (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
    May 02, 2016 12:23:44 PM
    org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
    <init>
    INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
    protocol support for: CORE
    May 02, 2016 12:23:45 PM
    org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
    INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
    [CORE]
    May 02, 2016 12:23:45 PM
    org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
    INFO: AMQ221007: Server is now live
    May 02, 2016 12:23:45 PM
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
    INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
    1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
    [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
    and no default will be used.
    May 02, 2016 12:23:51 PM
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
    handleCreateSession
    ERROR: AMQ224018: Failed to create session
    ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
        at
    org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
        at
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
        at
    org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
        at
    org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
        at
    org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
        at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

    [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
    org.jboss.resteasy.spi.UnhandledException:
    ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
        at
    org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
        at
    org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
        at
    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
        at
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        at
    org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
        at
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
        at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
        at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
        at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
        at
    org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
        at
    org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
        at
    org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
        at
    org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
    org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
        at
    org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
        at
    org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
        ... 11 more

    [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
    org.jboss.resteasy.spi.UnhandledException:
    ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
    [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
    Connection reset in processing a request from /127.0.0.1:8081 /
    java.net.Socket




Client :

    /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
    -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
    -Dfile.encoding=UTF-8 -classpath
    /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-client-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
    com.intellij.rt.execution.application.AppMain PostOrder
    Send Bill's order...
    Exception in thread "main" java.lang.NullPointerException
        at PostOrder.main(PostOrder.java:36)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

    Process finished with exit code 1

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/29/2016 11:26 PM, Justin Bertram wrote:
> I recommend you put the documentation in the existing chapter on REST [1].
>
>
> Justin
>
> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Friday, April 29, 2016 3:12:22 PM
> Subject: Re: Embedding REST
>
> Thank you Justin.
> Where do you think it would be best to document embedding REST once I am
> more familiar with it?
>
> Regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>


Embedded REST queried from the dupsend/PostOrder example - Unable to validate user

Posted by Julien d <ju...@iki.fi>.
Hi,

I get the  following stacktrace on dup-send's side when querying the
REST embedded server. I have been checking around and it should work
since I have artemis-roles/users.proprieties in my Java path.
Following are the stacktraces [1].

Anyone having the issue or would know what is actually happening? Justin?

Thank you in advance and hope you had a nice May Day.

Regards,
Julien


[1]:
Server :

    May 02, 2016 12:23:43 PM
    org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser
    parseMainConfig
    WARN: AMQ222018: AIO was not located on this platform, it will fall
    back to using pure Java NIO. If your platform is Linux, install
    LibAIO to enable the AIO journal
    May 02, 2016 12:23:44 PM
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
    INFO: AMQ221000: live Message Broker is starting with configuration
    Broker Configuration
    (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
    May 02, 2016 12:23:44 PM
    org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
    <init>
    INFO: AMQ221043: Protocol module found: [artemis-server]. Adding
    protocol support for: CORE
    May 02, 2016 12:23:45 PM
    org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start
    INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols
    [CORE]
    May 02, 2016 12:23:45 PM
    org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run
    INFO: AMQ221007: Server is now live
    May 02, 2016 12:23:45 PM
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start
    INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version
    1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89]
    [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined
    and no default will be used.
    May 02, 2016 12:23:51 PM
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler
    handleCreateSession
    ERROR: AMQ224018: Failed to create session
    ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
        at
    org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145)
        at
    org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350)
        at
    org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606)
        at
    org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189)
        at
    org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
        at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

    [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet
    org.jboss.resteasy.spi.UnhandledException:
    ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
        at
    org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
        at
    org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
        at
    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
        at
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        at
    org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
        at
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
        at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
        at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
        at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291)
        at
    org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239)
        at
    org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309)
        at
    org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674)
        at
    org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337)
        at
    org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
    org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)
        at
    org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)
        at
    org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
        at
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
        ... 11 more

    [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet:
    org.jboss.resteasy.spi.UnhandledException:
    ActiveMQSecurityException[errorType=SECURITY_EXCEPTION
    message=AMQ119031: Unable to validate user]
    [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException:
    Connection reset in processing a request from /127.0.0.1:8081 /
    java.net.Socket




Client :

    /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536
    -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
    -Dfile.encoding=UTF-8 -classpath
    /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-client-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
    com.intellij.rt.execution.application.AppMain PostOrder
    Send Bill's order...
    Exception in thread "main" java.lang.NullPointerException
        at PostOrder.main(PostOrder.java:36)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

    Process finished with exit code 1

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/29/2016 11:26 PM, Justin Bertram wrote:
> I recommend you put the documentation in the existing chapter on REST [1].
>
>
> Justin
>
> [1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Friday, April 29, 2016 3:12:22 PM
> Subject: Re: Embedding REST
>
> Thank you Justin.
> Where do you think it would be best to document embedding REST once I am
> more familiar with it?
>
> Regards,
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/29/2016 05:59 PM, Justin Bertram wrote:
>>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>>


Re: Embedding REST

Posted by Justin Bertram <jb...@apache.com>.
I recommend you put the documentation in the existing chapter on REST [1].


Justin

[1] https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Friday, April 29, 2016 3:12:22 PM
Subject: Re: Embedding REST

Thank you Justin.
Where do you think it would be best to document embedding REST once I am
more familiar with it?

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/29/2016 05:59 PM, Justin Bertram wrote:
>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>

Re: Embedding REST

Posted by Julien d <ju...@iki.fi>.
Thank you Justin.
Where do you think it would be best to document embedding REST once I am
more familiar with it?

Regards,

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/29/2016 05:59 PM, Justin Bertram wrote:
>   You need to connect to the embedded HTTP server which, by default, listens on 8081.
>


Re: Embedding REST

Posted by Justin Bertram <jb...@apache.com>.
You're attempting to connect to the port 61616 which is not for REST clients.  You need to connect to the embedded HTTP server which, by default, listens on 8081.


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Friday, April 29, 2016 3:19:38 AM
Subject: Embedding REST

Hello,

After trying Justin's example [1]. I cannot get any reply from the
embedded REST server.
curl -I http://localhost:61616/queues/jms.queue.orders -> the command
hangs. And same goes with the REST example then.

What could be wrong with the embedded server?

Thank you for your patience, I am quite new to ActiveMQ in general and
this part is not yet documented to my knowledge. I am currently working
on my master thesis in order to have a proof-of-concept of a context
aware pub/sub.

Regards,

Julien

[1] https://github.com/jbertram/activemq-artemis/commit/875b8764aabb13794578c8c436b4cdc527502d59

 

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 09:29 PM, Justin Bertram wrote:
> I'm not exactly sure why you're getting that exception.  I just created a simple, Mavenized example demonstrating how to create an embedded REST server here [1].  Try that out.
>
>
> Justin
>
> [1] https://github.com/jbertram/activemq-artemis/commit/875b8764aabb13794578c8c436b4cdc527502d59
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 12:50:17 PM
> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Here it is :
>
>     /usr/lib/jvm/java-8-openjdk/bin/java -Didea.launcher.port=7533
>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>     -Dfile.encoding=UTF-8 -classpath
>     /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/johnny/IdeaProjects/activemq-artemis-master/artemis-rest/target/classes:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.16.Final/resteasy-jaxrs-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.16.Final/resteasy-jaxb-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.16.Final/resteasy-jackson-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.16.Final/resteasy-atom-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.16.Final/tjws-3.0.16.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.3.0-SNAPSHOT/artemis-server-1.3.0-20160426.031638-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.3.0-SNAPSHOT/artemis-commons-1.3.0-20160426.030416-44.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.3.0-SNAPSHOT/artemis-selector-1.3.0-20160426.030831-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.3.0-SNAPSHOT/artemis-journal-1.3.0-20160426.031147-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.3.0-SNAPSHOT/artemis-native-1.3.0-20160426.031126-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jdbc-store/1.3.0-SNAPSHOT/artemis-jdbc-store-1.3.0-20160426.031157-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.3.0-SNAPSHOT/artemis-core-client-1.3.0-20160426.030751-43.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.8.Final/jgroups-3.6.8.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.3.0-SNAPSHOT/artemis-jms-server-1.3.0-20160426.032135-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.3.0-SNAPSHOT/artemis-jms-client-1.3.0-20160426.031055-43.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.3.0-SNAPSHOT/artemis-service-extensions-1.3.0-20160426.031945-43.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>     com.intellij.rt.execution.application.AppMain fi.julien.artemisrest.Main
>     [Fatal Error] :2:6: The processing instruction target matching
>     "[xX][mM][lL]" is not allowed.
>     Exception in thread "main" org.xml.sax.SAXParseException;
>     lineNumber: 2; columnNumber: 6; The processing instruction target
>     matching "[xX][mM][lL]" is not allowed.
>         at
>     com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>         at
>     com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.readerToElement(XMLUtil.java:86)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.stringToElement(XMLUtil.java:52)
>         at
>     org.apache.activemq.artemis.core.config.FileDeploymentManager.readConfiguration(FileDeploymentManager.java:76)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.initStart(EmbeddedActiveMQ.java:127)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.start(EmbeddedActiveMQ.java:115)
>         at
>     org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ.start(EmbeddedRestActiveMQ.java:59)
>         at fi.julien.artemisrest.Main.main(Main.java:37)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>     Process finished with exit code 1
>
> I am using Github's master branch from last week Wednesday, 1.3.0-SNAPSHOT
> Thanks
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/26/2016 08:01 PM, Justin Bertram wrote:
>> Can you provide the full stack-trace?
>>
>> Also, what version of Artemis are you using?
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, April 26, 2016 11:34:20 AM
>> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>
>> Thank you for your answer Justin.
>> When using the following one :
>>
>> <?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
>> (ASF) under one or more contributor license agreements. See the NOTICE
>> file distributed with this work for additional information regarding
>> copyright ownership. The ASF licenses this file to you under the Apache
>> License, Version 2.0 (the "License"); you may not use this file except
>> in compliance with the License. You may obtain a copy of the License at
>> http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
>> law or agreed to in writing, software distributed under the License is
>> distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> KIND, either express or implied. See the License for the specific
>> language governing permissions and limitations under the License. -->
>> <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
>> /schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
>> queue used by the example--> <queue name="orders"/> </jms> <core
>> xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
>> name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
>> <!--security for example queue--> <security-setting match="#">
>> <permission type="createDurableQueue" roles="guest"/> <permission
>> type="deleteDurableQueue" roles="guest"/> <permission
>> type="createNonDurableQueue" roles="guest"/> <permission
>> type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
>> roles="guest"/> <permission type="send" roles="guest"/>
>> </security-setting> </security-settings> </core> </configuration>
>>
>>
>> I get the following error :
>>
>> [Fatal Error] :2:6: The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>> Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
>> columnNumber: 6; The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>>     at
>> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>>
>> Would you know why?
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/26/2016 07:13 PM, Justin Bertram wrote:
>>> You should be able to put the broker.xml anywhere on the application's classpath.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Tuesday, April 26, 2016 11:00:48 AM
>>> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>>
>>> Hi everyone,
>>>
>>> Sorry for bothering, I am having some troubles working with Artemis,
>>> more particularly
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
>>> would like to know if someone here could give me a hand please. I did
>>> not find this part documented, I could document it after understanding
>>> it better.
>>>
>>> Where should I put the broker.xml ?
>>> I have started a project where I have
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
>>> org.myproject packages in the same directory.
>>>
>>> At the moment my program is as simple as that since it is my first time
>>> working with Artemis :
>>>
>>> public static void main(String[] args) throws Exception{
>>>
>>>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>>>
>>> Thank you very much in advance,
>>>


Embedding REST

Posted by Julien d <ju...@iki.fi>.
Hello,

After trying Justin's example [1]. I cannot get any reply from the
embedded REST server.
curl -I http://localhost:61616/queues/jms.queue.orders -> the command
hangs. And same goes with the REST example then.

What could be wrong with the embedded server?

Thank you for your patience, I am quite new to ActiveMQ in general and
this part is not yet documented to my knowledge. I am currently working
on my master thesis in order to have a proof-of-concept of a context
aware pub/sub.

Regards,

Julien

[1] https://github.com/jbertram/activemq-artemis/commit/875b8764aabb13794578c8c436b4cdc527502d59

 

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 09:29 PM, Justin Bertram wrote:
> I'm not exactly sure why you're getting that exception.  I just created a simple, Mavenized example demonstrating how to create an embedded REST server here [1].  Try that out.
>
>
> Justin
>
> [1] https://github.com/jbertram/activemq-artemis/commit/875b8764aabb13794578c8c436b4cdc527502d59
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 12:50:17 PM
> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Here it is :
>
>     /usr/lib/jvm/java-8-openjdk/bin/java -Didea.launcher.port=7533
>     -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
>     -Dfile.encoding=UTF-8 -classpath
>     /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/johnny/IdeaProjects/activemq-artemis-master/artemis-rest/target/classes:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.16.Final/resteasy-jaxrs-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.16.Final/resteasy-jaxb-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.16.Final/resteasy-jackson-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.16.Final/resteasy-atom-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.16.Final/tjws-3.0.16.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.3.0-SNAPSHOT/artemis-server-1.3.0-20160426.031638-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.3.0-SNAPSHOT/artemis-commons-1.3.0-20160426.030416-44.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.3.0-SNAPSHOT/artemis-selector-1.3.0-20160426.030831-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.3.0-SNAPSHOT/artemis-journal-1.3.0-20160426.031147-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.3.0-SNAPSHOT/artemis-native-1.3.0-20160426.031126-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jdbc-store/1.3.0-SNAPSHOT/artemis-jdbc-store-1.3.0-20160426.031157-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.3.0-SNAPSHOT/artemis-core-client-1.3.0-20160426.030751-43.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.8.Final/jgroups-3.6.8.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.3.0-SNAPSHOT/artemis-jms-server-1.3.0-20160426.032135-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.3.0-SNAPSHOT/artemis-jms-client-1.3.0-20160426.031055-43.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.3.0-SNAPSHOT/artemis-service-extensions-1.3.0-20160426.031945-43.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
>     com.intellij.rt.execution.application.AppMain fi.julien.artemisrest.Main
>     [Fatal Error] :2:6: The processing instruction target matching
>     "[xX][mM][lL]" is not allowed.
>     Exception in thread "main" org.xml.sax.SAXParseException;
>     lineNumber: 2; columnNumber: 6; The processing instruction target
>     matching "[xX][mM][lL]" is not allowed.
>         at
>     com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>         at
>     com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.readerToElement(XMLUtil.java:86)
>         at
>     org.apache.activemq.artemis.utils.XMLUtil.stringToElement(XMLUtil.java:52)
>         at
>     org.apache.activemq.artemis.core.config.FileDeploymentManager.readConfiguration(FileDeploymentManager.java:76)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.initStart(EmbeddedActiveMQ.java:127)
>         at
>     org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.start(EmbeddedActiveMQ.java:115)
>         at
>     org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ.start(EmbeddedRestActiveMQ.java:59)
>         at fi.julien.artemisrest.Main.main(Main.java:37)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>     sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
>     com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>
>     Process finished with exit code 1
>
> I am using Github's master branch from last week Wednesday, 1.3.0-SNAPSHOT
> Thanks
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/26/2016 08:01 PM, Justin Bertram wrote:
>> Can you provide the full stack-trace?
>>
>> Also, what version of Artemis are you using?
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, April 26, 2016 11:34:20 AM
>> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>
>> Thank you for your answer Justin.
>> When using the following one :
>>
>> <?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
>> (ASF) under one or more contributor license agreements. See the NOTICE
>> file distributed with this work for additional information regarding
>> copyright ownership. The ASF licenses this file to you under the Apache
>> License, Version 2.0 (the "License"); you may not use this file except
>> in compliance with the License. You may obtain a copy of the License at
>> http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
>> law or agreed to in writing, software distributed under the License is
>> distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> KIND, either express or implied. See the License for the specific
>> language governing permissions and limitations under the License. -->
>> <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
>> /schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
>> queue used by the example--> <queue name="orders"/> </jms> <core
>> xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
>> name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
>> <!--security for example queue--> <security-setting match="#">
>> <permission type="createDurableQueue" roles="guest"/> <permission
>> type="deleteDurableQueue" roles="guest"/> <permission
>> type="createNonDurableQueue" roles="guest"/> <permission
>> type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
>> roles="guest"/> <permission type="send" roles="guest"/>
>> </security-setting> </security-settings> </core> </configuration>
>>
>>
>> I get the following error :
>>
>> [Fatal Error] :2:6: The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>> Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
>> columnNumber: 6; The processing instruction target matching
>> "[xX][mM][lL]" is not allowed.
>>     at
>> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>>
>> Would you know why?
>>
>> Julien D.
>>
>> Alternative email address : julien.d@protonmail.ch
>>
>> On 04/26/2016 07:13 PM, Justin Bertram wrote:
>>> You should be able to put the broker.xml anywhere on the application's classpath.
>>>
>>>
>>> Justin
>>>
>>> ----- Original Message -----
>>> From: "Julien d" <ju...@iki.fi>
>>> To: dev@activemq.apache.org
>>> Sent: Tuesday, April 26, 2016 11:00:48 AM
>>> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>>
>>> Hi everyone,
>>>
>>> Sorry for bothering, I am having some troubles working with Artemis,
>>> more particularly
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
>>> would like to know if someone here could give me a hand please. I did
>>> not find this part documented, I could document it after understanding
>>> it better.
>>>
>>> Where should I put the broker.xml ?
>>> I have started a project where I have
>>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
>>> org.myproject packages in the same directory.
>>>
>>> At the moment my program is as simple as that since it is my first time
>>> working with Artemis :
>>>
>>> public static void main(String[] args) throws Exception{
>>>
>>>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>>>
>>> Thank you very much in advance,
>>>


Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Posted by Justin Bertram <jb...@apache.com>.
I'm not exactly sure why you're getting that exception.  I just created a simple, Mavenized example demonstrating how to create an embedded REST server here [1].  Try that out.


Justin

[1] https://github.com/jbertram/activemq-artemis/commit/875b8764aabb13794578c8c436b4cdc527502d59

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Tuesday, April 26, 2016 12:50:17 PM
Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Here it is :

    /usr/lib/jvm/java-8-openjdk/bin/java -Didea.launcher.port=7533
    -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
    -Dfile.encoding=UTF-8 -classpath
    /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/johnny/IdeaProjects/activemq-artemis-master/artemis-rest/target/classes:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.16.Final/resteasy-jaxrs-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.16.Final/resteasy-jaxb-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.16.Final/resteasy-jackson-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.16.Final/resteasy-atom-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.16.Final/tjws-3.0.16.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.3.0-SNAPSHOT/artemis-server-1.3.0-20160426.031638-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.3.0-SNAPSHOT/artemis-commons-1.3.0-20160426.030416-44.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.3.0-SNAPSHOT/artemis-selector-1.3.0-20160426.030831-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.3.0-SNAPSHOT/artemis-journal-1.3.0-20160426.031147-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.3.0-SNAPSHOT/artemis-native-1.3.0-20160426.031126-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jdbc-store/1.3.0-SNAPSHOT/artemis-jdbc-store-1.3.0-20160426.031157-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.3.0-SNAPSHOT/artemis-core-client-1.3.0-20160426.030751-43.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.8.Final/jgroups-3.6.8.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.3.0-SNAPSHOT/artemis-jms-server-1.3.0-20160426.032135-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.3.0-SNAPSHOT/artemis-jms-client-1.3.0-20160426.031055-43.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.3.0-SNAPSHOT/artemis-service-extensions-1.3.0-20160426.031945-43.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
    com.intellij.rt.execution.application.AppMain fi.julien.artemisrest.Main
    [Fatal Error] :2:6: The processing instruction target matching
    "[xX][mM][lL]" is not allowed.
    Exception in thread "main" org.xml.sax.SAXParseException;
    lineNumber: 2; columnNumber: 6; The processing instruction target
    matching "[xX][mM][lL]" is not allowed.
        at
    com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
        at
    com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
        at
    org.apache.activemq.artemis.utils.XMLUtil.readerToElement(XMLUtil.java:86)
        at
    org.apache.activemq.artemis.utils.XMLUtil.stringToElement(XMLUtil.java:52)
        at
    org.apache.activemq.artemis.core.config.FileDeploymentManager.readConfiguration(FileDeploymentManager.java:76)
        at
    org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.initStart(EmbeddedActiveMQ.java:127)
        at
    org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.start(EmbeddedActiveMQ.java:115)
        at
    org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ.start(EmbeddedRestActiveMQ.java:59)
        at fi.julien.artemisrest.Main.main(Main.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

    Process finished with exit code 1

I am using Github's master branch from last week Wednesday, 1.3.0-SNAPSHOT
Thanks

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 08:01 PM, Justin Bertram wrote:
> Can you provide the full stack-trace?
>
> Also, what version of Artemis are you using?
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 11:34:20 AM
> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Thank you for your answer Justin.
> When using the following one :
>
> <?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
> (ASF) under one or more contributor license agreements. See the NOTICE
> file distributed with this work for additional information regarding
> copyright ownership. The ASF licenses this file to you under the Apache
> License, Version 2.0 (the "License"); you may not use this file except
> in compliance with the License. You may obtain a copy of the License at
> http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
> law or agreed to in writing, software distributed under the License is
> distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> KIND, either express or implied. See the License for the specific
> language governing permissions and limitations under the License. -->
> <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
> /schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
> queue used by the example--> <queue name="orders"/> </jms> <core
> xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
> name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
> <!--security for example queue--> <security-setting match="#">
> <permission type="createDurableQueue" roles="guest"/> <permission
> type="deleteDurableQueue" roles="guest"/> <permission
> type="createNonDurableQueue" roles="guest"/> <permission
> type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
> roles="guest"/> <permission type="send" roles="guest"/>
> </security-setting> </security-settings> </core> </configuration>
>
>
> I get the following error :
>
> [Fatal Error] :2:6: The processing instruction target matching
> "[xX][mM][lL]" is not allowed.
> Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
> columnNumber: 6; The processing instruction target matching
> "[xX][mM][lL]" is not allowed.
>     at
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>
> Would you know why?
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/26/2016 07:13 PM, Justin Bertram wrote:
>> You should be able to put the broker.xml anywhere on the application's classpath.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, April 26, 2016 11:00:48 AM
>> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>
>> Hi everyone,
>>
>> Sorry for bothering, I am having some troubles working with Artemis,
>> more particularly
>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
>> would like to know if someone here could give me a hand please. I did
>> not find this part documented, I could document it after understanding
>> it better.
>>
>> Where should I put the broker.xml ?
>> I have started a project where I have
>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
>> org.myproject packages in the same directory.
>>
>> At the moment my program is as simple as that since it is my first time
>> working with Artemis :
>>
>> public static void main(String[] args) throws Exception{
>>
>>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>>
>> Thank you very much in advance,
>>
>

Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Posted by Julien d <ju...@iki.fi>.
Here it is :

    /usr/lib/jvm/java-8-openjdk/bin/java -Didea.launcher.port=7533
    -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin
    -Dfile.encoding=UTF-8 -classpath
    /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/johnny/IdeaProjects/activemq-artemis-master/artemis-rest/target/classes:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.16.Final/resteasy-jaxrs-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.16.Final/resteasy-jaxb-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.16.Final/resteasy-jackson-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.16.Final/resteasy-atom-provider-3.0.16.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.16.Final/tjws-3.0.16.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.3.0-SNAPSHOT/artemis-server-1.3.0-20160426.031638-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.3.0-SNAPSHOT/artemis-commons-1.3.0-20160426.030416-44.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.3.0-SNAPSHOT/artemis-selector-1.3.0-20160426.030831-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.3.0-SNAPSHOT/artemis-journal-1.3.0-20160426.031147-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.3.0-SNAPSHOT/artemis-native-1.3.0-20160426.031126-44.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jdbc-store/1.3.0-SNAPSHOT/artemis-jdbc-store-1.3.0-20160426.031157-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.3.0-SNAPSHOT/artemis-core-client-1.3.0-20160426.030751-43.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.8.Final/jgroups-3.6.8.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.3.0-SNAPSHOT/artemis-jms-server-1.3.0-20160426.032135-43.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.3.0-SNAPSHOT/artemis-jms-client-1.3.0-20160426.031055-43.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.3.0-SNAPSHOT/artemis-service-extensions-1.3.0-20160426.031945-43.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar
    com.intellij.rt.execution.application.AppMain fi.julien.artemisrest.Main
    [Fatal Error] :2:6: The processing instruction target matching
    "[xX][mM][lL]" is not allowed.
    Exception in thread "main" org.xml.sax.SAXParseException;
    lineNumber: 2; columnNumber: 6; The processing instruction target
    matching "[xX][mM][lL]" is not allowed.
        at
    com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
        at
    com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
        at
    org.apache.activemq.artemis.utils.XMLUtil.readerToElement(XMLUtil.java:86)
        at
    org.apache.activemq.artemis.utils.XMLUtil.stringToElement(XMLUtil.java:52)
        at
    org.apache.activemq.artemis.core.config.FileDeploymentManager.readConfiguration(FileDeploymentManager.java:76)
        at
    org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.initStart(EmbeddedActiveMQ.java:127)
        at
    org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ.start(EmbeddedActiveMQ.java:115)
        at
    org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ.start(EmbeddedRestActiveMQ.java:59)
        at fi.julien.artemisrest.Main.main(Main.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invokeDelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

    Process finished with exit code 1

I am using Github's master branch from last week Wednesday, 1.3.0-SNAPSHOT
Thanks

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 08:01 PM, Justin Bertram wrote:
> Can you provide the full stack-trace?
>
> Also, what version of Artemis are you using?
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 11:34:20 AM
> Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Thank you for your answer Justin.
> When using the following one :
>
> <?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
> (ASF) under one or more contributor license agreements. See the NOTICE
> file distributed with this work for additional information regarding
> copyright ownership. The ASF licenses this file to you under the Apache
> License, Version 2.0 (the "License"); you may not use this file except
> in compliance with the License. You may obtain a copy of the License at
> http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
> law or agreed to in writing, software distributed under the License is
> distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> KIND, either express or implied. See the License for the specific
> language governing permissions and limitations under the License. -->
> <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
> /schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
> queue used by the example--> <queue name="orders"/> </jms> <core
> xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
> name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
> <!--security for example queue--> <security-setting match="#">
> <permission type="createDurableQueue" roles="guest"/> <permission
> type="deleteDurableQueue" roles="guest"/> <permission
> type="createNonDurableQueue" roles="guest"/> <permission
> type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
> roles="guest"/> <permission type="send" roles="guest"/>
> </security-setting> </security-settings> </core> </configuration>
>
>
> I get the following error :
>
> [Fatal Error] :2:6: The processing instruction target matching
> "[xX][mM][lL]" is not allowed.
> Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
> columnNumber: 6; The processing instruction target matching
> "[xX][mM][lL]" is not allowed.
>     at
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
>
> Would you know why?
>
> Julien D.
>
> Alternative email address : julien.d@protonmail.ch
>
> On 04/26/2016 07:13 PM, Justin Bertram wrote:
>> You should be able to put the broker.xml anywhere on the application's classpath.
>>
>>
>> Justin
>>
>> ----- Original Message -----
>> From: "Julien d" <ju...@iki.fi>
>> To: dev@activemq.apache.org
>> Sent: Tuesday, April 26, 2016 11:00:48 AM
>> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>>
>> Hi everyone,
>>
>> Sorry for bothering, I am having some troubles working with Artemis,
>> more particularly
>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
>> would like to know if someone here could give me a hand please. I did
>> not find this part documented, I could document it after understanding
>> it better.
>>
>> Where should I put the broker.xml ?
>> I have started a project where I have
>> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
>> org.myproject packages in the same directory.
>>
>> At the moment my program is as simple as that since it is my first time
>> working with Artemis :
>>
>> public static void main(String[] args) throws Exception{
>>
>>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>>
>> Thank you very much in advance,
>>
>


Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Posted by Justin Bertram <jb...@apache.com>.
Can you provide the full stack-trace?

Also, what version of Artemis are you using?


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Tuesday, April 26, 2016 11:34:20 AM
Subject: Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Thank you for your answer Justin.
When using the following one :

<?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
(ASF) under one or more contributor license agreements. See the NOTICE
file distributed with this work for additional information regarding
copyright ownership. The ASF licenses this file to you under the Apache
License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
law or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
/schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
queue used by the example--> <queue name="orders"/> </jms> <core
xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
<!--security for example queue--> <security-setting match="#">
<permission type="createDurableQueue" roles="guest"/> <permission
type="deleteDurableQueue" roles="guest"/> <permission
type="createNonDurableQueue" roles="guest"/> <permission
type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
roles="guest"/> <permission type="send" roles="guest"/>
</security-setting> </security-settings> </core> </configuration>


I get the following error :

[Fatal Error] :2:6: The processing instruction target matching
"[xX][mM][lL]" is not allowed.
Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
columnNumber: 6; The processing instruction target matching
"[xX][mM][lL]" is not allowed.
    at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)

Would you know why?

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 07:13 PM, Justin Bertram wrote:
> You should be able to put the broker.xml anywhere on the application's classpath.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 11:00:48 AM
> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Hi everyone,
>
> Sorry for bothering, I am having some troubles working with Artemis,
> more particularly
> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
> would like to know if someone here could give me a hand please. I did
> not find this part documented, I could document it after understanding
> it better.
>
> Where should I put the broker.xml ?
> I have started a project where I have
> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
> org.myproject packages in the same directory.
>
> At the moment my program is as simple as that since it is my first time
> working with Artemis :
>
> public static void main(String[] args) throws Exception{
>
>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>
> Thank you very much in advance,
>


Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Posted by Julien d <ju...@iki.fi>.
Thank you for your answer Justin.
When using the following one :

<?xml version='1.0'?> <!-- Licensed to the Apache Software Foundation
(ASF) under one or more contributor license agreements. See the NOTICE
file distributed with this work for additional information regarding
copyright ownership. The ASF licenses this file to you under the Apache
License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
law or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:activemq" xsi:schemaLocation="urn:activemq
/schema/artemis-server.xsd"> <jms xmlns="urn:activemq:jms"> <!--the
queue used by the example--> <queue name="orders"/> </jms> <core
xmlns="urn:activemq:core"> <persistence-enabled>false</persistence-enabled> <!-- Connectors --> <connectors> <connector
name="in-vm">vm://0</connector> </connectors> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> </acceptors> <!-- Other config --> <security-settings>
<!--security for example queue--> <security-setting match="#">
<permission type="createDurableQueue" roles="guest"/> <permission
type="deleteDurableQueue" roles="guest"/> <permission
type="createNonDurableQueue" roles="guest"/> <permission
type="deleteNonDurableQueue" roles="guest"/> <permission type="consume"
roles="guest"/> <permission type="send" roles="guest"/>
</security-setting> </security-settings> </core> </configuration>


I get the following error :

[Fatal Error] :2:6: The processing instruction target matching
"[xX][mM][lL]" is not allowed.
Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 2;
columnNumber: 6; The processing instruction target matching
"[xX][mM][lL]" is not allowed.
    at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)

Would you know why?

Julien D.

Alternative email address : julien.d@protonmail.ch

On 04/26/2016 07:13 PM, Justin Bertram wrote:
> You should be able to put the broker.xml anywhere on the application's classpath.
>
>
> Justin
>
> ----- Original Message -----
> From: "Julien d" <ju...@iki.fi>
> To: dev@activemq.apache.org
> Sent: Tuesday, April 26, 2016 11:00:48 AM
> Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ
>
> Hi everyone,
>
> Sorry for bothering, I am having some troubles working with Artemis,
> more particularly
> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
> would like to know if someone here could give me a hand please. I did
> not find this part documented, I could document it after understanding
> it better.
>
> Where should I put the broker.xml ?
> I have started a project where I have
> org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
> org.myproject packages in the same directory.
>
> At the moment my program is as simple as that since it is my first time
> working with Artemis :
>
> public static void main(String[] args) throws Exception{
>
>     EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }
>
> Thank you very much in advance,
>


Re: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Posted by Justin Bertram <jb...@apache.com>.
You should be able to put the broker.xml anywhere on the application's classpath.


Justin

----- Original Message -----
From: "Julien d" <ju...@iki.fi>
To: dev@activemq.apache.org
Sent: Tuesday, April 26, 2016 11:00:48 AM
Subject: Need help with org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ

Hi everyone,

Sorry for bothering, I am having some troubles working with Artemis,
more particularly
org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and I
would like to know if someone here could give me a hand please. I did
not find this part documented, I could document it after understanding
it better.

Where should I put the broker.xml ?
I have started a project where I have
org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ and
org.myproject packages in the same directory.

At the moment my program is as simple as that since it is my first time
working with Artemis :

public static void main(String[] args) throws Exception{

    EmbeddedRestActiveMQ Restserver = new EmbeddedRestActiveMQ(); Restserver.start(); }

Thank you very much in advance,

-- 
Julien D.

Alternative email address : julien.d@protonmail.ch