You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Christopher Pisz <ch...@gmail.com> on 2020/08/07 18:00:02 UTC

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

So I installed ActiveMQ on a remote machine this morning.
Created the default broker.
Attempted to connect with the client I wrote using websockets.
Connection is refused.

I then tried running the examples/protocols/stomp/stomp-websockets example
Attempted to connect with the client I write using websockets
Connection is refused.
Attempted to connect using the index.html from my machine rather than the
remote(as localhost there)
Connection refused.

I don't know what to do.
Is there another premade client I can connect with that doesn't use
websockets, so I can at least narrow it down and see if the server works at
all?
Any other suggestions?



On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <wa...@gmail.com>
wrote:

> Websockets don’t use the same-origin policies that other AJAX requests do.
> You will most likely need to serve them via TLS to prevent browser errors,
> but there’s nothing special you need to do to setup CORS.
>
> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> christopherpisz@gmail.com>
> wrote:
>
> > I have a process that runs in California that wants to talk to a process
> in
> > New York, using Stomp over Websockets.
> >
> > Also note that my process is not a web app, but I implemented a stomp
> over
> > websocket client in C++, in order to connect things up to my backend.
> Maybe
> > this was or wasn't a good idea. So, I want my client to talk to the
> server
> > and subscribe, where their client pushed messages.
> >
> > I was implementing my own server when I saw that ApacheMQ supported Stomp
> > over Websockets. So, I started reading the docs.
> >
> > It says:
> >
> > One thing worth noting is that web sockets (just as Ajax) implements ? >
> > the same origin policy, so you can access only brokers running on the >
> > same host as the web application running the client.
> >
> > Is this a limitation of the server or the web client?
> >
> > With that limitation, if I understand right, the server is not going to
> > accept websocket connections from a client, of any kind, that is not on
> the
> > same machine?
> >
> > I am not sure I see the point of that...
> >
> > If that is indeed its meaning, then how do I get around it in order to
> > implement my scenario?
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Christopher Pisz <ch...@gmail.com>.
So, I did some more work on it this morning. Figured out how to shut off
firewall in CentOS and it works fine.
So, it's not an issue with Artemis or my client at all. Just more Linux
stuff I don't know about.

Thanks for the help guys!

On Sat, Aug 8, 2020 at 10:03 AM Justin Bertram <jb...@apache.org> wrote:

> > Does Artemis accept websocket connections on 61616?
>
> By default, yes. The broker will automatically detect the WebSocket
> connection and serve it appropriately.
>
>
> Justin
>
> On Sat, Aug 8, 2020 at 8:44 AM Tim Bain <tb...@alumni.duke.edu> wrote:
>
> > Does Artemis accept websocket connections on 61616? I'm used to ActiveMQ
> > 5.x, which uses different ports for different protocols, and I know that
> > Artemis handles the protocols differently. I see from the logs that 61616
> > is listening for a number of protocols, and websocket is not in the list.
> > Is that relevant?
> >
> > None of that affects the fact that the attempts to connect to the broker
> > via OpenWire on 61616 are failing, and we should definitely work through
> > that first. These comments are just for once OpenWire connections are
> > working, if STOMP+websockets is still not working.
> >
> > Tim
> >
> > On Fri, Aug 7, 2020, 9:19 PM Justin Bertram <jb...@apache.org> wrote:
> >
> > > > Also, have you confirmed that Artemis is actually listening on the
> port
> > > you're trying to use?
> > >
> > > The log he pasted indicates that the broker is indeed listening on
> 61616:
> > >
> > >   INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started
> > EPOLL
> > > Acceptor at 0.0.0.0:61616 for protocols
> > > [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> > >
> > > Using netstat may be helpful to confirm beyond all doubt, though.
> > >
> > >
> > > Justin
> > >
> > > On Fri, Aug 7, 2020 at 8:51 PM Tim Bain <tb...@alumni.duke.edu> wrote:
> > >
> > > > One way to test if it's a firewall issue is to try to open a raw TCP
> > > socket
> > > > to the port and see if you can establish a TCP connection and pass
> > data.
> > > It
> > > > doesn't need to be compliant with the higher-level protocols (HTTP,
> > > STOMP),
> > > > it just needs to confirm that bytes are successfully passed. If bytes
> > > pass,
> > > > it's likely not a firewall/network issue; if nothing gets through or
> > the
> > > > TCP connection fails outright, then it's likely firewall or network
> > > > routing.
> > > >
> > > > It's been a while since I've done this, but I think both telnet and
> > > netcat
> > > > (nc) will let you do this type of test. I'm sure there are other ways
> > to
> > > do
> > > > it, too.
> > > >
> > > > Also, have you confirmed that Artemis is actually listening on the
> port
> > > > you're trying to use? You can check via sudo netstat -antp | grep
> > LISTEN
> > > |
> > > > grep 61616 on the machine hosting the broker.
> > > >
> > > > Tim
> > > >
> > > > On Fri, Aug 7, 2020, 4:39 PM Justin Bertram <jb...@apache.org>
> > wrote:
> > > >
> > > > > Given that the broker is up and running fine on the remote machine
> I
> > > > would
> > > > > say there's some kind of environmental or network issue preventing
> > > > > communication from your local machine and the remote machine on
> port
> > > > 61616.
> > > > > Perhaps a firewall is blocking that port.
> > > > >
> > > > >
> > > > > Justin
> > > > >
> > > > > On Fri, Aug 7, 2020 at 4:18 PM Christopher Pisz <
> > > > christopherpisz@gmail.com
> > > > > >
> > > > > wrote:
> > > > >
> > > > > > Log looks good to me:
> > > > > >
> > > > > > 2020-08-07 15:22:40,666 INFO
> > > > > >  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000:
> > > > Starting
> > > > > > ActiveMQ Artemis Server
> > > > > > 2020-08-07 15:22:40,713 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221000: live Message Broker is starting with configuration
> > Broker
> > > > > > Configuration
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
> > > > > > 2020-08-07 15:22:40,759 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221012: Using AIO Journal
> > > > > > 2020-08-07 15:22:40,798 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM
> max
> > > size
> > > > > > (-Xmx). being defined as 1,073,741,824
> > > > > > 2020-08-07 15:22:40,822 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221043: Protocol module found: [artemis-server]. Adding
> protocol
> > > > > support
> > > > > > for: CORE
> > > > > > 2020-08-07 15:22:40,823 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding
> > > > > protocol
> > > > > > support for: AMQP
> > > > > > 2020-08-07 15:22:40,823 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221043: Protocol module found: [artemis-hornetq-protocol].
> > Adding
> > > > > > protocol support for: HORNETQ
> > > > > > 2020-08-07 15:22:40,824 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding
> > > > > protocol
> > > > > > support for: MQTT
> > > > > > 2020-08-07 15:22:40,824 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221043: Protocol module found: [artemis-openwire-protocol].
> > Adding
> > > > > > protocol support for: OPENWIRE
> > > > > > 2020-08-07 15:22:40,825 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221043: Protocol module found: [artemis-stomp-protocol].
> Adding
> > > > > protocol
> > > > > > support for: STOMP
> > > > > > 2020-08-07 15:22:40,890 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221034: Waiting indefinitely to obtain live lock
> > > > > > 2020-08-07 15:22:40,890 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221035: Live Server Obtained live lock
> > > > > > 2020-08-07 15:22:40,979 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221080: Deploying address DLQ supporting [ANYCAST]
> > > > > > 2020-08-07 15:22:40,993 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
> > > > > > 2020-08-07 15:22:41,048 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
> > > > > > 2020-08-07 15:22:41,050 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221003: Deploying ANYCAST queue ExpiryQueue on address
> > ExpiryQueue
> > > > > > 2020-08-07 15:22:41,461 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols
> > > > > > [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> > > > > > 2020-08-07 15:22:41,464 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols
> > > > > > [HORNETQ,STOMP]
> > > > > > 2020-08-07 15:22:41,467 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols
> > > [AMQP]
> > > > > > 2020-08-07 15:22:41,469 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols
> > > [MQTT]
> > > > > > 2020-08-07 15:22:41,479 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols
> > > > [STOMP]
> > > > > > 2020-08-07 15:22:41,481 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221007: Server is now live
> > > > > > 2020-08-07 15:22:41,482 INFO
> > > [org.apache.activemq.artemis.core.server]
> > > > > > AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0
> > > > > [0.0.0.0,
> > > > > > nodeID=5c5d5e87-d8e3-11ea-8b59-b42e99360c2c]
> > > > > > 2020-08-07 15:22:41,827 INFO
> > > > > >  [org.apache.activemq.hawtio.branding.PluginContextListener]
> > > > Initialized
> > > > > > activemq-branding plugin
> > > > > > 2020-08-07 15:22:41,879 INFO
> > > > > >  [org.apache.activemq.hawtio.plugin.PluginContextListener]
> > > Initialized
> > > > > > artemis-plugin plugin
> > > > > > 2020-08-07 15:22:42,326 INFO  [io.hawt.HawtioContextListener]
> > > > > Initialising
> > > > > > hawtio services
> > > > > > 2020-08-07 15:22:42,348 INFO  [io.hawt.system.ConfigManager]
> > > > > Configuration
> > > > > > will be discovered via system properties
> > > > > > 2020-08-07 15:22:42,352 INFO  [io.hawt.jmx.JmxTreeWatcher]
> Welcome
> > to
> > > > > > hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console
> was
> > > hawt
> > > > > > like
> > > > > > me? ;-)
> > > > > > 2020-08-07 15:22:42,361 INFO  [io.hawt.jmx.UploadManager] Using
> > file
> > > > > upload
> > > > > > directory: /var/lib/testbroker/tmp/uploads
> > > > > > 2020-08-07 15:22:42,383 INFO  [io.hawt.web.AuthenticationFilter]
> > > > Starting
> > > > > > hawtio authentication filter, JAAS realm: "activemq" authorized
> > > > role(s):
> > > > > > "amq" role principal classes:
> > > > > >
> "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
> > > > > > 2020-08-07 15:22:42,406 INFO
> > > > [io.hawt.web.JolokiaConfiguredAgentServlet]
> > > > > > Jolokia overridden property: [key=policyLocation,
> > > > > > value=file:/var/lib/testbroker/etc/jolokia-access.xml]
> > > > > > 2020-08-07 15:22:42,430 INFO  [io.hawt.web.RBACMBeanInvoker]
> Using
> > > > MBean
> > > > > >
> [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity]
> > > for
> > > > > role
> > > > > > based access control
> > > > > > 2020-08-07 15:22:42,544 INFO  [io.hawt.system.ProxyWhitelist]
> > Initial
> > > > > proxy
> > > > > > whitelist: [localhost, 127.0.0.1, 10.105.1.162,
> > > > > > hansel04.alertinnovation.com
> > > > > > ]
> > > > > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis]
> > > AMQ241001:
> > > > > HTTP
> > > > > > Server started at http://localhost:8161
> > > > > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis]
> > > AMQ241002:
> > > > > > Artemis Jolokia REST API available at
> > > > > > http://localhost:8161/console/jolokia
> > > > > > 2020-08-07 <http://localhost:8161/console/jolokia2020-08-07>
> > > > > 15:22:42,786
> > > > > > INFO  [org.apache.activemq.artemis] AMQ241004:
> > > > > > Artemis Console available at http://localhost:8161/console
> > > > > >
> > > > > > Trying producer command on the remote machine itself:
> > > > > > cd /opt/apache-artemis-2.14.0/bin/
> > > > > > ./artemis producer --url tcp://localhost:61616 --user username
> > > > --password
> > > > > > password
> > > > > > Connection brokerURL = tcp://localhost:61616
> > > > > > Producer ActiveMQQueue[TEST], thread=0 Started to calculate
> elapsed
> > > > time
> > > > > > ...
> > > > > >
> > > > > > Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
> > > > > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second :
> 1 s
> > > > > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli
> > second :
> > > > > 1509
> > > > > > milli seconds
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Fri, Aug 7, 2020 at 3:41 PM Justin Bertram <
> jbertram@apache.org
> > >
> > > > > wrote:
> > > > > >
> > > > > > > Did you check artemis.log to ensure the broker actually started
> > up
> > > > > > without
> > > > > > > errors?
> > > > > > >
> > > > > > > Also, did you run the "artemis producer" command on the remote
> > > > machine
> > > > > to
> > > > > > > make sure the broker is actually working?
> > > > > > >
> > > > > > >
> > > > > > > Justin
> > > > > > >
> > > > > > > On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <
> > > > > > christopherpisz@gmail.com
> > > > > > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > > From Remote Machine:
> > > > > > > > cd /var/lib
> > > > > > > > sudo su
> > > > > > > > /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> > > > > > > > Creating ActiveMQ Artemis instance at: /var/lib/testbroker
> > > > > > > >
> > > > > > > > --user: is a mandatory property!
> > > > > > > > Please provide the default username:
> > > > > > > > user
> > > > > > > >
> > > > > > > > --password: is mandatory with this configuration:
> > > > > > > > Please provide the default password:
> > > > > > > >
> > > > > > > >
> > > > > > > > --allow-anonymous | --require-login: is a mandatory property!
> > > > > > > > Allow anonymous access?, valid values are Y,N,True,False
> > > > > > > > Y
> > > > > > > >
> > > > > > > > Auto tuning journal ...
> > > > > > > > done! Your system can make 62.5 writes per millisecond, your
> > > > > > > > journal-buffer-timeout will be 16000
> > > > > > > >
> > > > > > > > You can now start the broker by executing:
> > > > > > > >
> > > > > > > >    "/var/lib/testbroker/bin/artemis" run
> > > > > > > >
> > > > > > > > Or you can run the broker in the background using:
> > > > > > > >
> > > > > > > >    "/var/lib/testbroker/bin/artemis-service" start
> > > > > > > >
> > > > > > > > "/var/lib/testbroker/bin/artemis-service" start
> > > > > > > > Starting artemis-service
> > > > > > > > artemis-service is now running (21742)
> > > > > > > >
> > > > > > > > From Local Machine:
> > > > > > > > ping topsecretmachine.com
> > > > > > > > PING topsecretmachine.com (someip) 56(84) bytes of data.
> > > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=1
> ttl=63
> > > > > > time=68.3
> > > > > > > > ms
> > > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=2
> ttl=63
> > > > > > time=65.6
> > > > > > > > ms
> > > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=3
> ttl=63
> > > > > > time=69.0
> > > > > > > > ms
> > > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=4
> ttl=63
> > > > > > time=66.4
> > > > > > > > ms
> > > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=5
> ttl=63
> > > > > > time=65.7
> > > > > > > > ms
> > > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=6
> ttl=63
> > > > > > time=71.7
> > > > > > > > ms
> > > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=7
> ttl=63
> > > > > > time=67.2
> > > > > > > > ms
> > > > > > > > ^C
> > > > > > > > --- topsecretmachine.com ping statistics ---
> > > > > > > > 7 packets transmitted, 7 received, 0% packet loss, time
> 6010ms
> > > > > > > > rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> > > > > > > > [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> > > > > > > > [cpisz@localhost bin]$ ./artemis producer --url tcp://
> > > > > > > > topsecretmachine.com:61616 --user user --password password
> > > > > > > > Connection brokerURL = tcp://topsecretmachine.com:61616
> > > > > > > > Connection failed::Failed to create session factory
> > > > > > > >
> > > > > > > > --url: is a mandatory property!
> > > > > > > > Type in the broker URL for a retry (e.g.
> tcp://localhost:61616)
> > > > > > > > tcp://topsecretmachine.com:61616
> > > > > > > > Exception in thread "main" javax.jms.JMSException: Failed to
> > > create
> > > > > > > session
> > > > > > > > factory
> > > > > > > > at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> > > > > > > > at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> > > > > > > > at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> > > > > > > > at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> > > > > > > > at
> > > > > > > >
> > > > > >
> > > >
> > org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> > > > > > > > at
> > > > org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> > > > > > > > at
> > > > org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> > > > > > > > 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> > > > > > > > at
> > org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> > > > > > > > Caused by:
> > ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> > > > > > > > message=AMQ219007: Cannot connect to server(s). Tried with
> all
> > > > > > available
> > > > > > > > servers.]
> > > > > > > > at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> > > > > > > > at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> > > > > > > > ... 12 more
> > > > > > > >
> > > > > > > > On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <
> > > jbertram@apache.org
> > > > >
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Given that you have an instance of ActiveMQ Artemis on the
> > same
> > > > > > machine
> > > > > > > > as
> > > > > > > > > the STOMP client I recommend you do something like this:
> > > > > > > > >
> > > > > > > > >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> > > > > > > > >   > ./artemis producer --url tcp://remote-machine:61616
> > --user
> > > > > > yourUser
> > > > > > > > > --password yourPassword
> > > > > > > > >
> > > > > > > > > Let me know if that works.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Justin
> > > > > > > > >
> > > > > > > > > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> > > > > > > > christopherpisz@gmail.com
> > > > > > > > > >
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > I just followed the instructions on
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > > > > > > > > The broker is the default. Nothing is edited.
> > > > > > > > > >
> > > > > > > > > > "
> > > > > > > > > >
> > > > > > > > > > cd /var/lib
> > > > > > > > > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > > > > > > > > /var/lib/mybroker/bin/artemis run
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <
> > > > tabish121@gmail.com
> > > > > >
> > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > > > > > > > > What I need:
> > > > > > > > > > > > To determine if I can connect to activemq using stomp
> > > over
> > > > > > > > websockets
> > > > > > > > > > > from
> > > > > > > > > > > > a remote machine, with a client I wrote.
> > > > > > > > > > > >
> > > > > > > > > > > > What I did:
> > > > > > > > > > > > I wrote my own stomp over websockets client in C++
> and
> > > > built
> > > > > it
> > > > > > > for
> > > > > > > > > > > > CentOS7, on my home computer.
> > > > > > > > > > > > I installed an ActiveMQ on a remote machine through
> > ssh.
> > > > > > > > > > > > I created the ActiveMQ default broker according to
> the
> > > docs
> > > > > > > > > > > > I attempted to connect with my client
> > > > > > > > > > >
> > > > > > > > > > > Providing the broker configuration you used will help
> > folks
> > > > > > answer
> > > > > > > > with
> > > > > > > > > > > insights into what might be wrong there.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > > What happened:
> > > > > > > > > > > > Connection refused
> > > > > > > > > > > >
> > > > > > > > > > > > What I need:
> > > > > > > > > > > > To figure out why connection is refused
> > > > > > > > > > > >
> > > > > > > > > > > > Ideas of my own:
> > > > > > > > > > > > Does the client work on the local machine with the
> same
> > > > > version
> > > > > > > and
> > > > > > > > > > > > configuration of ActiveMQ? Yes
> > > > > > > > > > > > Does someone else's client connect to the remote
> > > machine? I
> > > > > > > dunno,
> > > > > > > > I
> > > > > > > > > > need
> > > > > > > > > > > > someone else's client
> > > > > > > > > > > > Maybe a client that uses something other than
> > websockets
> > > > will
> > > > > > > prove
> > > > > > > > > > that
> > > > > > > > > > > > the "same origin policy" in the beginning of the
> email,
> > > is
> > > > > > indeed
> > > > > > > > the
> > > > > > > > > > > > problem? I dunno. I need a client that uses another
> > > > protocol.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <
> > > > > > > jbertram@apache.org
> > > > > > > > >
> > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > >> You're not really explaining what you need.
> > > > > > > > > > > >>
> > > > > > > > > > > >> You say you need "a built client that connects with
> a
> > > > > > different
> > > > > > > > > > > protocol."
> > > > > > > > > > > >> What exactly do you mean by "built"? Does it have to
> > be
> > > a
> > > > > > > binary?
> > > > > > > > If
> > > > > > > > > > so,
> > > > > > > > > > > >> what platform does the binary need to be built for?
> If
> > > it
> > > > > > > doesn't
> > > > > > > > > have
> > > > > > > > > > > to
> > > > > > > > > > > >> be a binary would a python or perl script work?
> Also,
> > > what
> > > > > > > exactly
> > > > > > > > > do
> > > > > > > > > > > you
> > > > > > > > > > > >> mean by "different protocol"? Do you mean a
> different
> > > > > protocol
> > > > > > > > from
> > > > > > > > > > > STOMP?
> > > > > > > > > > > >> If so, I thought you were specifically trying to
> test
> > > > STOMP
> > > > > > > > > > connections.
> > > > > > > > > > > >> How would testing another protocol tell you if STOMP
> > > > > > connections
> > > > > > > > are
> > > > > > > > > > > >> working?
> > > > > > > > > > > >>
> > > > > > > > > > > >> It's hard (if not impossible) to provide clear
> > guidance
> > > to
> > > > > > vague
> > > > > > > > > > > questions.
> > > > > > > > > > > >>
> > > > > > > > > > > >> If it helps, ActiveMQ Artemis ships with
> command-line
> > > > > clients
> > > > > > > you
> > > > > > > > > can
> > > > > > > > > > > use
> > > > > > > > > > > >> to quickly test a broker. Just type "./artemis help"
> > > from
> > > > > the
> > > > > > > > broker
> > > > > > > > > > > >> instance's "bin" directory and look for details
> about
> > > the
> > > > > > > > "producer"
> > > > > > > > > > and
> > > > > > > > > > > >> "consumer" commands.
> > > > > > > > > > > >>
> > > > > > > > > > > >>
> > > > > > > > > > > >> Justin
> > > > > > > > > > > >>
> > > > > > > > > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > > > > > > > > christopherpisz@gmail.com
> > > > > > > > > > > >> wrote:
> > > > > > > > > > > >>
> > > > > > > > > > > >>> Yes, I did a Google search.
> > > > > > > > > > > >>> It yields code examples or javascript libs. I need
> a
> > > > built
> > > > > > > client
> > > > > > > > > > that
> > > > > > > > > > > >>> connects with a different protocol, so I can
> quickly
> > > test
> > > > > > that
> > > > > > > > the
> > > > > > > > > > > server
> > > > > > > > > > > >>> will allow clients to connect at all.
> > > > > > > > > > > >>>
> > > > > > > > > > > >>>
> > > > > > > > > > > >>>
> > > > > > > > > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> > > > > > > > jbertram@apache.org
> > > > > > > > > >
> > > > > > > > > > > >> wrote:
> > > > > > > > > > > >>>> There are lots of STOMP clients for various
> > platforms
> > > > > > written
> > > > > > > in
> > > > > > > > > > > >> various
> > > > > > > > > > > >>>> programming languages many of which do not use
> > > > websockets.
> > > > > > > What
> > > > > > > > > > > exactly
> > > > > > > > > > > >>> do
> > > > > > > > > > > >>>> you need? Did you try doing an Internet search?
> > > > > > > > > > > >>>>
> > > > > > > > > > > >>>>
> > > > > > > > > > > >>>> Justin
> > > > > > > > > > > >>>>
> > > > > > > > > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > > > > > > > > >>> christopherpisz@gmail.com
> > > > > > > > > > > >>>> wrote:
> > > > > > > > > > > >>>>
> > > > > > > > > > > >>>>> So I installed ActiveMQ on a remote machine this
> > > > morning.
> > > > > > > > > > > >>>>> Created the default broker.
> > > > > > > > > > > >>>>> Attempted to connect with the client I wrote
> using
> > > > > > > websockets.
> > > > > > > > > > > >>>>> Connection is refused.
> > > > > > > > > > > >>>>>
> > > > > > > > > > > >>>>> I then tried running the
> > > > > > > > > examples/protocols/stomp/stomp-websockets
> > > > > > > > > > > >>>> example
> > > > > > > > > > > >>>>> Attempted to connect with the client I write
> using
> > > > > > websockets
> > > > > > > > > > > >>>>> Connection is refused.
> > > > > > > > > > > >>>>> Attempted to connect using the index.html from my
> > > > machine
> > > > > > > > rather
> > > > > > > > > > than
> > > > > > > > > > > >>> the
> > > > > > > > > > > >>>>> remote(as localhost there)
> > > > > > > > > > > >>>>> Connection refused.
> > > > > > > > > > > >>>>>
> > > > > > > > > > > >>>>> I don't know what to do.
> > > > > > > > > > > >>>>> Is there another premade client I can connect
> with
> > > that
> > > > > > > doesn't
> > > > > > > > > use
> > > > > > > > > > > >>>>> websockets, so I can at least narrow it down and
> > see
> > > if
> > > > > the
> > > > > > > > > server
> > > > > > > > > > > >>> works
> > > > > > > > > > > >>>> at
> > > > > > > > > > > >>>>> all?
> > > > > > > > > > > >>>>> Any other suggestions?
> > > > > > > > > > > >>>>>
> > > > > > > > > > > >>>>>
> > > > > > > > > > > >>>>>
> > > > > > > > > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > > > > > > > > >>> wayne.robinson@gmail.com
> > > > > > > > > > > >>>>> wrote:
> > > > > > > > > > > >>>>>
> > > > > > > > > > > >>>>>> Websockets don’t use the same-origin policies
> that
> > > > other
> > > > > > > AJAX
> > > > > > > > > > > >>> requests
> > > > > > > > > > > >>>>> do.
> > > > > > > > > > > >>>>>> You will most likely need to serve them via TLS
> to
> > > > > prevent
> > > > > > > > > browser
> > > > > > > > > > > >>>>> errors,
> > > > > > > > > > > >>>>>> but there’s nothing special you need to do to
> > setup
> > > > > CORS.
> > > > > > > > > > > >>>>>>
> > > > > > > > > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher
> Pisz <
> > > > > > > > > > > >>>>>> christopherpisz@gmail.com>
> > > > > > > > > > > >>>>>> wrote:
> > > > > > > > > > > >>>>>>
> > > > > > > > > > > >>>>>>> I have a process that runs in California that
> > wants
> > > > to
> > > > > > talk
> > > > > > > > to
> > > > > > > > > a
> > > > > > > > > > > >>>>> process
> > > > > > > > > > > >>>>>> in
> > > > > > > > > > > >>>>>>> New York, using Stomp over Websockets.
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> Also note that my process is not a web app,
> but I
> > > > > > > > implemented a
> > > > > > > > > > > >>> stomp
> > > > > > > > > > > >>>>>> over
> > > > > > > > > > > >>>>>>> websocket client in C++, in order to connect
> > things
> > > > up
> > > > > to
> > > > > > > my
> > > > > > > > > > > >>> backend.
> > > > > > > > > > > >>>>>> Maybe
> > > > > > > > > > > >>>>>>> this was or wasn't a good idea. So, I want my
> > > client
> > > > to
> > > > > > > talk
> > > > > > > > to
> > > > > > > > > > > >> the
> > > > > > > > > > > >>>>>> server
> > > > > > > > > > > >>>>>>> and subscribe, where their client pushed
> > messages.
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> I was implementing my own server when I saw
> that
> > > > > ApacheMQ
> > > > > > > > > > > >> supported
> > > > > > > > > > > >>>>> Stomp
> > > > > > > > > > > >>>>>>> over Websockets. So, I started reading the
> docs.
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> It says:
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> One thing worth noting is that web sockets
> (just
> > as
> > > > > Ajax)
> > > > > > > > > > > >>> implements
> > > > > > > > > > > >>>> ?
> > > > > > > > > > > >>>>>>> the same origin policy, so you can access only
> > > > brokers
> > > > > > > > running
> > > > > > > > > on
> > > > > > > > > > > >>>> the >
> > > > > > > > > > > >>>>>>> same host as the web application running the
> > > client.
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> Is this a limitation of the server or the web
> > > client?
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> With that limitation, if I understand right,
> the
> > > > server
> > > > > > is
> > > > > > > > not
> > > > > > > > > > > >>> going
> > > > > > > > > > > >>>> to
> > > > > > > > > > > >>>>>>> accept websocket connections from a client, of
> > any
> > > > > kind,
> > > > > > > that
> > > > > > > > > is
> > > > > > > > > > > >>> not
> > > > > > > > > > > >>>> on
> > > > > > > > > > > >>>>>> the
> > > > > > > > > > > >>>>>>> same machine?
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> I am not sure I see the point of that...
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > > >>>>>>> If that is indeed its meaning, then how do I
> get
> > > > around
> > > > > > it
> > > > > > > in
> > > > > > > > > > > >> order
> > > > > > > > > > > >>>> to
> > > > > > > > > > > >>>>>>> implement my scenario?
> > > > > > > > > > > >>>>>>>
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > > Tim Bish
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Justin Bertram <jb...@apache.org>.
> Does Artemis accept websocket connections on 61616?

By default, yes. The broker will automatically detect the WebSocket
connection and serve it appropriately.


Justin

On Sat, Aug 8, 2020 at 8:44 AM Tim Bain <tb...@alumni.duke.edu> wrote:

> Does Artemis accept websocket connections on 61616? I'm used to ActiveMQ
> 5.x, which uses different ports for different protocols, and I know that
> Artemis handles the protocols differently. I see from the logs that 61616
> is listening for a number of protocols, and websocket is not in the list.
> Is that relevant?
>
> None of that affects the fact that the attempts to connect to the broker
> via OpenWire on 61616 are failing, and we should definitely work through
> that first. These comments are just for once OpenWire connections are
> working, if STOMP+websockets is still not working.
>
> Tim
>
> On Fri, Aug 7, 2020, 9:19 PM Justin Bertram <jb...@apache.org> wrote:
>
> > > Also, have you confirmed that Artemis is actually listening on the port
> > you're trying to use?
> >
> > The log he pasted indicates that the broker is indeed listening on 61616:
> >
> >   INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started
> EPOLL
> > Acceptor at 0.0.0.0:61616 for protocols
> > [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> >
> > Using netstat may be helpful to confirm beyond all doubt, though.
> >
> >
> > Justin
> >
> > On Fri, Aug 7, 2020 at 8:51 PM Tim Bain <tb...@alumni.duke.edu> wrote:
> >
> > > One way to test if it's a firewall issue is to try to open a raw TCP
> > socket
> > > to the port and see if you can establish a TCP connection and pass
> data.
> > It
> > > doesn't need to be compliant with the higher-level protocols (HTTP,
> > STOMP),
> > > it just needs to confirm that bytes are successfully passed. If bytes
> > pass,
> > > it's likely not a firewall/network issue; if nothing gets through or
> the
> > > TCP connection fails outright, then it's likely firewall or network
> > > routing.
> > >
> > > It's been a while since I've done this, but I think both telnet and
> > netcat
> > > (nc) will let you do this type of test. I'm sure there are other ways
> to
> > do
> > > it, too.
> > >
> > > Also, have you confirmed that Artemis is actually listening on the port
> > > you're trying to use? You can check via sudo netstat -antp | grep
> LISTEN
> > |
> > > grep 61616 on the machine hosting the broker.
> > >
> > > Tim
> > >
> > > On Fri, Aug 7, 2020, 4:39 PM Justin Bertram <jb...@apache.org>
> wrote:
> > >
> > > > Given that the broker is up and running fine on the remote machine I
> > > would
> > > > say there's some kind of environmental or network issue preventing
> > > > communication from your local machine and the remote machine on port
> > > 61616.
> > > > Perhaps a firewall is blocking that port.
> > > >
> > > >
> > > > Justin
> > > >
> > > > On Fri, Aug 7, 2020 at 4:18 PM Christopher Pisz <
> > > christopherpisz@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > Log looks good to me:
> > > > >
> > > > > 2020-08-07 15:22:40,666 INFO
> > > > >  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000:
> > > Starting
> > > > > ActiveMQ Artemis Server
> > > > > 2020-08-07 15:22:40,713 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221000: live Message Broker is starting with configuration
> Broker
> > > > > Configuration
> > > > >
> > > > >
> > > >
> > >
> >
> (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
> > > > > 2020-08-07 15:22:40,759 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221012: Using AIO Journal
> > > > > 2020-08-07 15:22:40,798 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max
> > size
> > > > > (-Xmx). being defined as 1,073,741,824
> > > > > 2020-08-07 15:22:40,822 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221043: Protocol module found: [artemis-server]. Adding protocol
> > > > support
> > > > > for: CORE
> > > > > 2020-08-07 15:22:40,823 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding
> > > > protocol
> > > > > support for: AMQP
> > > > > 2020-08-07 15:22:40,823 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221043: Protocol module found: [artemis-hornetq-protocol].
> Adding
> > > > > protocol support for: HORNETQ
> > > > > 2020-08-07 15:22:40,824 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding
> > > > protocol
> > > > > support for: MQTT
> > > > > 2020-08-07 15:22:40,824 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221043: Protocol module found: [artemis-openwire-protocol].
> Adding
> > > > > protocol support for: OPENWIRE
> > > > > 2020-08-07 15:22:40,825 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding
> > > > protocol
> > > > > support for: STOMP
> > > > > 2020-08-07 15:22:40,890 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221034: Waiting indefinitely to obtain live lock
> > > > > 2020-08-07 15:22:40,890 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221035: Live Server Obtained live lock
> > > > > 2020-08-07 15:22:40,979 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221080: Deploying address DLQ supporting [ANYCAST]
> > > > > 2020-08-07 15:22:40,993 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
> > > > > 2020-08-07 15:22:41,048 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
> > > > > 2020-08-07 15:22:41,050 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221003: Deploying ANYCAST queue ExpiryQueue on address
> ExpiryQueue
> > > > > 2020-08-07 15:22:41,461 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols
> > > > > [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> > > > > 2020-08-07 15:22:41,464 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols
> > > > > [HORNETQ,STOMP]
> > > > > 2020-08-07 15:22:41,467 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols
> > [AMQP]
> > > > > 2020-08-07 15:22:41,469 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols
> > [MQTT]
> > > > > 2020-08-07 15:22:41,479 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols
> > > [STOMP]
> > > > > 2020-08-07 15:22:41,481 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221007: Server is now live
> > > > > 2020-08-07 15:22:41,482 INFO
> > [org.apache.activemq.artemis.core.server]
> > > > > AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0
> > > > [0.0.0.0,
> > > > > nodeID=5c5d5e87-d8e3-11ea-8b59-b42e99360c2c]
> > > > > 2020-08-07 15:22:41,827 INFO
> > > > >  [org.apache.activemq.hawtio.branding.PluginContextListener]
> > > Initialized
> > > > > activemq-branding plugin
> > > > > 2020-08-07 15:22:41,879 INFO
> > > > >  [org.apache.activemq.hawtio.plugin.PluginContextListener]
> > Initialized
> > > > > artemis-plugin plugin
> > > > > 2020-08-07 15:22:42,326 INFO  [io.hawt.HawtioContextListener]
> > > > Initialising
> > > > > hawtio services
> > > > > 2020-08-07 15:22:42,348 INFO  [io.hawt.system.ConfigManager]
> > > > Configuration
> > > > > will be discovered via system properties
> > > > > 2020-08-07 15:22:42,352 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome
> to
> > > > > hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was
> > hawt
> > > > > like
> > > > > me? ;-)
> > > > > 2020-08-07 15:22:42,361 INFO  [io.hawt.jmx.UploadManager] Using
> file
> > > > upload
> > > > > directory: /var/lib/testbroker/tmp/uploads
> > > > > 2020-08-07 15:22:42,383 INFO  [io.hawt.web.AuthenticationFilter]
> > > Starting
> > > > > hawtio authentication filter, JAAS realm: "activemq" authorized
> > > role(s):
> > > > > "amq" role principal classes:
> > > > > "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
> > > > > 2020-08-07 15:22:42,406 INFO
> > > [io.hawt.web.JolokiaConfiguredAgentServlet]
> > > > > Jolokia overridden property: [key=policyLocation,
> > > > > value=file:/var/lib/testbroker/etc/jolokia-access.xml]
> > > > > 2020-08-07 15:22:42,430 INFO  [io.hawt.web.RBACMBeanInvoker] Using
> > > MBean
> > > > > [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity]
> > for
> > > > role
> > > > > based access control
> > > > > 2020-08-07 15:22:42,544 INFO  [io.hawt.system.ProxyWhitelist]
> Initial
> > > > proxy
> > > > > whitelist: [localhost, 127.0.0.1, 10.105.1.162,
> > > > > hansel04.alertinnovation.com
> > > > > ]
> > > > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis]
> > AMQ241001:
> > > > HTTP
> > > > > Server started at http://localhost:8161
> > > > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis]
> > AMQ241002:
> > > > > Artemis Jolokia REST API available at
> > > > > http://localhost:8161/console/jolokia
> > > > > 2020-08-07 <http://localhost:8161/console/jolokia2020-08-07>
> > > > 15:22:42,786
> > > > > INFO  [org.apache.activemq.artemis] AMQ241004:
> > > > > Artemis Console available at http://localhost:8161/console
> > > > >
> > > > > Trying producer command on the remote machine itself:
> > > > > cd /opt/apache-artemis-2.14.0/bin/
> > > > > ./artemis producer --url tcp://localhost:61616 --user username
> > > --password
> > > > > password
> > > > > Connection brokerURL = tcp://localhost:61616
> > > > > Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed
> > > time
> > > > > ...
> > > > >
> > > > > Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
> > > > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 1 s
> > > > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli
> second :
> > > > 1509
> > > > > milli seconds
> > > > >
> > > > >
> > > > >
> > > > > On Fri, Aug 7, 2020 at 3:41 PM Justin Bertram <jbertram@apache.org
> >
> > > > wrote:
> > > > >
> > > > > > Did you check artemis.log to ensure the broker actually started
> up
> > > > > without
> > > > > > errors?
> > > > > >
> > > > > > Also, did you run the "artemis producer" command on the remote
> > > machine
> > > > to
> > > > > > make sure the broker is actually working?
> > > > > >
> > > > > >
> > > > > > Justin
> > > > > >
> > > > > > On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <
> > > > > christopherpisz@gmail.com
> > > > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > From Remote Machine:
> > > > > > > cd /var/lib
> > > > > > > sudo su
> > > > > > > /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> > > > > > > Creating ActiveMQ Artemis instance at: /var/lib/testbroker
> > > > > > >
> > > > > > > --user: is a mandatory property!
> > > > > > > Please provide the default username:
> > > > > > > user
> > > > > > >
> > > > > > > --password: is mandatory with this configuration:
> > > > > > > Please provide the default password:
> > > > > > >
> > > > > > >
> > > > > > > --allow-anonymous | --require-login: is a mandatory property!
> > > > > > > Allow anonymous access?, valid values are Y,N,True,False
> > > > > > > Y
> > > > > > >
> > > > > > > Auto tuning journal ...
> > > > > > > done! Your system can make 62.5 writes per millisecond, your
> > > > > > > journal-buffer-timeout will be 16000
> > > > > > >
> > > > > > > You can now start the broker by executing:
> > > > > > >
> > > > > > >    "/var/lib/testbroker/bin/artemis" run
> > > > > > >
> > > > > > > Or you can run the broker in the background using:
> > > > > > >
> > > > > > >    "/var/lib/testbroker/bin/artemis-service" start
> > > > > > >
> > > > > > > "/var/lib/testbroker/bin/artemis-service" start
> > > > > > > Starting artemis-service
> > > > > > > artemis-service is now running (21742)
> > > > > > >
> > > > > > > From Local Machine:
> > > > > > > ping topsecretmachine.com
> > > > > > > PING topsecretmachine.com (someip) 56(84) bytes of data.
> > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63
> > > > > time=68.3
> > > > > > > ms
> > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63
> > > > > time=65.6
> > > > > > > ms
> > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63
> > > > > time=69.0
> > > > > > > ms
> > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63
> > > > > time=66.4
> > > > > > > ms
> > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63
> > > > > time=65.7
> > > > > > > ms
> > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63
> > > > > time=71.7
> > > > > > > ms
> > > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63
> > > > > time=67.2
> > > > > > > ms
> > > > > > > ^C
> > > > > > > --- topsecretmachine.com ping statistics ---
> > > > > > > 7 packets transmitted, 7 received, 0% packet loss, time 6010ms
> > > > > > > rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> > > > > > > [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> > > > > > > [cpisz@localhost bin]$ ./artemis producer --url tcp://
> > > > > > > topsecretmachine.com:61616 --user user --password password
> > > > > > > Connection brokerURL = tcp://topsecretmachine.com:61616
> > > > > > > Connection failed::Failed to create session factory
> > > > > > >
> > > > > > > --url: is a mandatory property!
> > > > > > > Type in the broker URL for a retry (e.g. tcp://localhost:61616)
> > > > > > > tcp://topsecretmachine.com:61616
> > > > > > > Exception in thread "main" javax.jms.JMSException: Failed to
> > create
> > > > > > session
> > > > > > > factory
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> > > > > > > at
> > > > > > >
> > > > >
> > >
> org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> > > > > > > at
> > > org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> > > > > > > at
> > > org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> > > > > > > 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> > > > > > > at
> org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> > > > > > > Caused by:
> ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> > > > > > > message=AMQ219007: Cannot connect to server(s). Tried with all
> > > > > available
> > > > > > > servers.]
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> > > > > > > at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> > > > > > > ... 12 more
> > > > > > >
> > > > > > > On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <
> > jbertram@apache.org
> > > >
> > > > > > wrote:
> > > > > > >
> > > > > > > > Given that you have an instance of ActiveMQ Artemis on the
> same
> > > > > machine
> > > > > > > as
> > > > > > > > the STOMP client I recommend you do something like this:
> > > > > > > >
> > > > > > > >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> > > > > > > >   > ./artemis producer --url tcp://remote-machine:61616
> --user
> > > > > yourUser
> > > > > > > > --password yourPassword
> > > > > > > >
> > > > > > > > Let me know if that works.
> > > > > > > >
> > > > > > > >
> > > > > > > > Justin
> > > > > > > >
> > > > > > > > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> > > > > > > christopherpisz@gmail.com
> > > > > > > > >
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > I just followed the instructions on
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > > > > > > > The broker is the default. Nothing is edited.
> > > > > > > > >
> > > > > > > > > "
> > > > > > > > >
> > > > > > > > > cd /var/lib
> > > > > > > > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > > > > > > > /var/lib/mybroker/bin/artemis run
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <
> > > tabish121@gmail.com
> > > > >
> > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > > > > > > > What I need:
> > > > > > > > > > > To determine if I can connect to activemq using stomp
> > over
> > > > > > > websockets
> > > > > > > > > > from
> > > > > > > > > > > a remote machine, with a client I wrote.
> > > > > > > > > > >
> > > > > > > > > > > What I did:
> > > > > > > > > > > I wrote my own stomp over websockets client in C++ and
> > > built
> > > > it
> > > > > > for
> > > > > > > > > > > CentOS7, on my home computer.
> > > > > > > > > > > I installed an ActiveMQ on a remote machine through
> ssh.
> > > > > > > > > > > I created the ActiveMQ default broker according to the
> > docs
> > > > > > > > > > > I attempted to connect with my client
> > > > > > > > > >
> > > > > > > > > > Providing the broker configuration you used will help
> folks
> > > > > answer
> > > > > > > with
> > > > > > > > > > insights into what might be wrong there.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > What happened:
> > > > > > > > > > > Connection refused
> > > > > > > > > > >
> > > > > > > > > > > What I need:
> > > > > > > > > > > To figure out why connection is refused
> > > > > > > > > > >
> > > > > > > > > > > Ideas of my own:
> > > > > > > > > > > Does the client work on the local machine with the same
> > > > version
> > > > > > and
> > > > > > > > > > > configuration of ActiveMQ? Yes
> > > > > > > > > > > Does someone else's client connect to the remote
> > machine? I
> > > > > > dunno,
> > > > > > > I
> > > > > > > > > need
> > > > > > > > > > > someone else's client
> > > > > > > > > > > Maybe a client that uses something other than
> websockets
> > > will
> > > > > > prove
> > > > > > > > > that
> > > > > > > > > > > the "same origin policy" in the beginning of the email,
> > is
> > > > > indeed
> > > > > > > the
> > > > > > > > > > > problem? I dunno. I need a client that uses another
> > > protocol.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <
> > > > > > jbertram@apache.org
> > > > > > > >
> > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > >> You're not really explaining what you need.
> > > > > > > > > > >>
> > > > > > > > > > >> You say you need "a built client that connects with a
> > > > > different
> > > > > > > > > > protocol."
> > > > > > > > > > >> What exactly do you mean by "built"? Does it have to
> be
> > a
> > > > > > binary?
> > > > > > > If
> > > > > > > > > so,
> > > > > > > > > > >> what platform does the binary need to be built for? If
> > it
> > > > > > doesn't
> > > > > > > > have
> > > > > > > > > > to
> > > > > > > > > > >> be a binary would a python or perl script work? Also,
> > what
> > > > > > exactly
> > > > > > > > do
> > > > > > > > > > you
> > > > > > > > > > >> mean by "different protocol"? Do you mean a different
> > > > protocol
> > > > > > > from
> > > > > > > > > > STOMP?
> > > > > > > > > > >> If so, I thought you were specifically trying to test
> > > STOMP
> > > > > > > > > connections.
> > > > > > > > > > >> How would testing another protocol tell you if STOMP
> > > > > connections
> > > > > > > are
> > > > > > > > > > >> working?
> > > > > > > > > > >>
> > > > > > > > > > >> It's hard (if not impossible) to provide clear
> guidance
> > to
> > > > > vague
> > > > > > > > > > questions.
> > > > > > > > > > >>
> > > > > > > > > > >> If it helps, ActiveMQ Artemis ships with command-line
> > > > clients
> > > > > > you
> > > > > > > > can
> > > > > > > > > > use
> > > > > > > > > > >> to quickly test a broker. Just type "./artemis help"
> > from
> > > > the
> > > > > > > broker
> > > > > > > > > > >> instance's "bin" directory and look for details about
> > the
> > > > > > > "producer"
> > > > > > > > > and
> > > > > > > > > > >> "consumer" commands.
> > > > > > > > > > >>
> > > > > > > > > > >>
> > > > > > > > > > >> Justin
> > > > > > > > > > >>
> > > > > > > > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > > > > > > > christopherpisz@gmail.com
> > > > > > > > > > >> wrote:
> > > > > > > > > > >>
> > > > > > > > > > >>> Yes, I did a Google search.
> > > > > > > > > > >>> It yields code examples or javascript libs. I need a
> > > built
> > > > > > client
> > > > > > > > > that
> > > > > > > > > > >>> connects with a different protocol, so I can quickly
> > test
> > > > > that
> > > > > > > the
> > > > > > > > > > server
> > > > > > > > > > >>> will allow clients to connect at all.
> > > > > > > > > > >>>
> > > > > > > > > > >>>
> > > > > > > > > > >>>
> > > > > > > > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> > > > > > > jbertram@apache.org
> > > > > > > > >
> > > > > > > > > > >> wrote:
> > > > > > > > > > >>>> There are lots of STOMP clients for various
> platforms
> > > > > written
> > > > > > in
> > > > > > > > > > >> various
> > > > > > > > > > >>>> programming languages many of which do not use
> > > websockets.
> > > > > > What
> > > > > > > > > > exactly
> > > > > > > > > > >>> do
> > > > > > > > > > >>>> you need? Did you try doing an Internet search?
> > > > > > > > > > >>>>
> > > > > > > > > > >>>>
> > > > > > > > > > >>>> Justin
> > > > > > > > > > >>>>
> > > > > > > > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > > > > > > > >>> christopherpisz@gmail.com
> > > > > > > > > > >>>> wrote:
> > > > > > > > > > >>>>
> > > > > > > > > > >>>>> So I installed ActiveMQ on a remote machine this
> > > morning.
> > > > > > > > > > >>>>> Created the default broker.
> > > > > > > > > > >>>>> Attempted to connect with the client I wrote using
> > > > > > websockets.
> > > > > > > > > > >>>>> Connection is refused.
> > > > > > > > > > >>>>>
> > > > > > > > > > >>>>> I then tried running the
> > > > > > > > examples/protocols/stomp/stomp-websockets
> > > > > > > > > > >>>> example
> > > > > > > > > > >>>>> Attempted to connect with the client I write using
> > > > > websockets
> > > > > > > > > > >>>>> Connection is refused.
> > > > > > > > > > >>>>> Attempted to connect using the index.html from my
> > > machine
> > > > > > > rather
> > > > > > > > > than
> > > > > > > > > > >>> the
> > > > > > > > > > >>>>> remote(as localhost there)
> > > > > > > > > > >>>>> Connection refused.
> > > > > > > > > > >>>>>
> > > > > > > > > > >>>>> I don't know what to do.
> > > > > > > > > > >>>>> Is there another premade client I can connect with
> > that
> > > > > > doesn't
> > > > > > > > use
> > > > > > > > > > >>>>> websockets, so I can at least narrow it down and
> see
> > if
> > > > the
> > > > > > > > server
> > > > > > > > > > >>> works
> > > > > > > > > > >>>> at
> > > > > > > > > > >>>>> all?
> > > > > > > > > > >>>>> Any other suggestions?
> > > > > > > > > > >>>>>
> > > > > > > > > > >>>>>
> > > > > > > > > > >>>>>
> > > > > > > > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > > > > > > > >>> wayne.robinson@gmail.com
> > > > > > > > > > >>>>> wrote:
> > > > > > > > > > >>>>>
> > > > > > > > > > >>>>>> Websockets don’t use the same-origin policies that
> > > other
> > > > > > AJAX
> > > > > > > > > > >>> requests
> > > > > > > > > > >>>>> do.
> > > > > > > > > > >>>>>> You will most likely need to serve them via TLS to
> > > > prevent
> > > > > > > > browser
> > > > > > > > > > >>>>> errors,
> > > > > > > > > > >>>>>> but there’s nothing special you need to do to
> setup
> > > > CORS.
> > > > > > > > > > >>>>>>
> > > > > > > > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > > > > > > > >>>>>> christopherpisz@gmail.com>
> > > > > > > > > > >>>>>> wrote:
> > > > > > > > > > >>>>>>
> > > > > > > > > > >>>>>>> I have a process that runs in California that
> wants
> > > to
> > > > > talk
> > > > > > > to
> > > > > > > > a
> > > > > > > > > > >>>>> process
> > > > > > > > > > >>>>>> in
> > > > > > > > > > >>>>>>> New York, using Stomp over Websockets.
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> Also note that my process is not a web app, but I
> > > > > > > implemented a
> > > > > > > > > > >>> stomp
> > > > > > > > > > >>>>>> over
> > > > > > > > > > >>>>>>> websocket client in C++, in order to connect
> things
> > > up
> > > > to
> > > > > > my
> > > > > > > > > > >>> backend.
> > > > > > > > > > >>>>>> Maybe
> > > > > > > > > > >>>>>>> this was or wasn't a good idea. So, I want my
> > client
> > > to
> > > > > > talk
> > > > > > > to
> > > > > > > > > > >> the
> > > > > > > > > > >>>>>> server
> > > > > > > > > > >>>>>>> and subscribe, where their client pushed
> messages.
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> I was implementing my own server when I saw that
> > > > ApacheMQ
> > > > > > > > > > >> supported
> > > > > > > > > > >>>>> Stomp
> > > > > > > > > > >>>>>>> over Websockets. So, I started reading the docs.
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> It says:
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> One thing worth noting is that web sockets (just
> as
> > > > Ajax)
> > > > > > > > > > >>> implements
> > > > > > > > > > >>>> ?
> > > > > > > > > > >>>>>>> the same origin policy, so you can access only
> > > brokers
> > > > > > > running
> > > > > > > > on
> > > > > > > > > > >>>> the >
> > > > > > > > > > >>>>>>> same host as the web application running the
> > client.
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> Is this a limitation of the server or the web
> > client?
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> With that limitation, if I understand right, the
> > > server
> > > > > is
> > > > > > > not
> > > > > > > > > > >>> going
> > > > > > > > > > >>>> to
> > > > > > > > > > >>>>>>> accept websocket connections from a client, of
> any
> > > > kind,
> > > > > > that
> > > > > > > > is
> > > > > > > > > > >>> not
> > > > > > > > > > >>>> on
> > > > > > > > > > >>>>>> the
> > > > > > > > > > >>>>>>> same machine?
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> I am not sure I see the point of that...
> > > > > > > > > > >>>>>>>
> > > > > > > > > > >>>>>>> If that is indeed its meaning, then how do I get
> > > around
> > > > > it
> > > > > > in
> > > > > > > > > > >> order
> > > > > > > > > > >>>> to
> > > > > > > > > > >>>>>>> implement my scenario?
> > > > > > > > > > >>>>>>>
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > Tim Bish
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Tim Bain <tb...@alumni.duke.edu>.
Does Artemis accept websocket connections on 61616? I'm used to ActiveMQ
5.x, which uses different ports for different protocols, and I know that
Artemis handles the protocols differently. I see from the logs that 61616
is listening for a number of protocols, and websocket is not in the list.
Is that relevant?

None of that affects the fact that the attempts to connect to the broker
via OpenWire on 61616 are failing, and we should definitely work through
that first. These comments are just for once OpenWire connections are
working, if STOMP+websockets is still not working.

Tim

On Fri, Aug 7, 2020, 9:19 PM Justin Bertram <jb...@apache.org> wrote:

> > Also, have you confirmed that Artemis is actually listening on the port
> you're trying to use?
>
> The log he pasted indicates that the broker is indeed listening on 61616:
>
>   INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL
> Acceptor at 0.0.0.0:61616 for protocols
> [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
>
> Using netstat may be helpful to confirm beyond all doubt, though.
>
>
> Justin
>
> On Fri, Aug 7, 2020 at 8:51 PM Tim Bain <tb...@alumni.duke.edu> wrote:
>
> > One way to test if it's a firewall issue is to try to open a raw TCP
> socket
> > to the port and see if you can establish a TCP connection and pass data.
> It
> > doesn't need to be compliant with the higher-level protocols (HTTP,
> STOMP),
> > it just needs to confirm that bytes are successfully passed. If bytes
> pass,
> > it's likely not a firewall/network issue; if nothing gets through or the
> > TCP connection fails outright, then it's likely firewall or network
> > routing.
> >
> > It's been a while since I've done this, but I think both telnet and
> netcat
> > (nc) will let you do this type of test. I'm sure there are other ways to
> do
> > it, too.
> >
> > Also, have you confirmed that Artemis is actually listening on the port
> > you're trying to use? You can check via sudo netstat -antp | grep LISTEN
> |
> > grep 61616 on the machine hosting the broker.
> >
> > Tim
> >
> > On Fri, Aug 7, 2020, 4:39 PM Justin Bertram <jb...@apache.org> wrote:
> >
> > > Given that the broker is up and running fine on the remote machine I
> > would
> > > say there's some kind of environmental or network issue preventing
> > > communication from your local machine and the remote machine on port
> > 61616.
> > > Perhaps a firewall is blocking that port.
> > >
> > >
> > > Justin
> > >
> > > On Fri, Aug 7, 2020 at 4:18 PM Christopher Pisz <
> > christopherpisz@gmail.com
> > > >
> > > wrote:
> > >
> > > > Log looks good to me:
> > > >
> > > > 2020-08-07 15:22:40,666 INFO
> > > >  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000:
> > Starting
> > > > ActiveMQ Artemis Server
> > > > 2020-08-07 15:22:40,713 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221000: live Message Broker is starting with configuration Broker
> > > > Configuration
> > > >
> > > >
> > >
> >
> (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
> > > > 2020-08-07 15:22:40,759 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221012: Using AIO Journal
> > > > 2020-08-07 15:22:40,798 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max
> size
> > > > (-Xmx). being defined as 1,073,741,824
> > > > 2020-08-07 15:22:40,822 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221043: Protocol module found: [artemis-server]. Adding protocol
> > > support
> > > > for: CORE
> > > > 2020-08-07 15:22:40,823 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding
> > > protocol
> > > > support for: AMQP
> > > > 2020-08-07 15:22:40,823 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding
> > > > protocol support for: HORNETQ
> > > > 2020-08-07 15:22:40,824 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding
> > > protocol
> > > > support for: MQTT
> > > > 2020-08-07 15:22:40,824 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding
> > > > protocol support for: OPENWIRE
> > > > 2020-08-07 15:22:40,825 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding
> > > protocol
> > > > support for: STOMP
> > > > 2020-08-07 15:22:40,890 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221034: Waiting indefinitely to obtain live lock
> > > > 2020-08-07 15:22:40,890 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221035: Live Server Obtained live lock
> > > > 2020-08-07 15:22:40,979 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221080: Deploying address DLQ supporting [ANYCAST]
> > > > 2020-08-07 15:22:40,993 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
> > > > 2020-08-07 15:22:41,048 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
> > > > 2020-08-07 15:22:41,050 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
> > > > 2020-08-07 15:22:41,461 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols
> > > > [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> > > > 2020-08-07 15:22:41,464 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols
> > > > [HORNETQ,STOMP]
> > > > 2020-08-07 15:22:41,467 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols
> [AMQP]
> > > > 2020-08-07 15:22:41,469 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols
> [MQTT]
> > > > 2020-08-07 15:22:41,479 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols
> > [STOMP]
> > > > 2020-08-07 15:22:41,481 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221007: Server is now live
> > > > 2020-08-07 15:22:41,482 INFO
> [org.apache.activemq.artemis.core.server]
> > > > AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0
> > > [0.0.0.0,
> > > > nodeID=5c5d5e87-d8e3-11ea-8b59-b42e99360c2c]
> > > > 2020-08-07 15:22:41,827 INFO
> > > >  [org.apache.activemq.hawtio.branding.PluginContextListener]
> > Initialized
> > > > activemq-branding plugin
> > > > 2020-08-07 15:22:41,879 INFO
> > > >  [org.apache.activemq.hawtio.plugin.PluginContextListener]
> Initialized
> > > > artemis-plugin plugin
> > > > 2020-08-07 15:22:42,326 INFO  [io.hawt.HawtioContextListener]
> > > Initialising
> > > > hawtio services
> > > > 2020-08-07 15:22:42,348 INFO  [io.hawt.system.ConfigManager]
> > > Configuration
> > > > will be discovered via system properties
> > > > 2020-08-07 15:22:42,352 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to
> > > > hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was
> hawt
> > > > like
> > > > me? ;-)
> > > > 2020-08-07 15:22:42,361 INFO  [io.hawt.jmx.UploadManager] Using file
> > > upload
> > > > directory: /var/lib/testbroker/tmp/uploads
> > > > 2020-08-07 15:22:42,383 INFO  [io.hawt.web.AuthenticationFilter]
> > Starting
> > > > hawtio authentication filter, JAAS realm: "activemq" authorized
> > role(s):
> > > > "amq" role principal classes:
> > > > "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
> > > > 2020-08-07 15:22:42,406 INFO
> > [io.hawt.web.JolokiaConfiguredAgentServlet]
> > > > Jolokia overridden property: [key=policyLocation,
> > > > value=file:/var/lib/testbroker/etc/jolokia-access.xml]
> > > > 2020-08-07 15:22:42,430 INFO  [io.hawt.web.RBACMBeanInvoker] Using
> > MBean
> > > > [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity]
> for
> > > role
> > > > based access control
> > > > 2020-08-07 15:22:42,544 INFO  [io.hawt.system.ProxyWhitelist] Initial
> > > proxy
> > > > whitelist: [localhost, 127.0.0.1, 10.105.1.162,
> > > > hansel04.alertinnovation.com
> > > > ]
> > > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis]
> AMQ241001:
> > > HTTP
> > > > Server started at http://localhost:8161
> > > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis]
> AMQ241002:
> > > > Artemis Jolokia REST API available at
> > > > http://localhost:8161/console/jolokia
> > > > 2020-08-07 <http://localhost:8161/console/jolokia2020-08-07>
> > > 15:22:42,786
> > > > INFO  [org.apache.activemq.artemis] AMQ241004:
> > > > Artemis Console available at http://localhost:8161/console
> > > >
> > > > Trying producer command on the remote machine itself:
> > > > cd /opt/apache-artemis-2.14.0/bin/
> > > > ./artemis producer --url tcp://localhost:61616 --user username
> > --password
> > > > password
> > > > Connection brokerURL = tcp://localhost:61616
> > > > Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed
> > time
> > > > ...
> > > >
> > > > Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
> > > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 1 s
> > > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second :
> > > 1509
> > > > milli seconds
> > > >
> > > >
> > > >
> > > > On Fri, Aug 7, 2020 at 3:41 PM Justin Bertram <jb...@apache.org>
> > > wrote:
> > > >
> > > > > Did you check artemis.log to ensure the broker actually started up
> > > > without
> > > > > errors?
> > > > >
> > > > > Also, did you run the "artemis producer" command on the remote
> > machine
> > > to
> > > > > make sure the broker is actually working?
> > > > >
> > > > >
> > > > > Justin
> > > > >
> > > > > On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <
> > > > christopherpisz@gmail.com
> > > > > >
> > > > > wrote:
> > > > >
> > > > > > From Remote Machine:
> > > > > > cd /var/lib
> > > > > > sudo su
> > > > > > /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> > > > > > Creating ActiveMQ Artemis instance at: /var/lib/testbroker
> > > > > >
> > > > > > --user: is a mandatory property!
> > > > > > Please provide the default username:
> > > > > > user
> > > > > >
> > > > > > --password: is mandatory with this configuration:
> > > > > > Please provide the default password:
> > > > > >
> > > > > >
> > > > > > --allow-anonymous | --require-login: is a mandatory property!
> > > > > > Allow anonymous access?, valid values are Y,N,True,False
> > > > > > Y
> > > > > >
> > > > > > Auto tuning journal ...
> > > > > > done! Your system can make 62.5 writes per millisecond, your
> > > > > > journal-buffer-timeout will be 16000
> > > > > >
> > > > > > You can now start the broker by executing:
> > > > > >
> > > > > >    "/var/lib/testbroker/bin/artemis" run
> > > > > >
> > > > > > Or you can run the broker in the background using:
> > > > > >
> > > > > >    "/var/lib/testbroker/bin/artemis-service" start
> > > > > >
> > > > > > "/var/lib/testbroker/bin/artemis-service" start
> > > > > > Starting artemis-service
> > > > > > artemis-service is now running (21742)
> > > > > >
> > > > > > From Local Machine:
> > > > > > ping topsecretmachine.com
> > > > > > PING topsecretmachine.com (someip) 56(84) bytes of data.
> > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63
> > > > time=68.3
> > > > > > ms
> > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63
> > > > time=65.6
> > > > > > ms
> > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63
> > > > time=69.0
> > > > > > ms
> > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63
> > > > time=66.4
> > > > > > ms
> > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63
> > > > time=65.7
> > > > > > ms
> > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63
> > > > time=71.7
> > > > > > ms
> > > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63
> > > > time=67.2
> > > > > > ms
> > > > > > ^C
> > > > > > --- topsecretmachine.com ping statistics ---
> > > > > > 7 packets transmitted, 7 received, 0% packet loss, time 6010ms
> > > > > > rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> > > > > > [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> > > > > > [cpisz@localhost bin]$ ./artemis producer --url tcp://
> > > > > > topsecretmachine.com:61616 --user user --password password
> > > > > > Connection brokerURL = tcp://topsecretmachine.com:61616
> > > > > > Connection failed::Failed to create session factory
> > > > > >
> > > > > > --url: is a mandatory property!
> > > > > > Type in the broker URL for a retry (e.g. tcp://localhost:61616)
> > > > > > tcp://topsecretmachine.com:61616
> > > > > > Exception in thread "main" javax.jms.JMSException: Failed to
> create
> > > > > session
> > > > > > factory
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> > > > > > at
> > > > > >
> > > >
> > org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> > > > > > at
> > org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> > > > > > at
> > org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> > > > > > 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> > > > > > at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> > > > > > Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> > > > > > message=AMQ219007: Cannot connect to server(s). Tried with all
> > > > available
> > > > > > servers.]
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> > > > > > at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> > > > > > ... 12 more
> > > > > >
> > > > > > On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <
> jbertram@apache.org
> > >
> > > > > wrote:
> > > > > >
> > > > > > > Given that you have an instance of ActiveMQ Artemis on the same
> > > > machine
> > > > > > as
> > > > > > > the STOMP client I recommend you do something like this:
> > > > > > >
> > > > > > >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> > > > > > >   > ./artemis producer --url tcp://remote-machine:61616 --user
> > > > yourUser
> > > > > > > --password yourPassword
> > > > > > >
> > > > > > > Let me know if that works.
> > > > > > >
> > > > > > >
> > > > > > > Justin
> > > > > > >
> > > > > > > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> > > > > > christopherpisz@gmail.com
> > > > > > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > > I just followed the instructions on
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > > > > > > The broker is the default. Nothing is edited.
> > > > > > > >
> > > > > > > > "
> > > > > > > >
> > > > > > > > cd /var/lib
> > > > > > > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > > > > > > /var/lib/mybroker/bin/artemis run
> > > > > > > >
> > > > > > > >
> > > > > > > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <
> > tabish121@gmail.com
> > > >
> > > > > > wrote:
> > > > > > > >
> > > > > > > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > > > > > > What I need:
> > > > > > > > > > To determine if I can connect to activemq using stomp
> over
> > > > > > websockets
> > > > > > > > > from
> > > > > > > > > > a remote machine, with a client I wrote.
> > > > > > > > > >
> > > > > > > > > > What I did:
> > > > > > > > > > I wrote my own stomp over websockets client in C++ and
> > built
> > > it
> > > > > for
> > > > > > > > > > CentOS7, on my home computer.
> > > > > > > > > > I installed an ActiveMQ on a remote machine through ssh.
> > > > > > > > > > I created the ActiveMQ default broker according to the
> docs
> > > > > > > > > > I attempted to connect with my client
> > > > > > > > >
> > > > > > > > > Providing the broker configuration you used will help folks
> > > > answer
> > > > > > with
> > > > > > > > > insights into what might be wrong there.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > What happened:
> > > > > > > > > > Connection refused
> > > > > > > > > >
> > > > > > > > > > What I need:
> > > > > > > > > > To figure out why connection is refused
> > > > > > > > > >
> > > > > > > > > > Ideas of my own:
> > > > > > > > > > Does the client work on the local machine with the same
> > > version
> > > > > and
> > > > > > > > > > configuration of ActiveMQ? Yes
> > > > > > > > > > Does someone else's client connect to the remote
> machine? I
> > > > > dunno,
> > > > > > I
> > > > > > > > need
> > > > > > > > > > someone else's client
> > > > > > > > > > Maybe a client that uses something other than websockets
> > will
> > > > > prove
> > > > > > > > that
> > > > > > > > > > the "same origin policy" in the beginning of the email,
> is
> > > > indeed
> > > > > > the
> > > > > > > > > > problem? I dunno. I need a client that uses another
> > protocol.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <
> > > > > jbertram@apache.org
> > > > > > >
> > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > >> You're not really explaining what you need.
> > > > > > > > > >>
> > > > > > > > > >> You say you need "a built client that connects with a
> > > > different
> > > > > > > > > protocol."
> > > > > > > > > >> What exactly do you mean by "built"? Does it have to be
> a
> > > > > binary?
> > > > > > If
> > > > > > > > so,
> > > > > > > > > >> what platform does the binary need to be built for? If
> it
> > > > > doesn't
> > > > > > > have
> > > > > > > > > to
> > > > > > > > > >> be a binary would a python or perl script work? Also,
> what
> > > > > exactly
> > > > > > > do
> > > > > > > > > you
> > > > > > > > > >> mean by "different protocol"? Do you mean a different
> > > protocol
> > > > > > from
> > > > > > > > > STOMP?
> > > > > > > > > >> If so, I thought you were specifically trying to test
> > STOMP
> > > > > > > > connections.
> > > > > > > > > >> How would testing another protocol tell you if STOMP
> > > > connections
> > > > > > are
> > > > > > > > > >> working?
> > > > > > > > > >>
> > > > > > > > > >> It's hard (if not impossible) to provide clear guidance
> to
> > > > vague
> > > > > > > > > questions.
> > > > > > > > > >>
> > > > > > > > > >> If it helps, ActiveMQ Artemis ships with command-line
> > > clients
> > > > > you
> > > > > > > can
> > > > > > > > > use
> > > > > > > > > >> to quickly test a broker. Just type "./artemis help"
> from
> > > the
> > > > > > broker
> > > > > > > > > >> instance's "bin" directory and look for details about
> the
> > > > > > "producer"
> > > > > > > > and
> > > > > > > > > >> "consumer" commands.
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >> Justin
> > > > > > > > > >>
> > > > > > > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > > > > > > christopherpisz@gmail.com
> > > > > > > > > >> wrote:
> > > > > > > > > >>
> > > > > > > > > >>> Yes, I did a Google search.
> > > > > > > > > >>> It yields code examples or javascript libs. I need a
> > built
> > > > > client
> > > > > > > > that
> > > > > > > > > >>> connects with a different protocol, so I can quickly
> test
> > > > that
> > > > > > the
> > > > > > > > > server
> > > > > > > > > >>> will allow clients to connect at all.
> > > > > > > > > >>>
> > > > > > > > > >>>
> > > > > > > > > >>>
> > > > > > > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> > > > > > jbertram@apache.org
> > > > > > > >
> > > > > > > > > >> wrote:
> > > > > > > > > >>>> There are lots of STOMP clients for various platforms
> > > > written
> > > > > in
> > > > > > > > > >> various
> > > > > > > > > >>>> programming languages many of which do not use
> > websockets.
> > > > > What
> > > > > > > > > exactly
> > > > > > > > > >>> do
> > > > > > > > > >>>> you need? Did you try doing an Internet search?
> > > > > > > > > >>>>
> > > > > > > > > >>>>
> > > > > > > > > >>>> Justin
> > > > > > > > > >>>>
> > > > > > > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > > > > > > >>> christopherpisz@gmail.com
> > > > > > > > > >>>> wrote:
> > > > > > > > > >>>>
> > > > > > > > > >>>>> So I installed ActiveMQ on a remote machine this
> > morning.
> > > > > > > > > >>>>> Created the default broker.
> > > > > > > > > >>>>> Attempted to connect with the client I wrote using
> > > > > websockets.
> > > > > > > > > >>>>> Connection is refused.
> > > > > > > > > >>>>>
> > > > > > > > > >>>>> I then tried running the
> > > > > > > examples/protocols/stomp/stomp-websockets
> > > > > > > > > >>>> example
> > > > > > > > > >>>>> Attempted to connect with the client I write using
> > > > websockets
> > > > > > > > > >>>>> Connection is refused.
> > > > > > > > > >>>>> Attempted to connect using the index.html from my
> > machine
> > > > > > rather
> > > > > > > > than
> > > > > > > > > >>> the
> > > > > > > > > >>>>> remote(as localhost there)
> > > > > > > > > >>>>> Connection refused.
> > > > > > > > > >>>>>
> > > > > > > > > >>>>> I don't know what to do.
> > > > > > > > > >>>>> Is there another premade client I can connect with
> that
> > > > > doesn't
> > > > > > > use
> > > > > > > > > >>>>> websockets, so I can at least narrow it down and see
> if
> > > the
> > > > > > > server
> > > > > > > > > >>> works
> > > > > > > > > >>>> at
> > > > > > > > > >>>>> all?
> > > > > > > > > >>>>> Any other suggestions?
> > > > > > > > > >>>>>
> > > > > > > > > >>>>>
> > > > > > > > > >>>>>
> > > > > > > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > > > > > > >>> wayne.robinson@gmail.com
> > > > > > > > > >>>>> wrote:
> > > > > > > > > >>>>>
> > > > > > > > > >>>>>> Websockets don’t use the same-origin policies that
> > other
> > > > > AJAX
> > > > > > > > > >>> requests
> > > > > > > > > >>>>> do.
> > > > > > > > > >>>>>> You will most likely need to serve them via TLS to
> > > prevent
> > > > > > > browser
> > > > > > > > > >>>>> errors,
> > > > > > > > > >>>>>> but there’s nothing special you need to do to setup
> > > CORS.
> > > > > > > > > >>>>>>
> > > > > > > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > > > > > > >>>>>> christopherpisz@gmail.com>
> > > > > > > > > >>>>>> wrote:
> > > > > > > > > >>>>>>
> > > > > > > > > >>>>>>> I have a process that runs in California that wants
> > to
> > > > talk
> > > > > > to
> > > > > > > a
> > > > > > > > > >>>>> process
> > > > > > > > > >>>>>> in
> > > > > > > > > >>>>>>> New York, using Stomp over Websockets.
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> Also note that my process is not a web app, but I
> > > > > > implemented a
> > > > > > > > > >>> stomp
> > > > > > > > > >>>>>> over
> > > > > > > > > >>>>>>> websocket client in C++, in order to connect things
> > up
> > > to
> > > > > my
> > > > > > > > > >>> backend.
> > > > > > > > > >>>>>> Maybe
> > > > > > > > > >>>>>>> this was or wasn't a good idea. So, I want my
> client
> > to
> > > > > talk
> > > > > > to
> > > > > > > > > >> the
> > > > > > > > > >>>>>> server
> > > > > > > > > >>>>>>> and subscribe, where their client pushed messages.
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> I was implementing my own server when I saw that
> > > ApacheMQ
> > > > > > > > > >> supported
> > > > > > > > > >>>>> Stomp
> > > > > > > > > >>>>>>> over Websockets. So, I started reading the docs.
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> It says:
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> One thing worth noting is that web sockets (just as
> > > Ajax)
> > > > > > > > > >>> implements
> > > > > > > > > >>>> ?
> > > > > > > > > >>>>>>> the same origin policy, so you can access only
> > brokers
> > > > > > running
> > > > > > > on
> > > > > > > > > >>>> the >
> > > > > > > > > >>>>>>> same host as the web application running the
> client.
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> Is this a limitation of the server or the web
> client?
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> With that limitation, if I understand right, the
> > server
> > > > is
> > > > > > not
> > > > > > > > > >>> going
> > > > > > > > > >>>> to
> > > > > > > > > >>>>>>> accept websocket connections from a client, of any
> > > kind,
> > > > > that
> > > > > > > is
> > > > > > > > > >>> not
> > > > > > > > > >>>> on
> > > > > > > > > >>>>>> the
> > > > > > > > > >>>>>>> same machine?
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> I am not sure I see the point of that...
> > > > > > > > > >>>>>>>
> > > > > > > > > >>>>>>> If that is indeed its meaning, then how do I get
> > around
> > > > it
> > > > > in
> > > > > > > > > >> order
> > > > > > > > > >>>> to
> > > > > > > > > >>>>>>> implement my scenario?
> > > > > > > > > >>>>>>>
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Tim Bish
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Justin Bertram <jb...@apache.org>.
> Also, have you confirmed that Artemis is actually listening on the port
you're trying to use?

The log he pasted indicates that the broker is indeed listening on 61616:

  INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL
Acceptor at 0.0.0.0:61616 for protocols
[CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]

Using netstat may be helpful to confirm beyond all doubt, though.


Justin

On Fri, Aug 7, 2020 at 8:51 PM Tim Bain <tb...@alumni.duke.edu> wrote:

> One way to test if it's a firewall issue is to try to open a raw TCP socket
> to the port and see if you can establish a TCP connection and pass data. It
> doesn't need to be compliant with the higher-level protocols (HTTP, STOMP),
> it just needs to confirm that bytes are successfully passed. If bytes pass,
> it's likely not a firewall/network issue; if nothing gets through or the
> TCP connection fails outright, then it's likely firewall or network
> routing.
>
> It's been a while since I've done this, but I think both telnet and netcat
> (nc) will let you do this type of test. I'm sure there are other ways to do
> it, too.
>
> Also, have you confirmed that Artemis is actually listening on the port
> you're trying to use? You can check via sudo netstat -antp | grep LISTEN |
> grep 61616 on the machine hosting the broker.
>
> Tim
>
> On Fri, Aug 7, 2020, 4:39 PM Justin Bertram <jb...@apache.org> wrote:
>
> > Given that the broker is up and running fine on the remote machine I
> would
> > say there's some kind of environmental or network issue preventing
> > communication from your local machine and the remote machine on port
> 61616.
> > Perhaps a firewall is blocking that port.
> >
> >
> > Justin
> >
> > On Fri, Aug 7, 2020 at 4:18 PM Christopher Pisz <
> christopherpisz@gmail.com
> > >
> > wrote:
> >
> > > Log looks good to me:
> > >
> > > 2020-08-07 15:22:40,666 INFO
> > >  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000:
> Starting
> > > ActiveMQ Artemis Server
> > > 2020-08-07 15:22:40,713 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221000: live Message Broker is starting with configuration Broker
> > > Configuration
> > >
> > >
> >
> (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
> > > 2020-08-07 15:22:40,759 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221012: Using AIO Journal
> > > 2020-08-07 15:22:40,798 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size
> > > (-Xmx). being defined as 1,073,741,824
> > > 2020-08-07 15:22:40,822 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221043: Protocol module found: [artemis-server]. Adding protocol
> > support
> > > for: CORE
> > > 2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding
> > protocol
> > > support for: AMQP
> > > 2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding
> > > protocol support for: HORNETQ
> > > 2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding
> > protocol
> > > support for: MQTT
> > > 2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding
> > > protocol support for: OPENWIRE
> > > 2020-08-07 15:22:40,825 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding
> > protocol
> > > support for: STOMP
> > > 2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221034: Waiting indefinitely to obtain live lock
> > > 2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221035: Live Server Obtained live lock
> > > 2020-08-07 15:22:40,979 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221080: Deploying address DLQ supporting [ANYCAST]
> > > 2020-08-07 15:22:40,993 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
> > > 2020-08-07 15:22:41,048 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
> > > 2020-08-07 15:22:41,050 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
> > > 2020-08-07 15:22:41,461 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols
> > > [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> > > 2020-08-07 15:22:41,464 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols
> > > [HORNETQ,STOMP]
> > > 2020-08-07 15:22:41,467 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
> > > 2020-08-07 15:22:41,469 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
> > > 2020-08-07 15:22:41,479 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols
> [STOMP]
> > > 2020-08-07 15:22:41,481 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221007: Server is now live
> > > 2020-08-07 15:22:41,482 INFO  [org.apache.activemq.artemis.core.server]
> > > AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0
> > [0.0.0.0,
> > > nodeID=5c5d5e87-d8e3-11ea-8b59-b42e99360c2c]
> > > 2020-08-07 15:22:41,827 INFO
> > >  [org.apache.activemq.hawtio.branding.PluginContextListener]
> Initialized
> > > activemq-branding plugin
> > > 2020-08-07 15:22:41,879 INFO
> > >  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized
> > > artemis-plugin plugin
> > > 2020-08-07 15:22:42,326 INFO  [io.hawt.HawtioContextListener]
> > Initialising
> > > hawtio services
> > > 2020-08-07 15:22:42,348 INFO  [io.hawt.system.ConfigManager]
> > Configuration
> > > will be discovered via system properties
> > > 2020-08-07 15:22:42,352 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to
> > > hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was hawt
> > > like
> > > me? ;-)
> > > 2020-08-07 15:22:42,361 INFO  [io.hawt.jmx.UploadManager] Using file
> > upload
> > > directory: /var/lib/testbroker/tmp/uploads
> > > 2020-08-07 15:22:42,383 INFO  [io.hawt.web.AuthenticationFilter]
> Starting
> > > hawtio authentication filter, JAAS realm: "activemq" authorized
> role(s):
> > > "amq" role principal classes:
> > > "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
> > > 2020-08-07 15:22:42,406 INFO
> [io.hawt.web.JolokiaConfiguredAgentServlet]
> > > Jolokia overridden property: [key=policyLocation,
> > > value=file:/var/lib/testbroker/etc/jolokia-access.xml]
> > > 2020-08-07 15:22:42,430 INFO  [io.hawt.web.RBACMBeanInvoker] Using
> MBean
> > > [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for
> > role
> > > based access control
> > > 2020-08-07 15:22:42,544 INFO  [io.hawt.system.ProxyWhitelist] Initial
> > proxy
> > > whitelist: [localhost, 127.0.0.1, 10.105.1.162,
> > > hansel04.alertinnovation.com
> > > ]
> > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241001:
> > HTTP
> > > Server started at http://localhost:8161
> > > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241002:
> > > Artemis Jolokia REST API available at
> > > http://localhost:8161/console/jolokia
> > > 2020-08-07 <http://localhost:8161/console/jolokia2020-08-07>
> > 15:22:42,786
> > > INFO  [org.apache.activemq.artemis] AMQ241004:
> > > Artemis Console available at http://localhost:8161/console
> > >
> > > Trying producer command on the remote machine itself:
> > > cd /opt/apache-artemis-2.14.0/bin/
> > > ./artemis producer --url tcp://localhost:61616 --user username
> --password
> > > password
> > > Connection brokerURL = tcp://localhost:61616
> > > Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed
> time
> > > ...
> > >
> > > Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
> > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 1 s
> > > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second :
> > 1509
> > > milli seconds
> > >
> > >
> > >
> > > On Fri, Aug 7, 2020 at 3:41 PM Justin Bertram <jb...@apache.org>
> > wrote:
> > >
> > > > Did you check artemis.log to ensure the broker actually started up
> > > without
> > > > errors?
> > > >
> > > > Also, did you run the "artemis producer" command on the remote
> machine
> > to
> > > > make sure the broker is actually working?
> > > >
> > > >
> > > > Justin
> > > >
> > > > On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <
> > > christopherpisz@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > From Remote Machine:
> > > > > cd /var/lib
> > > > > sudo su
> > > > > /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> > > > > Creating ActiveMQ Artemis instance at: /var/lib/testbroker
> > > > >
> > > > > --user: is a mandatory property!
> > > > > Please provide the default username:
> > > > > user
> > > > >
> > > > > --password: is mandatory with this configuration:
> > > > > Please provide the default password:
> > > > >
> > > > >
> > > > > --allow-anonymous | --require-login: is a mandatory property!
> > > > > Allow anonymous access?, valid values are Y,N,True,False
> > > > > Y
> > > > >
> > > > > Auto tuning journal ...
> > > > > done! Your system can make 62.5 writes per millisecond, your
> > > > > journal-buffer-timeout will be 16000
> > > > >
> > > > > You can now start the broker by executing:
> > > > >
> > > > >    "/var/lib/testbroker/bin/artemis" run
> > > > >
> > > > > Or you can run the broker in the background using:
> > > > >
> > > > >    "/var/lib/testbroker/bin/artemis-service" start
> > > > >
> > > > > "/var/lib/testbroker/bin/artemis-service" start
> > > > > Starting artemis-service
> > > > > artemis-service is now running (21742)
> > > > >
> > > > > From Local Machine:
> > > > > ping topsecretmachine.com
> > > > > PING topsecretmachine.com (someip) 56(84) bytes of data.
> > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63
> > > time=68.3
> > > > > ms
> > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63
> > > time=65.6
> > > > > ms
> > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63
> > > time=69.0
> > > > > ms
> > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63
> > > time=66.4
> > > > > ms
> > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63
> > > time=65.7
> > > > > ms
> > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63
> > > time=71.7
> > > > > ms
> > > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63
> > > time=67.2
> > > > > ms
> > > > > ^C
> > > > > --- topsecretmachine.com ping statistics ---
> > > > > 7 packets transmitted, 7 received, 0% packet loss, time 6010ms
> > > > > rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> > > > > [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> > > > > [cpisz@localhost bin]$ ./artemis producer --url tcp://
> > > > > topsecretmachine.com:61616 --user user --password password
> > > > > Connection brokerURL = tcp://topsecretmachine.com:61616
> > > > > Connection failed::Failed to create session factory
> > > > >
> > > > > --url: is a mandatory property!
> > > > > Type in the broker URL for a retry (e.g. tcp://localhost:61616)
> > > > > tcp://topsecretmachine.com:61616
> > > > > Exception in thread "main" javax.jms.JMSException: Failed to create
> > > > session
> > > > > factory
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> > > > > at
> > > > >
> > >
> org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> > > > > at
> org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> > > > > at
> org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> > > > > 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> > > > > at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> > > > > Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> > > > > message=AMQ219007: Cannot connect to server(s). Tried with all
> > > available
> > > > > servers.]
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> > > > > at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> > > > > ... 12 more
> > > > >
> > > > > On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <jbertram@apache.org
> >
> > > > wrote:
> > > > >
> > > > > > Given that you have an instance of ActiveMQ Artemis on the same
> > > machine
> > > > > as
> > > > > > the STOMP client I recommend you do something like this:
> > > > > >
> > > > > >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> > > > > >   > ./artemis producer --url tcp://remote-machine:61616 --user
> > > yourUser
> > > > > > --password yourPassword
> > > > > >
> > > > > > Let me know if that works.
> > > > > >
> > > > > >
> > > > > > Justin
> > > > > >
> > > > > > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> > > > > christopherpisz@gmail.com
> > > > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > I just followed the instructions on
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > > > > > The broker is the default. Nothing is edited.
> > > > > > >
> > > > > > > "
> > > > > > >
> > > > > > > cd /var/lib
> > > > > > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > > > > > /var/lib/mybroker/bin/artemis run
> > > > > > >
> > > > > > >
> > > > > > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <
> tabish121@gmail.com
> > >
> > > > > wrote:
> > > > > > >
> > > > > > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > > > > > What I need:
> > > > > > > > > To determine if I can connect to activemq using stomp over
> > > > > websockets
> > > > > > > > from
> > > > > > > > > a remote machine, with a client I wrote.
> > > > > > > > >
> > > > > > > > > What I did:
> > > > > > > > > I wrote my own stomp over websockets client in C++ and
> built
> > it
> > > > for
> > > > > > > > > CentOS7, on my home computer.
> > > > > > > > > I installed an ActiveMQ on a remote machine through ssh.
> > > > > > > > > I created the ActiveMQ default broker according to the docs
> > > > > > > > > I attempted to connect with my client
> > > > > > > >
> > > > > > > > Providing the broker configuration you used will help folks
> > > answer
> > > > > with
> > > > > > > > insights into what might be wrong there.
> > > > > > > >
> > > > > > > >
> > > > > > > > > What happened:
> > > > > > > > > Connection refused
> > > > > > > > >
> > > > > > > > > What I need:
> > > > > > > > > To figure out why connection is refused
> > > > > > > > >
> > > > > > > > > Ideas of my own:
> > > > > > > > > Does the client work on the local machine with the same
> > version
> > > > and
> > > > > > > > > configuration of ActiveMQ? Yes
> > > > > > > > > Does someone else's client connect to the remote machine? I
> > > > dunno,
> > > > > I
> > > > > > > need
> > > > > > > > > someone else's client
> > > > > > > > > Maybe a client that uses something other than websockets
> will
> > > > prove
> > > > > > > that
> > > > > > > > > the "same origin policy" in the beginning of the email, is
> > > indeed
> > > > > the
> > > > > > > > > problem? I dunno. I need a client that uses another
> protocol.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <
> > > > jbertram@apache.org
> > > > > >
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > >> You're not really explaining what you need.
> > > > > > > > >>
> > > > > > > > >> You say you need "a built client that connects with a
> > > different
> > > > > > > > protocol."
> > > > > > > > >> What exactly do you mean by "built"? Does it have to be a
> > > > binary?
> > > > > If
> > > > > > > so,
> > > > > > > > >> what platform does the binary need to be built for? If it
> > > > doesn't
> > > > > > have
> > > > > > > > to
> > > > > > > > >> be a binary would a python or perl script work? Also, what
> > > > exactly
> > > > > > do
> > > > > > > > you
> > > > > > > > >> mean by "different protocol"? Do you mean a different
> > protocol
> > > > > from
> > > > > > > > STOMP?
> > > > > > > > >> If so, I thought you were specifically trying to test
> STOMP
> > > > > > > connections.
> > > > > > > > >> How would testing another protocol tell you if STOMP
> > > connections
> > > > > are
> > > > > > > > >> working?
> > > > > > > > >>
> > > > > > > > >> It's hard (if not impossible) to provide clear guidance to
> > > vague
> > > > > > > > questions.
> > > > > > > > >>
> > > > > > > > >> If it helps, ActiveMQ Artemis ships with command-line
> > clients
> > > > you
> > > > > > can
> > > > > > > > use
> > > > > > > > >> to quickly test a broker. Just type "./artemis help" from
> > the
> > > > > broker
> > > > > > > > >> instance's "bin" directory and look for details about the
> > > > > "producer"
> > > > > > > and
> > > > > > > > >> "consumer" commands.
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >> Justin
> > > > > > > > >>
> > > > > > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > > > > > christopherpisz@gmail.com
> > > > > > > > >> wrote:
> > > > > > > > >>
> > > > > > > > >>> Yes, I did a Google search.
> > > > > > > > >>> It yields code examples or javascript libs. I need a
> built
> > > > client
> > > > > > > that
> > > > > > > > >>> connects with a different protocol, so I can quickly test
> > > that
> > > > > the
> > > > > > > > server
> > > > > > > > >>> will allow clients to connect at all.
> > > > > > > > >>>
> > > > > > > > >>>
> > > > > > > > >>>
> > > > > > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> > > > > jbertram@apache.org
> > > > > > >
> > > > > > > > >> wrote:
> > > > > > > > >>>> There are lots of STOMP clients for various platforms
> > > written
> > > > in
> > > > > > > > >> various
> > > > > > > > >>>> programming languages many of which do not use
> websockets.
> > > > What
> > > > > > > > exactly
> > > > > > > > >>> do
> > > > > > > > >>>> you need? Did you try doing an Internet search?
> > > > > > > > >>>>
> > > > > > > > >>>>
> > > > > > > > >>>> Justin
> > > > > > > > >>>>
> > > > > > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > > > > > >>> christopherpisz@gmail.com
> > > > > > > > >>>> wrote:
> > > > > > > > >>>>
> > > > > > > > >>>>> So I installed ActiveMQ on a remote machine this
> morning.
> > > > > > > > >>>>> Created the default broker.
> > > > > > > > >>>>> Attempted to connect with the client I wrote using
> > > > websockets.
> > > > > > > > >>>>> Connection is refused.
> > > > > > > > >>>>>
> > > > > > > > >>>>> I then tried running the
> > > > > > examples/protocols/stomp/stomp-websockets
> > > > > > > > >>>> example
> > > > > > > > >>>>> Attempted to connect with the client I write using
> > > websockets
> > > > > > > > >>>>> Connection is refused.
> > > > > > > > >>>>> Attempted to connect using the index.html from my
> machine
> > > > > rather
> > > > > > > than
> > > > > > > > >>> the
> > > > > > > > >>>>> remote(as localhost there)
> > > > > > > > >>>>> Connection refused.
> > > > > > > > >>>>>
> > > > > > > > >>>>> I don't know what to do.
> > > > > > > > >>>>> Is there another premade client I can connect with that
> > > > doesn't
> > > > > > use
> > > > > > > > >>>>> websockets, so I can at least narrow it down and see if
> > the
> > > > > > server
> > > > > > > > >>> works
> > > > > > > > >>>> at
> > > > > > > > >>>>> all?
> > > > > > > > >>>>> Any other suggestions?
> > > > > > > > >>>>>
> > > > > > > > >>>>>
> > > > > > > > >>>>>
> > > > > > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > > > > > >>> wayne.robinson@gmail.com
> > > > > > > > >>>>> wrote:
> > > > > > > > >>>>>
> > > > > > > > >>>>>> Websockets don’t use the same-origin policies that
> other
> > > > AJAX
> > > > > > > > >>> requests
> > > > > > > > >>>>> do.
> > > > > > > > >>>>>> You will most likely need to serve them via TLS to
> > prevent
> > > > > > browser
> > > > > > > > >>>>> errors,
> > > > > > > > >>>>>> but there’s nothing special you need to do to setup
> > CORS.
> > > > > > > > >>>>>>
> > > > > > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > > > > > >>>>>> christopherpisz@gmail.com>
> > > > > > > > >>>>>> wrote:
> > > > > > > > >>>>>>
> > > > > > > > >>>>>>> I have a process that runs in California that wants
> to
> > > talk
> > > > > to
> > > > > > a
> > > > > > > > >>>>> process
> > > > > > > > >>>>>> in
> > > > > > > > >>>>>>> New York, using Stomp over Websockets.
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> Also note that my process is not a web app, but I
> > > > > implemented a
> > > > > > > > >>> stomp
> > > > > > > > >>>>>> over
> > > > > > > > >>>>>>> websocket client in C++, in order to connect things
> up
> > to
> > > > my
> > > > > > > > >>> backend.
> > > > > > > > >>>>>> Maybe
> > > > > > > > >>>>>>> this was or wasn't a good idea. So, I want my client
> to
> > > > talk
> > > > > to
> > > > > > > > >> the
> > > > > > > > >>>>>> server
> > > > > > > > >>>>>>> and subscribe, where their client pushed messages.
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> I was implementing my own server when I saw that
> > ApacheMQ
> > > > > > > > >> supported
> > > > > > > > >>>>> Stomp
> > > > > > > > >>>>>>> over Websockets. So, I started reading the docs.
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> It says:
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> One thing worth noting is that web sockets (just as
> > Ajax)
> > > > > > > > >>> implements
> > > > > > > > >>>> ?
> > > > > > > > >>>>>>> the same origin policy, so you can access only
> brokers
> > > > > running
> > > > > > on
> > > > > > > > >>>> the >
> > > > > > > > >>>>>>> same host as the web application running the client.
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> Is this a limitation of the server or the web client?
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> With that limitation, if I understand right, the
> server
> > > is
> > > > > not
> > > > > > > > >>> going
> > > > > > > > >>>> to
> > > > > > > > >>>>>>> accept websocket connections from a client, of any
> > kind,
> > > > that
> > > > > > is
> > > > > > > > >>> not
> > > > > > > > >>>> on
> > > > > > > > >>>>>> the
> > > > > > > > >>>>>>> same machine?
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> I am not sure I see the point of that...
> > > > > > > > >>>>>>>
> > > > > > > > >>>>>>> If that is indeed its meaning, then how do I get
> around
> > > it
> > > > in
> > > > > > > > >> order
> > > > > > > > >>>> to
> > > > > > > > >>>>>>> implement my scenario?
> > > > > > > > >>>>>>>
> > > > > > > >
> > > > > > > > --
> > > > > > > > Tim Bish
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Tim Bain <tb...@alumni.duke.edu>.
One way to test if it's a firewall issue is to try to open a raw TCP socket
to the port and see if you can establish a TCP connection and pass data. It
doesn't need to be compliant with the higher-level protocols (HTTP, STOMP),
it just needs to confirm that bytes are successfully passed. If bytes pass,
it's likely not a firewall/network issue; if nothing gets through or the
TCP connection fails outright, then it's likely firewall or network routing.

It's been a while since I've done this, but I think both telnet and netcat
(nc) will let you do this type of test. I'm sure there are other ways to do
it, too.

Also, have you confirmed that Artemis is actually listening on the port
you're trying to use? You can check via sudo netstat -antp | grep LISTEN |
grep 61616 on the machine hosting the broker.

Tim

On Fri, Aug 7, 2020, 4:39 PM Justin Bertram <jb...@apache.org> wrote:

> Given that the broker is up and running fine on the remote machine I would
> say there's some kind of environmental or network issue preventing
> communication from your local machine and the remote machine on port 61616.
> Perhaps a firewall is blocking that port.
>
>
> Justin
>
> On Fri, Aug 7, 2020 at 4:18 PM Christopher Pisz <christopherpisz@gmail.com
> >
> wrote:
>
> > Log looks good to me:
> >
> > 2020-08-07 15:22:40,666 INFO
> >  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting
> > ActiveMQ Artemis Server
> > 2020-08-07 15:22:40,713 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221000: live Message Broker is starting with configuration Broker
> > Configuration
> >
> >
> (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
> > 2020-08-07 15:22:40,759 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221012: Using AIO Journal
> > 2020-08-07 15:22:40,798 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size
> > (-Xmx). being defined as 1,073,741,824
> > 2020-08-07 15:22:40,822 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221043: Protocol module found: [artemis-server]. Adding protocol
> support
> > for: CORE
> > 2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding
> protocol
> > support for: AMQP
> > 2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding
> > protocol support for: HORNETQ
> > 2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding
> protocol
> > support for: MQTT
> > 2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding
> > protocol support for: OPENWIRE
> > 2020-08-07 15:22:40,825 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding
> protocol
> > support for: STOMP
> > 2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221034: Waiting indefinitely to obtain live lock
> > 2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221035: Live Server Obtained live lock
> > 2020-08-07 15:22:40,979 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221080: Deploying address DLQ supporting [ANYCAST]
> > 2020-08-07 15:22:40,993 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
> > 2020-08-07 15:22:41,048 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
> > 2020-08-07 15:22:41,050 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
> > 2020-08-07 15:22:41,461 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols
> > [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> > 2020-08-07 15:22:41,464 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols
> > [HORNETQ,STOMP]
> > 2020-08-07 15:22:41,467 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
> > 2020-08-07 15:22:41,469 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
> > 2020-08-07 15:22:41,479 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols [STOMP]
> > 2020-08-07 15:22:41,481 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221007: Server is now live
> > 2020-08-07 15:22:41,482 INFO  [org.apache.activemq.artemis.core.server]
> > AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0
> [0.0.0.0,
> > nodeID=5c5d5e87-d8e3-11ea-8b59-b42e99360c2c]
> > 2020-08-07 15:22:41,827 INFO
> >  [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized
> > activemq-branding plugin
> > 2020-08-07 15:22:41,879 INFO
> >  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized
> > artemis-plugin plugin
> > 2020-08-07 15:22:42,326 INFO  [io.hawt.HawtioContextListener]
> Initialising
> > hawtio services
> > 2020-08-07 15:22:42,348 INFO  [io.hawt.system.ConfigManager]
> Configuration
> > will be discovered via system properties
> > 2020-08-07 15:22:42,352 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to
> > hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was hawt
> > like
> > me? ;-)
> > 2020-08-07 15:22:42,361 INFO  [io.hawt.jmx.UploadManager] Using file
> upload
> > directory: /var/lib/testbroker/tmp/uploads
> > 2020-08-07 15:22:42,383 INFO  [io.hawt.web.AuthenticationFilter] Starting
> > hawtio authentication filter, JAAS realm: "activemq" authorized role(s):
> > "amq" role principal classes:
> > "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
> > 2020-08-07 15:22:42,406 INFO  [io.hawt.web.JolokiaConfiguredAgentServlet]
> > Jolokia overridden property: [key=policyLocation,
> > value=file:/var/lib/testbroker/etc/jolokia-access.xml]
> > 2020-08-07 15:22:42,430 INFO  [io.hawt.web.RBACMBeanInvoker] Using MBean
> > [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for
> role
> > based access control
> > 2020-08-07 15:22:42,544 INFO  [io.hawt.system.ProxyWhitelist] Initial
> proxy
> > whitelist: [localhost, 127.0.0.1, 10.105.1.162,
> > hansel04.alertinnovation.com
> > ]
> > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241001:
> HTTP
> > Server started at http://localhost:8161
> > 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241002:
> > Artemis Jolokia REST API available at
> > http://localhost:8161/console/jolokia
> > 2020-08-07 <http://localhost:8161/console/jolokia2020-08-07>
> 15:22:42,786
> > INFO  [org.apache.activemq.artemis] AMQ241004:
> > Artemis Console available at http://localhost:8161/console
> >
> > Trying producer command on the remote machine itself:
> > cd /opt/apache-artemis-2.14.0/bin/
> > ./artemis producer --url tcp://localhost:61616 --user username --password
> > password
> > Connection brokerURL = tcp://localhost:61616
> > Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed time
> > ...
> >
> > Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
> > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 1 s
> > Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second :
> 1509
> > milli seconds
> >
> >
> >
> > On Fri, Aug 7, 2020 at 3:41 PM Justin Bertram <jb...@apache.org>
> wrote:
> >
> > > Did you check artemis.log to ensure the broker actually started up
> > without
> > > errors?
> > >
> > > Also, did you run the "artemis producer" command on the remote machine
> to
> > > make sure the broker is actually working?
> > >
> > >
> > > Justin
> > >
> > > On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <
> > christopherpisz@gmail.com
> > > >
> > > wrote:
> > >
> > > > From Remote Machine:
> > > > cd /var/lib
> > > > sudo su
> > > > /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> > > > Creating ActiveMQ Artemis instance at: /var/lib/testbroker
> > > >
> > > > --user: is a mandatory property!
> > > > Please provide the default username:
> > > > user
> > > >
> > > > --password: is mandatory with this configuration:
> > > > Please provide the default password:
> > > >
> > > >
> > > > --allow-anonymous | --require-login: is a mandatory property!
> > > > Allow anonymous access?, valid values are Y,N,True,False
> > > > Y
> > > >
> > > > Auto tuning journal ...
> > > > done! Your system can make 62.5 writes per millisecond, your
> > > > journal-buffer-timeout will be 16000
> > > >
> > > > You can now start the broker by executing:
> > > >
> > > >    "/var/lib/testbroker/bin/artemis" run
> > > >
> > > > Or you can run the broker in the background using:
> > > >
> > > >    "/var/lib/testbroker/bin/artemis-service" start
> > > >
> > > > "/var/lib/testbroker/bin/artemis-service" start
> > > > Starting artemis-service
> > > > artemis-service is now running (21742)
> > > >
> > > > From Local Machine:
> > > > ping topsecretmachine.com
> > > > PING topsecretmachine.com (someip) 56(84) bytes of data.
> > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63
> > time=68.3
> > > > ms
> > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63
> > time=65.6
> > > > ms
> > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63
> > time=69.0
> > > > ms
> > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63
> > time=66.4
> > > > ms
> > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63
> > time=65.7
> > > > ms
> > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63
> > time=71.7
> > > > ms
> > > > 64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63
> > time=67.2
> > > > ms
> > > > ^C
> > > > --- topsecretmachine.com ping statistics ---
> > > > 7 packets transmitted, 7 received, 0% packet loss, time 6010ms
> > > > rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> > > > [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> > > > [cpisz@localhost bin]$ ./artemis producer --url tcp://
> > > > topsecretmachine.com:61616 --user user --password password
> > > > Connection brokerURL = tcp://topsecretmachine.com:61616
> > > > Connection failed::Failed to create session factory
> > > >
> > > > --url: is a mandatory property!
> > > > Type in the broker URL for a retry (e.g. tcp://localhost:61616)
> > > > tcp://topsecretmachine.com:61616
> > > > Exception in thread "main" javax.jms.JMSException: Failed to create
> > > session
> > > > factory
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> > > > at
> > > >
> > org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> > > > at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> > > > at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> > > > 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> > > > at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> > > > Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> > > > message=AMQ219007: Cannot connect to server(s). Tried with all
> > available
> > > > servers.]
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> > > > ... 12 more
> > > >
> > > > On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <jb...@apache.org>
> > > wrote:
> > > >
> > > > > Given that you have an instance of ActiveMQ Artemis on the same
> > machine
> > > > as
> > > > > the STOMP client I recommend you do something like this:
> > > > >
> > > > >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> > > > >   > ./artemis producer --url tcp://remote-machine:61616 --user
> > yourUser
> > > > > --password yourPassword
> > > > >
> > > > > Let me know if that works.
> > > > >
> > > > >
> > > > > Justin
> > > > >
> > > > > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> > > > christopherpisz@gmail.com
> > > > > >
> > > > > wrote:
> > > > >
> > > > > > I just followed the instructions on
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > > > > The broker is the default. Nothing is edited.
> > > > > >
> > > > > > "
> > > > > >
> > > > > > cd /var/lib
> > > > > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > > > > /var/lib/mybroker/bin/artemis run
> > > > > >
> > > > > >
> > > > > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <tabish121@gmail.com
> >
> > > > wrote:
> > > > > >
> > > > > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > > > > What I need:
> > > > > > > > To determine if I can connect to activemq using stomp over
> > > > websockets
> > > > > > > from
> > > > > > > > a remote machine, with a client I wrote.
> > > > > > > >
> > > > > > > > What I did:
> > > > > > > > I wrote my own stomp over websockets client in C++ and built
> it
> > > for
> > > > > > > > CentOS7, on my home computer.
> > > > > > > > I installed an ActiveMQ on a remote machine through ssh.
> > > > > > > > I created the ActiveMQ default broker according to the docs
> > > > > > > > I attempted to connect with my client
> > > > > > >
> > > > > > > Providing the broker configuration you used will help folks
> > answer
> > > > with
> > > > > > > insights into what might be wrong there.
> > > > > > >
> > > > > > >
> > > > > > > > What happened:
> > > > > > > > Connection refused
> > > > > > > >
> > > > > > > > What I need:
> > > > > > > > To figure out why connection is refused
> > > > > > > >
> > > > > > > > Ideas of my own:
> > > > > > > > Does the client work on the local machine with the same
> version
> > > and
> > > > > > > > configuration of ActiveMQ? Yes
> > > > > > > > Does someone else's client connect to the remote machine? I
> > > dunno,
> > > > I
> > > > > > need
> > > > > > > > someone else's client
> > > > > > > > Maybe a client that uses something other than websockets will
> > > prove
> > > > > > that
> > > > > > > > the "same origin policy" in the beginning of the email, is
> > indeed
> > > > the
> > > > > > > > problem? I dunno. I need a client that uses another protocol.
> > > > > > > >
> > > > > > > >
> > > > > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <
> > > jbertram@apache.org
> > > > >
> > > > > > > wrote:
> > > > > > > >
> > > > > > > >> You're not really explaining what you need.
> > > > > > > >>
> > > > > > > >> You say you need "a built client that connects with a
> > different
> > > > > > > protocol."
> > > > > > > >> What exactly do you mean by "built"? Does it have to be a
> > > binary?
> > > > If
> > > > > > so,
> > > > > > > >> what platform does the binary need to be built for? If it
> > > doesn't
> > > > > have
> > > > > > > to
> > > > > > > >> be a binary would a python or perl script work? Also, what
> > > exactly
> > > > > do
> > > > > > > you
> > > > > > > >> mean by "different protocol"? Do you mean a different
> protocol
> > > > from
> > > > > > > STOMP?
> > > > > > > >> If so, I thought you were specifically trying to test STOMP
> > > > > > connections.
> > > > > > > >> How would testing another protocol tell you if STOMP
> > connections
> > > > are
> > > > > > > >> working?
> > > > > > > >>
> > > > > > > >> It's hard (if not impossible) to provide clear guidance to
> > vague
> > > > > > > questions.
> > > > > > > >>
> > > > > > > >> If it helps, ActiveMQ Artemis ships with command-line
> clients
> > > you
> > > > > can
> > > > > > > use
> > > > > > > >> to quickly test a broker. Just type "./artemis help" from
> the
> > > > broker
> > > > > > > >> instance's "bin" directory and look for details about the
> > > > "producer"
> > > > > > and
> > > > > > > >> "consumer" commands.
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> Justin
> > > > > > > >>
> > > > > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > > > > christopherpisz@gmail.com
> > > > > > > >> wrote:
> > > > > > > >>
> > > > > > > >>> Yes, I did a Google search.
> > > > > > > >>> It yields code examples or javascript libs. I need a built
> > > client
> > > > > > that
> > > > > > > >>> connects with a different protocol, so I can quickly test
> > that
> > > > the
> > > > > > > server
> > > > > > > >>> will allow clients to connect at all.
> > > > > > > >>>
> > > > > > > >>>
> > > > > > > >>>
> > > > > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> > > > jbertram@apache.org
> > > > > >
> > > > > > > >> wrote:
> > > > > > > >>>> There are lots of STOMP clients for various platforms
> > written
> > > in
> > > > > > > >> various
> > > > > > > >>>> programming languages many of which do not use websockets.
> > > What
> > > > > > > exactly
> > > > > > > >>> do
> > > > > > > >>>> you need? Did you try doing an Internet search?
> > > > > > > >>>>
> > > > > > > >>>>
> > > > > > > >>>> Justin
> > > > > > > >>>>
> > > > > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > > > > >>> christopherpisz@gmail.com
> > > > > > > >>>> wrote:
> > > > > > > >>>>
> > > > > > > >>>>> So I installed ActiveMQ on a remote machine this morning.
> > > > > > > >>>>> Created the default broker.
> > > > > > > >>>>> Attempted to connect with the client I wrote using
> > > websockets.
> > > > > > > >>>>> Connection is refused.
> > > > > > > >>>>>
> > > > > > > >>>>> I then tried running the
> > > > > examples/protocols/stomp/stomp-websockets
> > > > > > > >>>> example
> > > > > > > >>>>> Attempted to connect with the client I write using
> > websockets
> > > > > > > >>>>> Connection is refused.
> > > > > > > >>>>> Attempted to connect using the index.html from my machine
> > > > rather
> > > > > > than
> > > > > > > >>> the
> > > > > > > >>>>> remote(as localhost there)
> > > > > > > >>>>> Connection refused.
> > > > > > > >>>>>
> > > > > > > >>>>> I don't know what to do.
> > > > > > > >>>>> Is there another premade client I can connect with that
> > > doesn't
> > > > > use
> > > > > > > >>>>> websockets, so I can at least narrow it down and see if
> the
> > > > > server
> > > > > > > >>> works
> > > > > > > >>>> at
> > > > > > > >>>>> all?
> > > > > > > >>>>> Any other suggestions?
> > > > > > > >>>>>
> > > > > > > >>>>>
> > > > > > > >>>>>
> > > > > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > > > > >>> wayne.robinson@gmail.com
> > > > > > > >>>>> wrote:
> > > > > > > >>>>>
> > > > > > > >>>>>> Websockets don’t use the same-origin policies that other
> > > AJAX
> > > > > > > >>> requests
> > > > > > > >>>>> do.
> > > > > > > >>>>>> You will most likely need to serve them via TLS to
> prevent
> > > > > browser
> > > > > > > >>>>> errors,
> > > > > > > >>>>>> but there’s nothing special you need to do to setup
> CORS.
> > > > > > > >>>>>>
> > > > > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > > > > >>>>>> christopherpisz@gmail.com>
> > > > > > > >>>>>> wrote:
> > > > > > > >>>>>>
> > > > > > > >>>>>>> I have a process that runs in California that wants to
> > talk
> > > > to
> > > > > a
> > > > > > > >>>>> process
> > > > > > > >>>>>> in
> > > > > > > >>>>>>> New York, using Stomp over Websockets.
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> Also note that my process is not a web app, but I
> > > > implemented a
> > > > > > > >>> stomp
> > > > > > > >>>>>> over
> > > > > > > >>>>>>> websocket client in C++, in order to connect things up
> to
> > > my
> > > > > > > >>> backend.
> > > > > > > >>>>>> Maybe
> > > > > > > >>>>>>> this was or wasn't a good idea. So, I want my client to
> > > talk
> > > > to
> > > > > > > >> the
> > > > > > > >>>>>> server
> > > > > > > >>>>>>> and subscribe, where their client pushed messages.
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> I was implementing my own server when I saw that
> ApacheMQ
> > > > > > > >> supported
> > > > > > > >>>>> Stomp
> > > > > > > >>>>>>> over Websockets. So, I started reading the docs.
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> It says:
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> One thing worth noting is that web sockets (just as
> Ajax)
> > > > > > > >>> implements
> > > > > > > >>>> ?
> > > > > > > >>>>>>> the same origin policy, so you can access only brokers
> > > > running
> > > > > on
> > > > > > > >>>> the >
> > > > > > > >>>>>>> same host as the web application running the client.
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> Is this a limitation of the server or the web client?
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> With that limitation, if I understand right, the server
> > is
> > > > not
> > > > > > > >>> going
> > > > > > > >>>> to
> > > > > > > >>>>>>> accept websocket connections from a client, of any
> kind,
> > > that
> > > > > is
> > > > > > > >>> not
> > > > > > > >>>> on
> > > > > > > >>>>>> the
> > > > > > > >>>>>>> same machine?
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> I am not sure I see the point of that...
> > > > > > > >>>>>>>
> > > > > > > >>>>>>> If that is indeed its meaning, then how do I get around
> > it
> > > in
> > > > > > > >> order
> > > > > > > >>>> to
> > > > > > > >>>>>>> implement my scenario?
> > > > > > > >>>>>>>
> > > > > > >
> > > > > > > --
> > > > > > > Tim Bish
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Justin Bertram <jb...@apache.org>.
Given that the broker is up and running fine on the remote machine I would
say there's some kind of environmental or network issue preventing
communication from your local machine and the remote machine on port 61616.
Perhaps a firewall is blocking that port.


Justin

On Fri, Aug 7, 2020 at 4:18 PM Christopher Pisz <ch...@gmail.com>
wrote:

> Log looks good to me:
>
> 2020-08-07 15:22:40,666 INFO
>  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting
> ActiveMQ Artemis Server
> 2020-08-07 15:22:40,713 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221000: live Message Broker is starting with configuration Broker
> Configuration
>
> (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
> 2020-08-07 15:22:40,759 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221012: Using AIO Journal
> 2020-08-07 15:22:40,798 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size
> (-Xmx). being defined as 1,073,741,824
> 2020-08-07 15:22:40,822 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221043: Protocol module found: [artemis-server]. Adding protocol support
> for: CORE
> 2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol
> support for: AMQP
> 2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding
> protocol support for: HORNETQ
> 2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol
> support for: MQTT
> 2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding
> protocol support for: OPENWIRE
> 2020-08-07 15:22:40,825 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol
> support for: STOMP
> 2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221034: Waiting indefinitely to obtain live lock
> 2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221035: Live Server Obtained live lock
> 2020-08-07 15:22:40,979 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221080: Deploying address DLQ supporting [ANYCAST]
> 2020-08-07 15:22:40,993 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
> 2020-08-07 15:22:41,048 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
> 2020-08-07 15:22:41,050 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
> 2020-08-07 15:22:41,461 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols
> [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
> 2020-08-07 15:22:41,464 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols
> [HORNETQ,STOMP]
> 2020-08-07 15:22:41,467 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
> 2020-08-07 15:22:41,469 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
> 2020-08-07 15:22:41,479 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols [STOMP]
> 2020-08-07 15:22:41,481 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221007: Server is now live
> 2020-08-07 15:22:41,482 INFO  [org.apache.activemq.artemis.core.server]
> AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0 [0.0.0.0,
> nodeID=5c5d5e87-d8e3-11ea-8b59-b42e99360c2c]
> 2020-08-07 15:22:41,827 INFO
>  [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized
> activemq-branding plugin
> 2020-08-07 15:22:41,879 INFO
>  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized
> artemis-plugin plugin
> 2020-08-07 15:22:42,326 INFO  [io.hawt.HawtioContextListener] Initialising
> hawtio services
> 2020-08-07 15:22:42,348 INFO  [io.hawt.system.ConfigManager] Configuration
> will be discovered via system properties
> 2020-08-07 15:22:42,352 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to
> hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was hawt
> like
> me? ;-)
> 2020-08-07 15:22:42,361 INFO  [io.hawt.jmx.UploadManager] Using file upload
> directory: /var/lib/testbroker/tmp/uploads
> 2020-08-07 15:22:42,383 INFO  [io.hawt.web.AuthenticationFilter] Starting
> hawtio authentication filter, JAAS realm: "activemq" authorized role(s):
> "amq" role principal classes:
> "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
> 2020-08-07 15:22:42,406 INFO  [io.hawt.web.JolokiaConfiguredAgentServlet]
> Jolokia overridden property: [key=policyLocation,
> value=file:/var/lib/testbroker/etc/jolokia-access.xml]
> 2020-08-07 15:22:42,430 INFO  [io.hawt.web.RBACMBeanInvoker] Using MBean
> [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role
> based access control
> 2020-08-07 15:22:42,544 INFO  [io.hawt.system.ProxyWhitelist] Initial proxy
> whitelist: [localhost, 127.0.0.1, 10.105.1.162,
> hansel04.alertinnovation.com
> ]
> 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP
> Server started at http://localhost:8161
> 2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241002:
> Artemis Jolokia REST API available at
> http://localhost:8161/console/jolokia
> 2020-08-07 <http://localhost:8161/console/jolokia2020-08-07> 15:22:42,786
> INFO  [org.apache.activemq.artemis] AMQ241004:
> Artemis Console available at http://localhost:8161/console
>
> Trying producer command on the remote machine itself:
> cd /opt/apache-artemis-2.14.0/bin/
> ./artemis producer --url tcp://localhost:61616 --user username --password
> password
> Connection brokerURL = tcp://localhost:61616
> Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed time
> ...
>
> Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
> Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 1 s
> Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second : 1509
> milli seconds
>
>
>
> On Fri, Aug 7, 2020 at 3:41 PM Justin Bertram <jb...@apache.org> wrote:
>
> > Did you check artemis.log to ensure the broker actually started up
> without
> > errors?
> >
> > Also, did you run the "artemis producer" command on the remote machine to
> > make sure the broker is actually working?
> >
> >
> > Justin
> >
> > On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <
> christopherpisz@gmail.com
> > >
> > wrote:
> >
> > > From Remote Machine:
> > > cd /var/lib
> > > sudo su
> > > /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> > > Creating ActiveMQ Artemis instance at: /var/lib/testbroker
> > >
> > > --user: is a mandatory property!
> > > Please provide the default username:
> > > user
> > >
> > > --password: is mandatory with this configuration:
> > > Please provide the default password:
> > >
> > >
> > > --allow-anonymous | --require-login: is a mandatory property!
> > > Allow anonymous access?, valid values are Y,N,True,False
> > > Y
> > >
> > > Auto tuning journal ...
> > > done! Your system can make 62.5 writes per millisecond, your
> > > journal-buffer-timeout will be 16000
> > >
> > > You can now start the broker by executing:
> > >
> > >    "/var/lib/testbroker/bin/artemis" run
> > >
> > > Or you can run the broker in the background using:
> > >
> > >    "/var/lib/testbroker/bin/artemis-service" start
> > >
> > > "/var/lib/testbroker/bin/artemis-service" start
> > > Starting artemis-service
> > > artemis-service is now running (21742)
> > >
> > > From Local Machine:
> > > ping topsecretmachine.com
> > > PING topsecretmachine.com (someip) 56(84) bytes of data.
> > > 64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63
> time=68.3
> > > ms
> > > 64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63
> time=65.6
> > > ms
> > > 64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63
> time=69.0
> > > ms
> > > 64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63
> time=66.4
> > > ms
> > > 64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63
> time=65.7
> > > ms
> > > 64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63
> time=71.7
> > > ms
> > > 64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63
> time=67.2
> > > ms
> > > ^C
> > > --- topsecretmachine.com ping statistics ---
> > > 7 packets transmitted, 7 received, 0% packet loss, time 6010ms
> > > rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> > > [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> > > [cpisz@localhost bin]$ ./artemis producer --url tcp://
> > > topsecretmachine.com:61616 --user user --password password
> > > Connection brokerURL = tcp://topsecretmachine.com:61616
> > > Connection failed::Failed to create session factory
> > >
> > > --url: is a mandatory property!
> > > Type in the broker URL for a retry (e.g. tcp://localhost:61616)
> > > tcp://topsecretmachine.com:61616
> > > Exception in thread "main" javax.jms.JMSException: Failed to create
> > session
> > > factory
> > > at
> > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> > > at
> > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> > > at
> > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> > > at
> > >
> > >
> >
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> > > at
> > >
> org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> > > at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> > > at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> > > 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> > > at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> > > Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> > > message=AMQ219007: Cannot connect to server(s). Tried with all
> available
> > > servers.]
> > > at
> > >
> > >
> >
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> > > at
> > >
> > >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> > > ... 12 more
> > >
> > > On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <jb...@apache.org>
> > wrote:
> > >
> > > > Given that you have an instance of ActiveMQ Artemis on the same
> machine
> > > as
> > > > the STOMP client I recommend you do something like this:
> > > >
> > > >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> > > >   > ./artemis producer --url tcp://remote-machine:61616 --user
> yourUser
> > > > --password yourPassword
> > > >
> > > > Let me know if that works.
> > > >
> > > >
> > > > Justin
> > > >
> > > > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> > > christopherpisz@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > I just followed the instructions on
> > > > >
> > > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > > > The broker is the default. Nothing is edited.
> > > > >
> > > > > "
> > > > >
> > > > > cd /var/lib
> > > > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > > > /var/lib/mybroker/bin/artemis run
> > > > >
> > > > >
> > > > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <ta...@gmail.com>
> > > wrote:
> > > > >
> > > > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > > > What I need:
> > > > > > > To determine if I can connect to activemq using stomp over
> > > websockets
> > > > > > from
> > > > > > > a remote machine, with a client I wrote.
> > > > > > >
> > > > > > > What I did:
> > > > > > > I wrote my own stomp over websockets client in C++ and built it
> > for
> > > > > > > CentOS7, on my home computer.
> > > > > > > I installed an ActiveMQ on a remote machine through ssh.
> > > > > > > I created the ActiveMQ default broker according to the docs
> > > > > > > I attempted to connect with my client
> > > > > >
> > > > > > Providing the broker configuration you used will help folks
> answer
> > > with
> > > > > > insights into what might be wrong there.
> > > > > >
> > > > > >
> > > > > > > What happened:
> > > > > > > Connection refused
> > > > > > >
> > > > > > > What I need:
> > > > > > > To figure out why connection is refused
> > > > > > >
> > > > > > > Ideas of my own:
> > > > > > > Does the client work on the local machine with the same version
> > and
> > > > > > > configuration of ActiveMQ? Yes
> > > > > > > Does someone else's client connect to the remote machine? I
> > dunno,
> > > I
> > > > > need
> > > > > > > someone else's client
> > > > > > > Maybe a client that uses something other than websockets will
> > prove
> > > > > that
> > > > > > > the "same origin policy" in the beginning of the email, is
> indeed
> > > the
> > > > > > > problem? I dunno. I need a client that uses another protocol.
> > > > > > >
> > > > > > >
> > > > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <
> > jbertram@apache.org
> > > >
> > > > > > wrote:
> > > > > > >
> > > > > > >> You're not really explaining what you need.
> > > > > > >>
> > > > > > >> You say you need "a built client that connects with a
> different
> > > > > > protocol."
> > > > > > >> What exactly do you mean by "built"? Does it have to be a
> > binary?
> > > If
> > > > > so,
> > > > > > >> what platform does the binary need to be built for? If it
> > doesn't
> > > > have
> > > > > > to
> > > > > > >> be a binary would a python or perl script work? Also, what
> > exactly
> > > > do
> > > > > > you
> > > > > > >> mean by "different protocol"? Do you mean a different protocol
> > > from
> > > > > > STOMP?
> > > > > > >> If so, I thought you were specifically trying to test STOMP
> > > > > connections.
> > > > > > >> How would testing another protocol tell you if STOMP
> connections
> > > are
> > > > > > >> working?
> > > > > > >>
> > > > > > >> It's hard (if not impossible) to provide clear guidance to
> vague
> > > > > > questions.
> > > > > > >>
> > > > > > >> If it helps, ActiveMQ Artemis ships with command-line clients
> > you
> > > > can
> > > > > > use
> > > > > > >> to quickly test a broker. Just type "./artemis help" from the
> > > broker
> > > > > > >> instance's "bin" directory and look for details about the
> > > "producer"
> > > > > and
> > > > > > >> "consumer" commands.
> > > > > > >>
> > > > > > >>
> > > > > > >> Justin
> > > > > > >>
> > > > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > > > christopherpisz@gmail.com
> > > > > > >> wrote:
> > > > > > >>
> > > > > > >>> Yes, I did a Google search.
> > > > > > >>> It yields code examples or javascript libs. I need a built
> > client
> > > > > that
> > > > > > >>> connects with a different protocol, so I can quickly test
> that
> > > the
> > > > > > server
> > > > > > >>> will allow clients to connect at all.
> > > > > > >>>
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> > > jbertram@apache.org
> > > > >
> > > > > > >> wrote:
> > > > > > >>>> There are lots of STOMP clients for various platforms
> written
> > in
> > > > > > >> various
> > > > > > >>>> programming languages many of which do not use websockets.
> > What
> > > > > > exactly
> > > > > > >>> do
> > > > > > >>>> you need? Did you try doing an Internet search?
> > > > > > >>>>
> > > > > > >>>>
> > > > > > >>>> Justin
> > > > > > >>>>
> > > > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > > > >>> christopherpisz@gmail.com
> > > > > > >>>> wrote:
> > > > > > >>>>
> > > > > > >>>>> So I installed ActiveMQ on a remote machine this morning.
> > > > > > >>>>> Created the default broker.
> > > > > > >>>>> Attempted to connect with the client I wrote using
> > websockets.
> > > > > > >>>>> Connection is refused.
> > > > > > >>>>>
> > > > > > >>>>> I then tried running the
> > > > examples/protocols/stomp/stomp-websockets
> > > > > > >>>> example
> > > > > > >>>>> Attempted to connect with the client I write using
> websockets
> > > > > > >>>>> Connection is refused.
> > > > > > >>>>> Attempted to connect using the index.html from my machine
> > > rather
> > > > > than
> > > > > > >>> the
> > > > > > >>>>> remote(as localhost there)
> > > > > > >>>>> Connection refused.
> > > > > > >>>>>
> > > > > > >>>>> I don't know what to do.
> > > > > > >>>>> Is there another premade client I can connect with that
> > doesn't
> > > > use
> > > > > > >>>>> websockets, so I can at least narrow it down and see if the
> > > > server
> > > > > > >>> works
> > > > > > >>>> at
> > > > > > >>>>> all?
> > > > > > >>>>> Any other suggestions?
> > > > > > >>>>>
> > > > > > >>>>>
> > > > > > >>>>>
> > > > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > > > >>> wayne.robinson@gmail.com
> > > > > > >>>>> wrote:
> > > > > > >>>>>
> > > > > > >>>>>> Websockets don’t use the same-origin policies that other
> > AJAX
> > > > > > >>> requests
> > > > > > >>>>> do.
> > > > > > >>>>>> You will most likely need to serve them via TLS to prevent
> > > > browser
> > > > > > >>>>> errors,
> > > > > > >>>>>> but there’s nothing special you need to do to setup CORS.
> > > > > > >>>>>>
> > > > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > > > >>>>>> christopherpisz@gmail.com>
> > > > > > >>>>>> wrote:
> > > > > > >>>>>>
> > > > > > >>>>>>> I have a process that runs in California that wants to
> talk
> > > to
> > > > a
> > > > > > >>>>> process
> > > > > > >>>>>> in
> > > > > > >>>>>>> New York, using Stomp over Websockets.
> > > > > > >>>>>>>
> > > > > > >>>>>>> Also note that my process is not a web app, but I
> > > implemented a
> > > > > > >>> stomp
> > > > > > >>>>>> over
> > > > > > >>>>>>> websocket client in C++, in order to connect things up to
> > my
> > > > > > >>> backend.
> > > > > > >>>>>> Maybe
> > > > > > >>>>>>> this was or wasn't a good idea. So, I want my client to
> > talk
> > > to
> > > > > > >> the
> > > > > > >>>>>> server
> > > > > > >>>>>>> and subscribe, where their client pushed messages.
> > > > > > >>>>>>>
> > > > > > >>>>>>> I was implementing my own server when I saw that ApacheMQ
> > > > > > >> supported
> > > > > > >>>>> Stomp
> > > > > > >>>>>>> over Websockets. So, I started reading the docs.
> > > > > > >>>>>>>
> > > > > > >>>>>>> It says:
> > > > > > >>>>>>>
> > > > > > >>>>>>> One thing worth noting is that web sockets (just as Ajax)
> > > > > > >>> implements
> > > > > > >>>> ?
> > > > > > >>>>>>> the same origin policy, so you can access only brokers
> > > running
> > > > on
> > > > > > >>>> the >
> > > > > > >>>>>>> same host as the web application running the client.
> > > > > > >>>>>>>
> > > > > > >>>>>>> Is this a limitation of the server or the web client?
> > > > > > >>>>>>>
> > > > > > >>>>>>> With that limitation, if I understand right, the server
> is
> > > not
> > > > > > >>> going
> > > > > > >>>> to
> > > > > > >>>>>>> accept websocket connections from a client, of any kind,
> > that
> > > > is
> > > > > > >>> not
> > > > > > >>>> on
> > > > > > >>>>>> the
> > > > > > >>>>>>> same machine?
> > > > > > >>>>>>>
> > > > > > >>>>>>> I am not sure I see the point of that...
> > > > > > >>>>>>>
> > > > > > >>>>>>> If that is indeed its meaning, then how do I get around
> it
> > in
> > > > > > >> order
> > > > > > >>>> to
> > > > > > >>>>>>> implement my scenario?
> > > > > > >>>>>>>
> > > > > >
> > > > > > --
> > > > > > Tim Bish
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Christopher Pisz <ch...@gmail.com>.
Log looks good to me:

2020-08-07 15:22:40,666 INFO
 [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting
ActiveMQ Artemis Server
2020-08-07 15:22:40,713 INFO  [org.apache.activemq.artemis.core.server]
AMQ221000: live Message Broker is starting with configuration Broker
Configuration
(clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
2020-08-07 15:22:40,759 INFO  [org.apache.activemq.artemis.core.server]
AMQ221012: Using AIO Journal
2020-08-07 15:22:40,798 INFO  [org.apache.activemq.artemis.core.server]
AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size
(-Xmx). being defined as 1,073,741,824
2020-08-07 15:22:40,822 INFO  [org.apache.activemq.artemis.core.server]
AMQ221043: Protocol module found: [artemis-server]. Adding protocol support
for: CORE
2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol
support for: AMQP
2020-08-07 15:22:40,823 INFO  [org.apache.activemq.artemis.core.server]
AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding
protocol support for: HORNETQ
2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol
support for: MQTT
2020-08-07 15:22:40,824 INFO  [org.apache.activemq.artemis.core.server]
AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding
protocol support for: OPENWIRE
2020-08-07 15:22:40,825 INFO  [org.apache.activemq.artemis.core.server]
AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol
support for: STOMP
2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
AMQ221034: Waiting indefinitely to obtain live lock
2020-08-07 15:22:40,890 INFO  [org.apache.activemq.artemis.core.server]
AMQ221035: Live Server Obtained live lock
2020-08-07 15:22:40,979 INFO  [org.apache.activemq.artemis.core.server]
AMQ221080: Deploying address DLQ supporting [ANYCAST]
2020-08-07 15:22:40,993 INFO  [org.apache.activemq.artemis.core.server]
AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
2020-08-07 15:22:41,048 INFO  [org.apache.activemq.artemis.core.server]
AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2020-08-07 15:22:41,050 INFO  [org.apache.activemq.artemis.core.server]
AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2020-08-07 15:22:41,461 INFO  [org.apache.activemq.artemis.core.server]
AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols
[CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
2020-08-07 15:22:41,464 INFO  [org.apache.activemq.artemis.core.server]
AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols
[HORNETQ,STOMP]
2020-08-07 15:22:41,467 INFO  [org.apache.activemq.artemis.core.server]
AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2020-08-07 15:22:41,469 INFO  [org.apache.activemq.artemis.core.server]
AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2020-08-07 15:22:41,479 INFO  [org.apache.activemq.artemis.core.server]
AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2020-08-07 15:22:41,481 INFO  [org.apache.activemq.artemis.core.server]
AMQ221007: Server is now live
2020-08-07 15:22:41,482 INFO  [org.apache.activemq.artemis.core.server]
AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0 [0.0.0.0,
nodeID=5c5d5e87-d8e3-11ea-8b59-b42e99360c2c]
2020-08-07 15:22:41,827 INFO
 [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized
activemq-branding plugin
2020-08-07 15:22:41,879 INFO
 [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized
artemis-plugin plugin
2020-08-07 15:22:42,326 INFO  [io.hawt.HawtioContextListener] Initialising
hawtio services
2020-08-07 15:22:42,348 INFO  [io.hawt.system.ConfigManager] Configuration
will be discovered via system properties
2020-08-07 15:22:42,352 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to
hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was hawt like
me? ;-)
2020-08-07 15:22:42,361 INFO  [io.hawt.jmx.UploadManager] Using file upload
directory: /var/lib/testbroker/tmp/uploads
2020-08-07 15:22:42,383 INFO  [io.hawt.web.AuthenticationFilter] Starting
hawtio authentication filter, JAAS realm: "activemq" authorized role(s):
"amq" role principal classes:
"org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2020-08-07 15:22:42,406 INFO  [io.hawt.web.JolokiaConfiguredAgentServlet]
Jolokia overridden property: [key=policyLocation,
value=file:/var/lib/testbroker/etc/jolokia-access.xml]
2020-08-07 15:22:42,430 INFO  [io.hawt.web.RBACMBeanInvoker] Using MBean
[hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role
based access control
2020-08-07 15:22:42,544 INFO  [io.hawt.system.ProxyWhitelist] Initial proxy
whitelist: [localhost, 127.0.0.1, 10.105.1.162, hansel04.alertinnovation.com
]
2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP
Server started at http://localhost:8161
2020-08-07 15:22:42,785 INFO  [org.apache.activemq.artemis] AMQ241002:
Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
2020-08-07 15:22:42,786 INFO  [org.apache.activemq.artemis] AMQ241004:
Artemis Console available at http://localhost:8161/console

Trying producer command on the remote machine itself:
cd /opt/apache-artemis-2.14.0/bin/
./artemis producer --url tcp://localhost:61616 --user username --password
password
Connection brokerURL = tcp://localhost:61616
Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed time ...

Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 1 s
Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second : 1509
milli seconds



On Fri, Aug 7, 2020 at 3:41 PM Justin Bertram <jb...@apache.org> wrote:

> Did you check artemis.log to ensure the broker actually started up without
> errors?
>
> Also, did you run the "artemis producer" command on the remote machine to
> make sure the broker is actually working?
>
>
> Justin
>
> On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <christopherpisz@gmail.com
> >
> wrote:
>
> > From Remote Machine:
> > cd /var/lib
> > sudo su
> > /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> > Creating ActiveMQ Artemis instance at: /var/lib/testbroker
> >
> > --user: is a mandatory property!
> > Please provide the default username:
> > user
> >
> > --password: is mandatory with this configuration:
> > Please provide the default password:
> >
> >
> > --allow-anonymous | --require-login: is a mandatory property!
> > Allow anonymous access?, valid values are Y,N,True,False
> > Y
> >
> > Auto tuning journal ...
> > done! Your system can make 62.5 writes per millisecond, your
> > journal-buffer-timeout will be 16000
> >
> > You can now start the broker by executing:
> >
> >    "/var/lib/testbroker/bin/artemis" run
> >
> > Or you can run the broker in the background using:
> >
> >    "/var/lib/testbroker/bin/artemis-service" start
> >
> > "/var/lib/testbroker/bin/artemis-service" start
> > Starting artemis-service
> > artemis-service is now running (21742)
> >
> > From Local Machine:
> > ping topsecretmachine.com
> > PING topsecretmachine.com (someip) 56(84) bytes of data.
> > 64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63 time=68.3
> > ms
> > 64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63 time=65.6
> > ms
> > 64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63 time=69.0
> > ms
> > 64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63 time=66.4
> > ms
> > 64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63 time=65.7
> > ms
> > 64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63 time=71.7
> > ms
> > 64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63 time=67.2
> > ms
> > ^C
> > --- topsecretmachine.com ping statistics ---
> > 7 packets transmitted, 7 received, 0% packet loss, time 6010ms
> > rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> > [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> > [cpisz@localhost bin]$ ./artemis producer --url tcp://
> > topsecretmachine.com:61616 --user user --password password
> > Connection brokerURL = tcp://topsecretmachine.com:61616
> > Connection failed::Failed to create session factory
> >
> > --url: is a mandatory property!
> > Type in the broker URL for a retry (e.g. tcp://localhost:61616)
> > tcp://topsecretmachine.com:61616
> > Exception in thread "main" javax.jms.JMSException: Failed to create
> session
> > factory
> > at
> >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> > at
> >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> > at
> >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> > at
> >
> >
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> > at
> > org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> > at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> > at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> > 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> > at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> > Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> > message=AMQ219007: Cannot connect to server(s). Tried with all available
> > servers.]
> > at
> >
> >
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> > at
> >
> >
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> > ... 12 more
> >
> > On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <jb...@apache.org>
> wrote:
> >
> > > Given that you have an instance of ActiveMQ Artemis on the same machine
> > as
> > > the STOMP client I recommend you do something like this:
> > >
> > >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> > >   > ./artemis producer --url tcp://remote-machine:61616 --user yourUser
> > > --password yourPassword
> > >
> > > Let me know if that works.
> > >
> > >
> > > Justin
> > >
> > > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> > christopherpisz@gmail.com
> > > >
> > > wrote:
> > >
> > > > I just followed the instructions on
> > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > > The broker is the default. Nothing is edited.
> > > >
> > > > "
> > > >
> > > > cd /var/lib
> > > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > > /var/lib/mybroker/bin/artemis run
> > > >
> > > >
> > > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <ta...@gmail.com>
> > wrote:
> > > >
> > > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > > What I need:
> > > > > > To determine if I can connect to activemq using stomp over
> > websockets
> > > > > from
> > > > > > a remote machine, with a client I wrote.
> > > > > >
> > > > > > What I did:
> > > > > > I wrote my own stomp over websockets client in C++ and built it
> for
> > > > > > CentOS7, on my home computer.
> > > > > > I installed an ActiveMQ on a remote machine through ssh.
> > > > > > I created the ActiveMQ default broker according to the docs
> > > > > > I attempted to connect with my client
> > > > >
> > > > > Providing the broker configuration you used will help folks answer
> > with
> > > > > insights into what might be wrong there.
> > > > >
> > > > >
> > > > > > What happened:
> > > > > > Connection refused
> > > > > >
> > > > > > What I need:
> > > > > > To figure out why connection is refused
> > > > > >
> > > > > > Ideas of my own:
> > > > > > Does the client work on the local machine with the same version
> and
> > > > > > configuration of ActiveMQ? Yes
> > > > > > Does someone else's client connect to the remote machine? I
> dunno,
> > I
> > > > need
> > > > > > someone else's client
> > > > > > Maybe a client that uses something other than websockets will
> prove
> > > > that
> > > > > > the "same origin policy" in the beginning of the email, is indeed
> > the
> > > > > > problem? I dunno. I need a client that uses another protocol.
> > > > > >
> > > > > >
> > > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <
> jbertram@apache.org
> > >
> > > > > wrote:
> > > > > >
> > > > > >> You're not really explaining what you need.
> > > > > >>
> > > > > >> You say you need "a built client that connects with a different
> > > > > protocol."
> > > > > >> What exactly do you mean by "built"? Does it have to be a
> binary?
> > If
> > > > so,
> > > > > >> what platform does the binary need to be built for? If it
> doesn't
> > > have
> > > > > to
> > > > > >> be a binary would a python or perl script work? Also, what
> exactly
> > > do
> > > > > you
> > > > > >> mean by "different protocol"? Do you mean a different protocol
> > from
> > > > > STOMP?
> > > > > >> If so, I thought you were specifically trying to test STOMP
> > > > connections.
> > > > > >> How would testing another protocol tell you if STOMP connections
> > are
> > > > > >> working?
> > > > > >>
> > > > > >> It's hard (if not impossible) to provide clear guidance to vague
> > > > > questions.
> > > > > >>
> > > > > >> If it helps, ActiveMQ Artemis ships with command-line clients
> you
> > > can
> > > > > use
> > > > > >> to quickly test a broker. Just type "./artemis help" from the
> > broker
> > > > > >> instance's "bin" directory and look for details about the
> > "producer"
> > > > and
> > > > > >> "consumer" commands.
> > > > > >>
> > > > > >>
> > > > > >> Justin
> > > > > >>
> > > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > > christopherpisz@gmail.com
> > > > > >> wrote:
> > > > > >>
> > > > > >>> Yes, I did a Google search.
> > > > > >>> It yields code examples or javascript libs. I need a built
> client
> > > > that
> > > > > >>> connects with a different protocol, so I can quickly test that
> > the
> > > > > server
> > > > > >>> will allow clients to connect at all.
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> > jbertram@apache.org
> > > >
> > > > > >> wrote:
> > > > > >>>> There are lots of STOMP clients for various platforms written
> in
> > > > > >> various
> > > > > >>>> programming languages many of which do not use websockets.
> What
> > > > > exactly
> > > > > >>> do
> > > > > >>>> you need? Did you try doing an Internet search?
> > > > > >>>>
> > > > > >>>>
> > > > > >>>> Justin
> > > > > >>>>
> > > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > > >>> christopherpisz@gmail.com
> > > > > >>>> wrote:
> > > > > >>>>
> > > > > >>>>> So I installed ActiveMQ on a remote machine this morning.
> > > > > >>>>> Created the default broker.
> > > > > >>>>> Attempted to connect with the client I wrote using
> websockets.
> > > > > >>>>> Connection is refused.
> > > > > >>>>>
> > > > > >>>>> I then tried running the
> > > examples/protocols/stomp/stomp-websockets
> > > > > >>>> example
> > > > > >>>>> Attempted to connect with the client I write using websockets
> > > > > >>>>> Connection is refused.
> > > > > >>>>> Attempted to connect using the index.html from my machine
> > rather
> > > > than
> > > > > >>> the
> > > > > >>>>> remote(as localhost there)
> > > > > >>>>> Connection refused.
> > > > > >>>>>
> > > > > >>>>> I don't know what to do.
> > > > > >>>>> Is there another premade client I can connect with that
> doesn't
> > > use
> > > > > >>>>> websockets, so I can at least narrow it down and see if the
> > > server
> > > > > >>> works
> > > > > >>>> at
> > > > > >>>>> all?
> > > > > >>>>> Any other suggestions?
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > > >>> wayne.robinson@gmail.com
> > > > > >>>>> wrote:
> > > > > >>>>>
> > > > > >>>>>> Websockets don’t use the same-origin policies that other
> AJAX
> > > > > >>> requests
> > > > > >>>>> do.
> > > > > >>>>>> You will most likely need to serve them via TLS to prevent
> > > browser
> > > > > >>>>> errors,
> > > > > >>>>>> but there’s nothing special you need to do to setup CORS.
> > > > > >>>>>>
> > > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > > >>>>>> christopherpisz@gmail.com>
> > > > > >>>>>> wrote:
> > > > > >>>>>>
> > > > > >>>>>>> I have a process that runs in California that wants to talk
> > to
> > > a
> > > > > >>>>> process
> > > > > >>>>>> in
> > > > > >>>>>>> New York, using Stomp over Websockets.
> > > > > >>>>>>>
> > > > > >>>>>>> Also note that my process is not a web app, but I
> > implemented a
> > > > > >>> stomp
> > > > > >>>>>> over
> > > > > >>>>>>> websocket client in C++, in order to connect things up to
> my
> > > > > >>> backend.
> > > > > >>>>>> Maybe
> > > > > >>>>>>> this was or wasn't a good idea. So, I want my client to
> talk
> > to
> > > > > >> the
> > > > > >>>>>> server
> > > > > >>>>>>> and subscribe, where their client pushed messages.
> > > > > >>>>>>>
> > > > > >>>>>>> I was implementing my own server when I saw that ApacheMQ
> > > > > >> supported
> > > > > >>>>> Stomp
> > > > > >>>>>>> over Websockets. So, I started reading the docs.
> > > > > >>>>>>>
> > > > > >>>>>>> It says:
> > > > > >>>>>>>
> > > > > >>>>>>> One thing worth noting is that web sockets (just as Ajax)
> > > > > >>> implements
> > > > > >>>> ?
> > > > > >>>>>>> the same origin policy, so you can access only brokers
> > running
> > > on
> > > > > >>>> the >
> > > > > >>>>>>> same host as the web application running the client.
> > > > > >>>>>>>
> > > > > >>>>>>> Is this a limitation of the server or the web client?
> > > > > >>>>>>>
> > > > > >>>>>>> With that limitation, if I understand right, the server is
> > not
> > > > > >>> going
> > > > > >>>> to
> > > > > >>>>>>> accept websocket connections from a client, of any kind,
> that
> > > is
> > > > > >>> not
> > > > > >>>> on
> > > > > >>>>>> the
> > > > > >>>>>>> same machine?
> > > > > >>>>>>>
> > > > > >>>>>>> I am not sure I see the point of that...
> > > > > >>>>>>>
> > > > > >>>>>>> If that is indeed its meaning, then how do I get around it
> in
> > > > > >> order
> > > > > >>>> to
> > > > > >>>>>>> implement my scenario?
> > > > > >>>>>>>
> > > > >
> > > > > --
> > > > > Tim Bish
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Justin Bertram <jb...@apache.org>.
Did you check artemis.log to ensure the broker actually started up without
errors?

Also, did you run the "artemis producer" command on the remote machine to
make sure the broker is actually working?


Justin

On Fri, Aug 7, 2020 at 2:33 PM Christopher Pisz <ch...@gmail.com>
wrote:

> From Remote Machine:
> cd /var/lib
> sudo su
> /opt/apache-artemis-2.14.0/bin/artemis create testbroker
> Creating ActiveMQ Artemis instance at: /var/lib/testbroker
>
> --user: is a mandatory property!
> Please provide the default username:
> user
>
> --password: is mandatory with this configuration:
> Please provide the default password:
>
>
> --allow-anonymous | --require-login: is a mandatory property!
> Allow anonymous access?, valid values are Y,N,True,False
> Y
>
> Auto tuning journal ...
> done! Your system can make 62.5 writes per millisecond, your
> journal-buffer-timeout will be 16000
>
> You can now start the broker by executing:
>
>    "/var/lib/testbroker/bin/artemis" run
>
> Or you can run the broker in the background using:
>
>    "/var/lib/testbroker/bin/artemis-service" start
>
> "/var/lib/testbroker/bin/artemis-service" start
> Starting artemis-service
> artemis-service is now running (21742)
>
> From Local Machine:
> ping topsecretmachine.com
> PING topsecretmachine.com (someip) 56(84) bytes of data.
> 64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63 time=68.3
> ms
> 64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63 time=65.6
> ms
> 64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63 time=69.0
> ms
> 64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63 time=66.4
> ms
> 64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63 time=65.7
> ms
> 64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63 time=71.7
> ms
> 64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63 time=67.2
> ms
> ^C
> --- topsecretmachine.com ping statistics ---
> 7 packets transmitted, 7 received, 0% packet loss, time 6010ms
> rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
> [cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
> [cpisz@localhost bin]$ ./artemis producer --url tcp://
> topsecretmachine.com:61616 --user user --password password
> Connection brokerURL = tcp://topsecretmachine.com:61616
> Connection failed::Failed to create session factory
>
> --url: is a mandatory property!
> Type in the broker URL for a retry (e.g. tcp://localhost:61616)
> tcp://topsecretmachine.com:61616
> Exception in thread "main" javax.jms.JMSException: Failed to create session
> factory
> at
>
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
> at
>
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
> at
>
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
> at
>
> org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
> at
> org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
> at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
> at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
> 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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
> at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
> Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
> message=AMQ219007: Cannot connect to server(s). Tried with all available
> servers.]
> at
>
> org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
> at
>
> org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
> ... 12 more
>
> On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <jb...@apache.org> wrote:
>
> > Given that you have an instance of ActiveMQ Artemis on the same machine
> as
> > the STOMP client I recommend you do something like this:
> >
> >   > cd <ARTEMIS_INSTANCE_HOME>/bin
> >   > ./artemis producer --url tcp://remote-machine:61616 --user yourUser
> > --password yourPassword
> >
> > Let me know if that works.
> >
> >
> > Justin
> >
> > On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <
> christopherpisz@gmail.com
> > >
> > wrote:
> >
> > > I just followed the instructions on
> > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > > The broker is the default. Nothing is edited.
> > >
> > > "
> > >
> > > cd /var/lib
> > > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > > /var/lib/mybroker/bin/artemis run
> > >
> > >
> > > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <ta...@gmail.com>
> wrote:
> > >
> > > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > > What I need:
> > > > > To determine if I can connect to activemq using stomp over
> websockets
> > > > from
> > > > > a remote machine, with a client I wrote.
> > > > >
> > > > > What I did:
> > > > > I wrote my own stomp over websockets client in C++ and built it for
> > > > > CentOS7, on my home computer.
> > > > > I installed an ActiveMQ on a remote machine through ssh.
> > > > > I created the ActiveMQ default broker according to the docs
> > > > > I attempted to connect with my client
> > > >
> > > > Providing the broker configuration you used will help folks answer
> with
> > > > insights into what might be wrong there.
> > > >
> > > >
> > > > > What happened:
> > > > > Connection refused
> > > > >
> > > > > What I need:
> > > > > To figure out why connection is refused
> > > > >
> > > > > Ideas of my own:
> > > > > Does the client work on the local machine with the same version and
> > > > > configuration of ActiveMQ? Yes
> > > > > Does someone else's client connect to the remote machine? I dunno,
> I
> > > need
> > > > > someone else's client
> > > > > Maybe a client that uses something other than websockets will prove
> > > that
> > > > > the "same origin policy" in the beginning of the email, is indeed
> the
> > > > > problem? I dunno. I need a client that uses another protocol.
> > > > >
> > > > >
> > > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <jbertram@apache.org
> >
> > > > wrote:
> > > > >
> > > > >> You're not really explaining what you need.
> > > > >>
> > > > >> You say you need "a built client that connects with a different
> > > > protocol."
> > > > >> What exactly do you mean by "built"? Does it have to be a binary?
> If
> > > so,
> > > > >> what platform does the binary need to be built for? If it doesn't
> > have
> > > > to
> > > > >> be a binary would a python or perl script work? Also, what exactly
> > do
> > > > you
> > > > >> mean by "different protocol"? Do you mean a different protocol
> from
> > > > STOMP?
> > > > >> If so, I thought you were specifically trying to test STOMP
> > > connections.
> > > > >> How would testing another protocol tell you if STOMP connections
> are
> > > > >> working?
> > > > >>
> > > > >> It's hard (if not impossible) to provide clear guidance to vague
> > > > questions.
> > > > >>
> > > > >> If it helps, ActiveMQ Artemis ships with command-line clients you
> > can
> > > > use
> > > > >> to quickly test a broker. Just type "./artemis help" from the
> broker
> > > > >> instance's "bin" directory and look for details about the
> "producer"
> > > and
> > > > >> "consumer" commands.
> > > > >>
> > > > >>
> > > > >> Justin
> > > > >>
> > > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > > christopherpisz@gmail.com
> > > > >> wrote:
> > > > >>
> > > > >>> Yes, I did a Google search.
> > > > >>> It yields code examples or javascript libs. I need a built client
> > > that
> > > > >>> connects with a different protocol, so I can quickly test that
> the
> > > > server
> > > > >>> will allow clients to connect at all.
> > > > >>>
> > > > >>>
> > > > >>>
> > > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <
> jbertram@apache.org
> > >
> > > > >> wrote:
> > > > >>>> There are lots of STOMP clients for various platforms written in
> > > > >> various
> > > > >>>> programming languages many of which do not use websockets. What
> > > > exactly
> > > > >>> do
> > > > >>>> you need? Did you try doing an Internet search?
> > > > >>>>
> > > > >>>>
> > > > >>>> Justin
> > > > >>>>
> > > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > > >>> christopherpisz@gmail.com
> > > > >>>> wrote:
> > > > >>>>
> > > > >>>>> So I installed ActiveMQ on a remote machine this morning.
> > > > >>>>> Created the default broker.
> > > > >>>>> Attempted to connect with the client I wrote using websockets.
> > > > >>>>> Connection is refused.
> > > > >>>>>
> > > > >>>>> I then tried running the
> > examples/protocols/stomp/stomp-websockets
> > > > >>>> example
> > > > >>>>> Attempted to connect with the client I write using websockets
> > > > >>>>> Connection is refused.
> > > > >>>>> Attempted to connect using the index.html from my machine
> rather
> > > than
> > > > >>> the
> > > > >>>>> remote(as localhost there)
> > > > >>>>> Connection refused.
> > > > >>>>>
> > > > >>>>> I don't know what to do.
> > > > >>>>> Is there another premade client I can connect with that doesn't
> > use
> > > > >>>>> websockets, so I can at least narrow it down and see if the
> > server
> > > > >>> works
> > > > >>>> at
> > > > >>>>> all?
> > > > >>>>> Any other suggestions?
> > > > >>>>>
> > > > >>>>>
> > > > >>>>>
> > > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > > >>> wayne.robinson@gmail.com
> > > > >>>>> wrote:
> > > > >>>>>
> > > > >>>>>> Websockets don’t use the same-origin policies that other AJAX
> > > > >>> requests
> > > > >>>>> do.
> > > > >>>>>> You will most likely need to serve them via TLS to prevent
> > browser
> > > > >>>>> errors,
> > > > >>>>>> but there’s nothing special you need to do to setup CORS.
> > > > >>>>>>
> > > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > >>>>>> christopherpisz@gmail.com>
> > > > >>>>>> wrote:
> > > > >>>>>>
> > > > >>>>>>> I have a process that runs in California that wants to talk
> to
> > a
> > > > >>>>> process
> > > > >>>>>> in
> > > > >>>>>>> New York, using Stomp over Websockets.
> > > > >>>>>>>
> > > > >>>>>>> Also note that my process is not a web app, but I
> implemented a
> > > > >>> stomp
> > > > >>>>>> over
> > > > >>>>>>> websocket client in C++, in order to connect things up to my
> > > > >>> backend.
> > > > >>>>>> Maybe
> > > > >>>>>>> this was or wasn't a good idea. So, I want my client to talk
> to
> > > > >> the
> > > > >>>>>> server
> > > > >>>>>>> and subscribe, where their client pushed messages.
> > > > >>>>>>>
> > > > >>>>>>> I was implementing my own server when I saw that ApacheMQ
> > > > >> supported
> > > > >>>>> Stomp
> > > > >>>>>>> over Websockets. So, I started reading the docs.
> > > > >>>>>>>
> > > > >>>>>>> It says:
> > > > >>>>>>>
> > > > >>>>>>> One thing worth noting is that web sockets (just as Ajax)
> > > > >>> implements
> > > > >>>> ?
> > > > >>>>>>> the same origin policy, so you can access only brokers
> running
> > on
> > > > >>>> the >
> > > > >>>>>>> same host as the web application running the client.
> > > > >>>>>>>
> > > > >>>>>>> Is this a limitation of the server or the web client?
> > > > >>>>>>>
> > > > >>>>>>> With that limitation, if I understand right, the server is
> not
> > > > >>> going
> > > > >>>> to
> > > > >>>>>>> accept websocket connections from a client, of any kind, that
> > is
> > > > >>> not
> > > > >>>> on
> > > > >>>>>> the
> > > > >>>>>>> same machine?
> > > > >>>>>>>
> > > > >>>>>>> I am not sure I see the point of that...
> > > > >>>>>>>
> > > > >>>>>>> If that is indeed its meaning, then how do I get around it in
> > > > >> order
> > > > >>>> to
> > > > >>>>>>> implement my scenario?
> > > > >>>>>>>
> > > >
> > > > --
> > > > Tim Bish
> > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Christopher Pisz <ch...@gmail.com>.
From Remote Machine:
cd /var/lib
sudo su
/opt/apache-artemis-2.14.0/bin/artemis create testbroker
Creating ActiveMQ Artemis instance at: /var/lib/testbroker

--user: is a mandatory property!
Please provide the default username:
user

--password: is mandatory with this configuration:
Please provide the default password:


--allow-anonymous | --require-login: is a mandatory property!
Allow anonymous access?, valid values are Y,N,True,False
Y

Auto tuning journal ...
done! Your system can make 62.5 writes per millisecond, your
journal-buffer-timeout will be 16000

You can now start the broker by executing:

   "/var/lib/testbroker/bin/artemis" run

Or you can run the broker in the background using:

   "/var/lib/testbroker/bin/artemis-service" start

"/var/lib/testbroker/bin/artemis-service" start
Starting artemis-service
artemis-service is now running (21742)

From Local Machine:
ping topsecretmachine.com
PING topsecretmachine.com (someip) 56(84) bytes of data.
64 bytes from topsecretmachine.com (someip): icmp_seq=1 ttl=63 time=68.3 ms
64 bytes from topsecretmachine.com (someip): icmp_seq=2 ttl=63 time=65.6 ms
64 bytes from topsecretmachine.com (someip): icmp_seq=3 ttl=63 time=69.0 ms
64 bytes from topsecretmachine.com (someip): icmp_seq=4 ttl=63 time=66.4 ms
64 bytes from topsecretmachine.com (someip): icmp_seq=5 ttl=63 time=65.7 ms
64 bytes from topsecretmachine.com (someip): icmp_seq=6 ttl=63 time=71.7 ms
64 bytes from topsecretmachine.com (someip): icmp_seq=7 ttl=63 time=67.2 ms
^C
--- topsecretmachine.com ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6010ms
rtt min/avg/max/mdev = 65.692/67.753/71.745/2.034 ms
[cpisz@localhost ~]$ cd apache-artemis-2.14.0/bin/
[cpisz@localhost bin]$ ./artemis producer --url tcp://
topsecretmachine.com:61616 --user user --password password
Connection brokerURL = tcp://topsecretmachine.com:61616
Connection failed::Failed to create session factory

--url: is a mandatory property!
Type in the broker URL for a retry (e.g. tcp://localhost:61616)
tcp://topsecretmachine.com:61616
Exception in thread "main" javax.jms.JMSException: Failed to create session
factory
at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:299)
at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:294)
at
org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:142)
at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153)
at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101)
at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128)
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.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134)
at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50)
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED
message=AMQ219007: Cannot connect to server(s). Tried with all available
servers.]
at
org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699)
at
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
... 12 more

On Fri, Aug 7, 2020 at 3:10 PM Justin Bertram <jb...@apache.org> wrote:

> Given that you have an instance of ActiveMQ Artemis on the same machine as
> the STOMP client I recommend you do something like this:
>
>   > cd <ARTEMIS_INSTANCE_HOME>/bin
>   > ./artemis producer --url tcp://remote-machine:61616 --user yourUser
> --password yourPassword
>
> Let me know if that works.
>
>
> Justin
>
> On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <christopherpisz@gmail.com
> >
> wrote:
>
> > I just followed the instructions on
> >
> >
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> > The broker is the default. Nothing is edited.
> >
> > "
> >
> > cd /var/lib
> > ${ARTEMIS_HOME}/bin/artemis create mybroker
> > /var/lib/mybroker/bin/artemis run
> >
> >
> > On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <ta...@gmail.com> wrote:
> >
> > > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > > What I need:
> > > > To determine if I can connect to activemq using stomp over websockets
> > > from
> > > > a remote machine, with a client I wrote.
> > > >
> > > > What I did:
> > > > I wrote my own stomp over websockets client in C++ and built it for
> > > > CentOS7, on my home computer.
> > > > I installed an ActiveMQ on a remote machine through ssh.
> > > > I created the ActiveMQ default broker according to the docs
> > > > I attempted to connect with my client
> > >
> > > Providing the broker configuration you used will help folks answer with
> > > insights into what might be wrong there.
> > >
> > >
> > > > What happened:
> > > > Connection refused
> > > >
> > > > What I need:
> > > > To figure out why connection is refused
> > > >
> > > > Ideas of my own:
> > > > Does the client work on the local machine with the same version and
> > > > configuration of ActiveMQ? Yes
> > > > Does someone else's client connect to the remote machine? I dunno, I
> > need
> > > > someone else's client
> > > > Maybe a client that uses something other than websockets will prove
> > that
> > > > the "same origin policy" in the beginning of the email, is indeed the
> > > > problem? I dunno. I need a client that uses another protocol.
> > > >
> > > >
> > > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <jb...@apache.org>
> > > wrote:
> > > >
> > > >> You're not really explaining what you need.
> > > >>
> > > >> You say you need "a built client that connects with a different
> > > protocol."
> > > >> What exactly do you mean by "built"? Does it have to be a binary? If
> > so,
> > > >> what platform does the binary need to be built for? If it doesn't
> have
> > > to
> > > >> be a binary would a python or perl script work? Also, what exactly
> do
> > > you
> > > >> mean by "different protocol"? Do you mean a different protocol from
> > > STOMP?
> > > >> If so, I thought you were specifically trying to test STOMP
> > connections.
> > > >> How would testing another protocol tell you if STOMP connections are
> > > >> working?
> > > >>
> > > >> It's hard (if not impossible) to provide clear guidance to vague
> > > questions.
> > > >>
> > > >> If it helps, ActiveMQ Artemis ships with command-line clients you
> can
> > > use
> > > >> to quickly test a broker. Just type "./artemis help" from the broker
> > > >> instance's "bin" directory and look for details about the "producer"
> > and
> > > >> "consumer" commands.
> > > >>
> > > >>
> > > >> Justin
> > > >>
> > > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > > christopherpisz@gmail.com
> > > >> wrote:
> > > >>
> > > >>> Yes, I did a Google search.
> > > >>> It yields code examples or javascript libs. I need a built client
> > that
> > > >>> connects with a different protocol, so I can quickly test that the
> > > server
> > > >>> will allow clients to connect at all.
> > > >>>
> > > >>>
> > > >>>
> > > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jbertram@apache.org
> >
> > > >> wrote:
> > > >>>> There are lots of STOMP clients for various platforms written in
> > > >> various
> > > >>>> programming languages many of which do not use websockets. What
> > > exactly
> > > >>> do
> > > >>>> you need? Did you try doing an Internet search?
> > > >>>>
> > > >>>>
> > > >>>> Justin
> > > >>>>
> > > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > > >>> christopherpisz@gmail.com
> > > >>>> wrote:
> > > >>>>
> > > >>>>> So I installed ActiveMQ on a remote machine this morning.
> > > >>>>> Created the default broker.
> > > >>>>> Attempted to connect with the client I wrote using websockets.
> > > >>>>> Connection is refused.
> > > >>>>>
> > > >>>>> I then tried running the
> examples/protocols/stomp/stomp-websockets
> > > >>>> example
> > > >>>>> Attempted to connect with the client I write using websockets
> > > >>>>> Connection is refused.
> > > >>>>> Attempted to connect using the index.html from my machine rather
> > than
> > > >>> the
> > > >>>>> remote(as localhost there)
> > > >>>>> Connection refused.
> > > >>>>>
> > > >>>>> I don't know what to do.
> > > >>>>> Is there another premade client I can connect with that doesn't
> use
> > > >>>>> websockets, so I can at least narrow it down and see if the
> server
> > > >>> works
> > > >>>> at
> > > >>>>> all?
> > > >>>>> Any other suggestions?
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > > >>> wayne.robinson@gmail.com
> > > >>>>> wrote:
> > > >>>>>
> > > >>>>>> Websockets don’t use the same-origin policies that other AJAX
> > > >>> requests
> > > >>>>> do.
> > > >>>>>> You will most likely need to serve them via TLS to prevent
> browser
> > > >>>>> errors,
> > > >>>>>> but there’s nothing special you need to do to setup CORS.
> > > >>>>>>
> > > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > >>>>>> christopherpisz@gmail.com>
> > > >>>>>> wrote:
> > > >>>>>>
> > > >>>>>>> I have a process that runs in California that wants to talk to
> a
> > > >>>>> process
> > > >>>>>> in
> > > >>>>>>> New York, using Stomp over Websockets.
> > > >>>>>>>
> > > >>>>>>> Also note that my process is not a web app, but I implemented a
> > > >>> stomp
> > > >>>>>> over
> > > >>>>>>> websocket client in C++, in order to connect things up to my
> > > >>> backend.
> > > >>>>>> Maybe
> > > >>>>>>> this was or wasn't a good idea. So, I want my client to talk to
> > > >> the
> > > >>>>>> server
> > > >>>>>>> and subscribe, where their client pushed messages.
> > > >>>>>>>
> > > >>>>>>> I was implementing my own server when I saw that ApacheMQ
> > > >> supported
> > > >>>>> Stomp
> > > >>>>>>> over Websockets. So, I started reading the docs.
> > > >>>>>>>
> > > >>>>>>> It says:
> > > >>>>>>>
> > > >>>>>>> One thing worth noting is that web sockets (just as Ajax)
> > > >>> implements
> > > >>>> ?
> > > >>>>>>> the same origin policy, so you can access only brokers running
> on
> > > >>>> the >
> > > >>>>>>> same host as the web application running the client.
> > > >>>>>>>
> > > >>>>>>> Is this a limitation of the server or the web client?
> > > >>>>>>>
> > > >>>>>>> With that limitation, if I understand right, the server is not
> > > >>> going
> > > >>>> to
> > > >>>>>>> accept websocket connections from a client, of any kind, that
> is
> > > >>> not
> > > >>>> on
> > > >>>>>> the
> > > >>>>>>> same machine?
> > > >>>>>>>
> > > >>>>>>> I am not sure I see the point of that...
> > > >>>>>>>
> > > >>>>>>> If that is indeed its meaning, then how do I get around it in
> > > >> order
> > > >>>> to
> > > >>>>>>> implement my scenario?
> > > >>>>>>>
> > >
> > > --
> > > Tim Bish
> > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Justin Bertram <jb...@apache.org>.
Given that you have an instance of ActiveMQ Artemis on the same machine as
the STOMP client I recommend you do something like this:

  > cd <ARTEMIS_INSTANCE_HOME>/bin
  > ./artemis producer --url tcp://remote-machine:61616 --user yourUser
--password yourPassword

Let me know if that works.


Justin

On Fri, Aug 7, 2020 at 1:49 PM Christopher Pisz <ch...@gmail.com>
wrote:

> I just followed the instructions on
>
> https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
> The broker is the default. Nothing is edited.
>
> "
>
> cd /var/lib
> ${ARTEMIS_HOME}/bin/artemis create mybroker
> /var/lib/mybroker/bin/artemis run
>
>
> On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <ta...@gmail.com> wrote:
>
> > On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > > What I need:
> > > To determine if I can connect to activemq using stomp over websockets
> > from
> > > a remote machine, with a client I wrote.
> > >
> > > What I did:
> > > I wrote my own stomp over websockets client in C++ and built it for
> > > CentOS7, on my home computer.
> > > I installed an ActiveMQ on a remote machine through ssh.
> > > I created the ActiveMQ default broker according to the docs
> > > I attempted to connect with my client
> >
> > Providing the broker configuration you used will help folks answer with
> > insights into what might be wrong there.
> >
> >
> > > What happened:
> > > Connection refused
> > >
> > > What I need:
> > > To figure out why connection is refused
> > >
> > > Ideas of my own:
> > > Does the client work on the local machine with the same version and
> > > configuration of ActiveMQ? Yes
> > > Does someone else's client connect to the remote machine? I dunno, I
> need
> > > someone else's client
> > > Maybe a client that uses something other than websockets will prove
> that
> > > the "same origin policy" in the beginning of the email, is indeed the
> > > problem? I dunno. I need a client that uses another protocol.
> > >
> > >
> > > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <jb...@apache.org>
> > wrote:
> > >
> > >> You're not really explaining what you need.
> > >>
> > >> You say you need "a built client that connects with a different
> > protocol."
> > >> What exactly do you mean by "built"? Does it have to be a binary? If
> so,
> > >> what platform does the binary need to be built for? If it doesn't have
> > to
> > >> be a binary would a python or perl script work? Also, what exactly do
> > you
> > >> mean by "different protocol"? Do you mean a different protocol from
> > STOMP?
> > >> If so, I thought you were specifically trying to test STOMP
> connections.
> > >> How would testing another protocol tell you if STOMP connections are
> > >> working?
> > >>
> > >> It's hard (if not impossible) to provide clear guidance to vague
> > questions.
> > >>
> > >> If it helps, ActiveMQ Artemis ships with command-line clients you can
> > use
> > >> to quickly test a broker. Just type "./artemis help" from the broker
> > >> instance's "bin" directory and look for details about the "producer"
> and
> > >> "consumer" commands.
> > >>
> > >>
> > >> Justin
> > >>
> > >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> > christopherpisz@gmail.com
> > >> wrote:
> > >>
> > >>> Yes, I did a Google search.
> > >>> It yields code examples or javascript libs. I need a built client
> that
> > >>> connects with a different protocol, so I can quickly test that the
> > server
> > >>> will allow clients to connect at all.
> > >>>
> > >>>
> > >>>
> > >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jb...@apache.org>
> > >> wrote:
> > >>>> There are lots of STOMP clients for various platforms written in
> > >> various
> > >>>> programming languages many of which do not use websockets. What
> > exactly
> > >>> do
> > >>>> you need? Did you try doing an Internet search?
> > >>>>
> > >>>>
> > >>>> Justin
> > >>>>
> > >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > >>> christopherpisz@gmail.com
> > >>>> wrote:
> > >>>>
> > >>>>> So I installed ActiveMQ on a remote machine this morning.
> > >>>>> Created the default broker.
> > >>>>> Attempted to connect with the client I wrote using websockets.
> > >>>>> Connection is refused.
> > >>>>>
> > >>>>> I then tried running the examples/protocols/stomp/stomp-websockets
> > >>>> example
> > >>>>> Attempted to connect with the client I write using websockets
> > >>>>> Connection is refused.
> > >>>>> Attempted to connect using the index.html from my machine rather
> than
> > >>> the
> > >>>>> remote(as localhost there)
> > >>>>> Connection refused.
> > >>>>>
> > >>>>> I don't know what to do.
> > >>>>> Is there another premade client I can connect with that doesn't use
> > >>>>> websockets, so I can at least narrow it down and see if the server
> > >>> works
> > >>>> at
> > >>>>> all?
> > >>>>> Any other suggestions?
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > >>> wayne.robinson@gmail.com
> > >>>>> wrote:
> > >>>>>
> > >>>>>> Websockets don’t use the same-origin policies that other AJAX
> > >>> requests
> > >>>>> do.
> > >>>>>> You will most likely need to serve them via TLS to prevent browser
> > >>>>> errors,
> > >>>>>> but there’s nothing special you need to do to setup CORS.
> > >>>>>>
> > >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > >>>>>> christopherpisz@gmail.com>
> > >>>>>> wrote:
> > >>>>>>
> > >>>>>>> I have a process that runs in California that wants to talk to a
> > >>>>> process
> > >>>>>> in
> > >>>>>>> New York, using Stomp over Websockets.
> > >>>>>>>
> > >>>>>>> Also note that my process is not a web app, but I implemented a
> > >>> stomp
> > >>>>>> over
> > >>>>>>> websocket client in C++, in order to connect things up to my
> > >>> backend.
> > >>>>>> Maybe
> > >>>>>>> this was or wasn't a good idea. So, I want my client to talk to
> > >> the
> > >>>>>> server
> > >>>>>>> and subscribe, where their client pushed messages.
> > >>>>>>>
> > >>>>>>> I was implementing my own server when I saw that ApacheMQ
> > >> supported
> > >>>>> Stomp
> > >>>>>>> over Websockets. So, I started reading the docs.
> > >>>>>>>
> > >>>>>>> It says:
> > >>>>>>>
> > >>>>>>> One thing worth noting is that web sockets (just as Ajax)
> > >>> implements
> > >>>> ?
> > >>>>>>> the same origin policy, so you can access only brokers running on
> > >>>> the >
> > >>>>>>> same host as the web application running the client.
> > >>>>>>>
> > >>>>>>> Is this a limitation of the server or the web client?
> > >>>>>>>
> > >>>>>>> With that limitation, if I understand right, the server is not
> > >>> going
> > >>>> to
> > >>>>>>> accept websocket connections from a client, of any kind, that is
> > >>> not
> > >>>> on
> > >>>>>> the
> > >>>>>>> same machine?
> > >>>>>>>
> > >>>>>>> I am not sure I see the point of that...
> > >>>>>>>
> > >>>>>>> If that is indeed its meaning, then how do I get around it in
> > >> order
> > >>>> to
> > >>>>>>> implement my scenario?
> > >>>>>>>
> >
> > --
> > Tim Bish
> >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Christopher Pisz <ch...@gmail.com>.
I just followed the instructions on
https://activemq.apache.org/components/artemis/documentation/2.0.0/using-server.html
The broker is the default. Nothing is edited.

"

cd /var/lib
${ARTEMIS_HOME}/bin/artemis create mybroker
/var/lib/mybroker/bin/artemis run


On Fri, Aug 7, 2020 at 2:45 PM Timothy Bish <ta...@gmail.com> wrote:

> On 8/7/20 2:40 PM, Christopher Pisz wrote:
> > What I need:
> > To determine if I can connect to activemq using stomp over websockets
> from
> > a remote machine, with a client I wrote.
> >
> > What I did:
> > I wrote my own stomp over websockets client in C++ and built it for
> > CentOS7, on my home computer.
> > I installed an ActiveMQ on a remote machine through ssh.
> > I created the ActiveMQ default broker according to the docs
> > I attempted to connect with my client
>
> Providing the broker configuration you used will help folks answer with
> insights into what might be wrong there.
>
>
> > What happened:
> > Connection refused
> >
> > What I need:
> > To figure out why connection is refused
> >
> > Ideas of my own:
> > Does the client work on the local machine with the same version and
> > configuration of ActiveMQ? Yes
> > Does someone else's client connect to the remote machine? I dunno, I need
> > someone else's client
> > Maybe a client that uses something other than websockets will prove that
> > the "same origin policy" in the beginning of the email, is indeed the
> > problem? I dunno. I need a client that uses another protocol.
> >
> >
> > On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <jb...@apache.org>
> wrote:
> >
> >> You're not really explaining what you need.
> >>
> >> You say you need "a built client that connects with a different
> protocol."
> >> What exactly do you mean by "built"? Does it have to be a binary? If so,
> >> what platform does the binary need to be built for? If it doesn't have
> to
> >> be a binary would a python or perl script work? Also, what exactly do
> you
> >> mean by "different protocol"? Do you mean a different protocol from
> STOMP?
> >> If so, I thought you were specifically trying to test STOMP connections.
> >> How would testing another protocol tell you if STOMP connections are
> >> working?
> >>
> >> It's hard (if not impossible) to provide clear guidance to vague
> questions.
> >>
> >> If it helps, ActiveMQ Artemis ships with command-line clients you can
> use
> >> to quickly test a broker. Just type "./artemis help" from the broker
> >> instance's "bin" directory and look for details about the "producer" and
> >> "consumer" commands.
> >>
> >>
> >> Justin
> >>
> >> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <
> christopherpisz@gmail.com
> >> wrote:
> >>
> >>> Yes, I did a Google search.
> >>> It yields code examples or javascript libs. I need a built client that
> >>> connects with a different protocol, so I can quickly test that the
> server
> >>> will allow clients to connect at all.
> >>>
> >>>
> >>>
> >>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jb...@apache.org>
> >> wrote:
> >>>> There are lots of STOMP clients for various platforms written in
> >> various
> >>>> programming languages many of which do not use websockets. What
> exactly
> >>> do
> >>>> you need? Did you try doing an Internet search?
> >>>>
> >>>>
> >>>> Justin
> >>>>
> >>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> >>> christopherpisz@gmail.com
> >>>> wrote:
> >>>>
> >>>>> So I installed ActiveMQ on a remote machine this morning.
> >>>>> Created the default broker.
> >>>>> Attempted to connect with the client I wrote using websockets.
> >>>>> Connection is refused.
> >>>>>
> >>>>> I then tried running the examples/protocols/stomp/stomp-websockets
> >>>> example
> >>>>> Attempted to connect with the client I write using websockets
> >>>>> Connection is refused.
> >>>>> Attempted to connect using the index.html from my machine rather than
> >>> the
> >>>>> remote(as localhost there)
> >>>>> Connection refused.
> >>>>>
> >>>>> I don't know what to do.
> >>>>> Is there another premade client I can connect with that doesn't use
> >>>>> websockets, so I can at least narrow it down and see if the server
> >>> works
> >>>> at
> >>>>> all?
> >>>>> Any other suggestions?
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> >>> wayne.robinson@gmail.com
> >>>>> wrote:
> >>>>>
> >>>>>> Websockets don’t use the same-origin policies that other AJAX
> >>> requests
> >>>>> do.
> >>>>>> You will most likely need to serve them via TLS to prevent browser
> >>>>> errors,
> >>>>>> but there’s nothing special you need to do to setup CORS.
> >>>>>>
> >>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> >>>>>> christopherpisz@gmail.com>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> I have a process that runs in California that wants to talk to a
> >>>>> process
> >>>>>> in
> >>>>>>> New York, using Stomp over Websockets.
> >>>>>>>
> >>>>>>> Also note that my process is not a web app, but I implemented a
> >>> stomp
> >>>>>> over
> >>>>>>> websocket client in C++, in order to connect things up to my
> >>> backend.
> >>>>>> Maybe
> >>>>>>> this was or wasn't a good idea. So, I want my client to talk to
> >> the
> >>>>>> server
> >>>>>>> and subscribe, where their client pushed messages.
> >>>>>>>
> >>>>>>> I was implementing my own server when I saw that ApacheMQ
> >> supported
> >>>>> Stomp
> >>>>>>> over Websockets. So, I started reading the docs.
> >>>>>>>
> >>>>>>> It says:
> >>>>>>>
> >>>>>>> One thing worth noting is that web sockets (just as Ajax)
> >>> implements
> >>>> ?
> >>>>>>> the same origin policy, so you can access only brokers running on
> >>>> the >
> >>>>>>> same host as the web application running the client.
> >>>>>>>
> >>>>>>> Is this a limitation of the server or the web client?
> >>>>>>>
> >>>>>>> With that limitation, if I understand right, the server is not
> >>> going
> >>>> to
> >>>>>>> accept websocket connections from a client, of any kind, that is
> >>> not
> >>>> on
> >>>>>> the
> >>>>>>> same machine?
> >>>>>>>
> >>>>>>> I am not sure I see the point of that...
> >>>>>>>
> >>>>>>> If that is indeed its meaning, then how do I get around it in
> >> order
> >>>> to
> >>>>>>> implement my scenario?
> >>>>>>>
>
> --
> Tim Bish
>
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Timothy Bish <ta...@gmail.com>.
On 8/7/20 2:40 PM, Christopher Pisz wrote:
> What I need:
> To determine if I can connect to activemq using stomp over websockets from
> a remote machine, with a client I wrote.
>
> What I did:
> I wrote my own stomp over websockets client in C++ and built it for
> CentOS7, on my home computer.
> I installed an ActiveMQ on a remote machine through ssh.
> I created the ActiveMQ default broker according to the docs
> I attempted to connect with my client

Providing the broker configuration you used will help folks answer with 
insights into what might be wrong there.


> What happened:
> Connection refused
>
> What I need:
> To figure out why connection is refused
>
> Ideas of my own:
> Does the client work on the local machine with the same version and
> configuration of ActiveMQ? Yes
> Does someone else's client connect to the remote machine? I dunno, I need
> someone else's client
> Maybe a client that uses something other than websockets will prove that
> the "same origin policy" in the beginning of the email, is indeed the
> problem? I dunno. I need a client that uses another protocol.
>
>
> On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <jb...@apache.org> wrote:
>
>> You're not really explaining what you need.
>>
>> You say you need "a built client that connects with a different protocol."
>> What exactly do you mean by "built"? Does it have to be a binary? If so,
>> what platform does the binary need to be built for? If it doesn't have to
>> be a binary would a python or perl script work? Also, what exactly do you
>> mean by "different protocol"? Do you mean a different protocol from STOMP?
>> If so, I thought you were specifically trying to test STOMP connections.
>> How would testing another protocol tell you if STOMP connections are
>> working?
>>
>> It's hard (if not impossible) to provide clear guidance to vague questions.
>>
>> If it helps, ActiveMQ Artemis ships with command-line clients you can use
>> to quickly test a broker. Just type "./artemis help" from the broker
>> instance's "bin" directory and look for details about the "producer" and
>> "consumer" commands.
>>
>>
>> Justin
>>
>> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <christopherpisz@gmail.com
>> wrote:
>>
>>> Yes, I did a Google search.
>>> It yields code examples or javascript libs. I need a built client that
>>> connects with a different protocol, so I can quickly test that the server
>>> will allow clients to connect at all.
>>>
>>>
>>>
>>> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jb...@apache.org>
>> wrote:
>>>> There are lots of STOMP clients for various platforms written in
>> various
>>>> programming languages many of which do not use websockets. What exactly
>>> do
>>>> you need? Did you try doing an Internet search?
>>>>
>>>>
>>>> Justin
>>>>
>>>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
>>> christopherpisz@gmail.com
>>>> wrote:
>>>>
>>>>> So I installed ActiveMQ on a remote machine this morning.
>>>>> Created the default broker.
>>>>> Attempted to connect with the client I wrote using websockets.
>>>>> Connection is refused.
>>>>>
>>>>> I then tried running the examples/protocols/stomp/stomp-websockets
>>>> example
>>>>> Attempted to connect with the client I write using websockets
>>>>> Connection is refused.
>>>>> Attempted to connect using the index.html from my machine rather than
>>> the
>>>>> remote(as localhost there)
>>>>> Connection refused.
>>>>>
>>>>> I don't know what to do.
>>>>> Is there another premade client I can connect with that doesn't use
>>>>> websockets, so I can at least narrow it down and see if the server
>>> works
>>>> at
>>>>> all?
>>>>> Any other suggestions?
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
>>> wayne.robinson@gmail.com
>>>>> wrote:
>>>>>
>>>>>> Websockets don’t use the same-origin policies that other AJAX
>>> requests
>>>>> do.
>>>>>> You will most likely need to serve them via TLS to prevent browser
>>>>> errors,
>>>>>> but there’s nothing special you need to do to setup CORS.
>>>>>>
>>>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
>>>>>> christopherpisz@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I have a process that runs in California that wants to talk to a
>>>>> process
>>>>>> in
>>>>>>> New York, using Stomp over Websockets.
>>>>>>>
>>>>>>> Also note that my process is not a web app, but I implemented a
>>> stomp
>>>>>> over
>>>>>>> websocket client in C++, in order to connect things up to my
>>> backend.
>>>>>> Maybe
>>>>>>> this was or wasn't a good idea. So, I want my client to talk to
>> the
>>>>>> server
>>>>>>> and subscribe, where their client pushed messages.
>>>>>>>
>>>>>>> I was implementing my own server when I saw that ApacheMQ
>> supported
>>>>> Stomp
>>>>>>> over Websockets. So, I started reading the docs.
>>>>>>>
>>>>>>> It says:
>>>>>>>
>>>>>>> One thing worth noting is that web sockets (just as Ajax)
>>> implements
>>>> ?
>>>>>>> the same origin policy, so you can access only brokers running on
>>>> the >
>>>>>>> same host as the web application running the client.
>>>>>>>
>>>>>>> Is this a limitation of the server or the web client?
>>>>>>>
>>>>>>> With that limitation, if I understand right, the server is not
>>> going
>>>> to
>>>>>>> accept websocket connections from a client, of any kind, that is
>>> not
>>>> on
>>>>>> the
>>>>>>> same machine?
>>>>>>>
>>>>>>> I am not sure I see the point of that...
>>>>>>>
>>>>>>> If that is indeed its meaning, then how do I get around it in
>> order
>>>> to
>>>>>>> implement my scenario?
>>>>>>>

-- 
Tim Bish


Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Christopher Pisz <ch...@gmail.com>.
What I need:
To determine if I can connect to activemq using stomp over websockets from
a remote machine, with a client I wrote.

What I did:
I wrote my own stomp over websockets client in C++ and built it for
CentOS7, on my home computer.
I installed an ActiveMQ on a remote machine through ssh.
I created the ActiveMQ default broker according to the docs
I attempted to connect with my client

What happened:
Connection refused

What I need:
To figure out why connection is refused

Ideas of my own:
Does the client work on the local machine with the same version and
configuration of ActiveMQ? Yes
Does someone else's client connect to the remote machine? I dunno, I need
someone else's client
Maybe a client that uses something other than websockets will prove that
the "same origin policy" in the beginning of the email, is indeed the
problem? I dunno. I need a client that uses another protocol.


On Fri, Aug 7, 2020 at 2:33 PM Justin Bertram <jb...@apache.org> wrote:

> You're not really explaining what you need.
>
> You say you need "a built client that connects with a different protocol."
> What exactly do you mean by "built"? Does it have to be a binary? If so,
> what platform does the binary need to be built for? If it doesn't have to
> be a binary would a python or perl script work? Also, what exactly do you
> mean by "different protocol"? Do you mean a different protocol from STOMP?
> If so, I thought you were specifically trying to test STOMP connections.
> How would testing another protocol tell you if STOMP connections are
> working?
>
> It's hard (if not impossible) to provide clear guidance to vague questions.
>
> If it helps, ActiveMQ Artemis ships with command-line clients you can use
> to quickly test a broker. Just type "./artemis help" from the broker
> instance's "bin" directory and look for details about the "producer" and
> "consumer" commands.
>
>
> Justin
>
> On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <christopherpisz@gmail.com
> >
> wrote:
>
> > Yes, I did a Google search.
> > It yields code examples or javascript libs. I need a built client that
> > connects with a different protocol, so I can quickly test that the server
> > will allow clients to connect at all.
> >
> >
> >
> > On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jb...@apache.org>
> wrote:
> >
> > > There are lots of STOMP clients for various platforms written in
> various
> > > programming languages many of which do not use websockets. What exactly
> > do
> > > you need? Did you try doing an Internet search?
> > >
> > >
> > > Justin
> > >
> > > On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> > christopherpisz@gmail.com
> > > >
> > > wrote:
> > >
> > > > So I installed ActiveMQ on a remote machine this morning.
> > > > Created the default broker.
> > > > Attempted to connect with the client I wrote using websockets.
> > > > Connection is refused.
> > > >
> > > > I then tried running the examples/protocols/stomp/stomp-websockets
> > > example
> > > > Attempted to connect with the client I write using websockets
> > > > Connection is refused.
> > > > Attempted to connect using the index.html from my machine rather than
> > the
> > > > remote(as localhost there)
> > > > Connection refused.
> > > >
> > > > I don't know what to do.
> > > > Is there another premade client I can connect with that doesn't use
> > > > websockets, so I can at least narrow it down and see if the server
> > works
> > > at
> > > > all?
> > > > Any other suggestions?
> > > >
> > > >
> > > >
> > > > On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> > wayne.robinson@gmail.com
> > > >
> > > > wrote:
> > > >
> > > > > Websockets don’t use the same-origin policies that other AJAX
> > requests
> > > > do.
> > > > > You will most likely need to serve them via TLS to prevent browser
> > > > errors,
> > > > > but there’s nothing special you need to do to setup CORS.
> > > > >
> > > > > On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > > christopherpisz@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > I have a process that runs in California that wants to talk to a
> > > > process
> > > > > in
> > > > > > New York, using Stomp over Websockets.
> > > > > >
> > > > > > Also note that my process is not a web app, but I implemented a
> > stomp
> > > > > over
> > > > > > websocket client in C++, in order to connect things up to my
> > backend.
> > > > > Maybe
> > > > > > this was or wasn't a good idea. So, I want my client to talk to
> the
> > > > > server
> > > > > > and subscribe, where their client pushed messages.
> > > > > >
> > > > > > I was implementing my own server when I saw that ApacheMQ
> supported
> > > > Stomp
> > > > > > over Websockets. So, I started reading the docs.
> > > > > >
> > > > > > It says:
> > > > > >
> > > > > > One thing worth noting is that web sockets (just as Ajax)
> > implements
> > > ?
> > > > >
> > > > > > the same origin policy, so you can access only brokers running on
> > > the >
> > > > > > same host as the web application running the client.
> > > > > >
> > > > > > Is this a limitation of the server or the web client?
> > > > > >
> > > > > > With that limitation, if I understand right, the server is not
> > going
> > > to
> > > > > > accept websocket connections from a client, of any kind, that is
> > not
> > > on
> > > > > the
> > > > > > same machine?
> > > > > >
> > > > > > I am not sure I see the point of that...
> > > > > >
> > > > > > If that is indeed its meaning, then how do I get around it in
> order
> > > to
> > > > > > implement my scenario?
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Justin Bertram <jb...@apache.org>.
You're not really explaining what you need.

You say you need "a built client that connects with a different protocol."
What exactly do you mean by "built"? Does it have to be a binary? If so,
what platform does the binary need to be built for? If it doesn't have to
be a binary would a python or perl script work? Also, what exactly do you
mean by "different protocol"? Do you mean a different protocol from STOMP?
If so, I thought you were specifically trying to test STOMP connections.
How would testing another protocol tell you if STOMP connections are
working?

It's hard (if not impossible) to provide clear guidance to vague questions.

If it helps, ActiveMQ Artemis ships with command-line clients you can use
to quickly test a broker. Just type "./artemis help" from the broker
instance's "bin" directory and look for details about the "producer" and
"consumer" commands.


Justin

On Fri, Aug 7, 2020 at 1:08 PM Christopher Pisz <ch...@gmail.com>
wrote:

> Yes, I did a Google search.
> It yields code examples or javascript libs. I need a built client that
> connects with a different protocol, so I can quickly test that the server
> will allow clients to connect at all.
>
>
>
> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jb...@apache.org> wrote:
>
> > There are lots of STOMP clients for various platforms written in various
> > programming languages many of which do not use websockets. What exactly
> do
> > you need? Did you try doing an Internet search?
> >
> >
> > Justin
> >
> > On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <
> christopherpisz@gmail.com
> > >
> > wrote:
> >
> > > So I installed ActiveMQ on a remote machine this morning.
> > > Created the default broker.
> > > Attempted to connect with the client I wrote using websockets.
> > > Connection is refused.
> > >
> > > I then tried running the examples/protocols/stomp/stomp-websockets
> > example
> > > Attempted to connect with the client I write using websockets
> > > Connection is refused.
> > > Attempted to connect using the index.html from my machine rather than
> the
> > > remote(as localhost there)
> > > Connection refused.
> > >
> > > I don't know what to do.
> > > Is there another premade client I can connect with that doesn't use
> > > websockets, so I can at least narrow it down and see if the server
> works
> > at
> > > all?
> > > Any other suggestions?
> > >
> > >
> > >
> > > On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <
> wayne.robinson@gmail.com
> > >
> > > wrote:
> > >
> > > > Websockets don’t use the same-origin policies that other AJAX
> requests
> > > do.
> > > > You will most likely need to serve them via TLS to prevent browser
> > > errors,
> > > > but there’s nothing special you need to do to setup CORS.
> > > >
> > > > On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > > christopherpisz@gmail.com>
> > > > wrote:
> > > >
> > > > > I have a process that runs in California that wants to talk to a
> > > process
> > > > in
> > > > > New York, using Stomp over Websockets.
> > > > >
> > > > > Also note that my process is not a web app, but I implemented a
> stomp
> > > > over
> > > > > websocket client in C++, in order to connect things up to my
> backend.
> > > > Maybe
> > > > > this was or wasn't a good idea. So, I want my client to talk to the
> > > > server
> > > > > and subscribe, where their client pushed messages.
> > > > >
> > > > > I was implementing my own server when I saw that ApacheMQ supported
> > > Stomp
> > > > > over Websockets. So, I started reading the docs.
> > > > >
> > > > > It says:
> > > > >
> > > > > One thing worth noting is that web sockets (just as Ajax)
> implements
> > ?
> > > >
> > > > > the same origin policy, so you can access only brokers running on
> > the >
> > > > > same host as the web application running the client.
> > > > >
> > > > > Is this a limitation of the server or the web client?
> > > > >
> > > > > With that limitation, if I understand right, the server is not
> going
> > to
> > > > > accept websocket connections from a client, of any kind, that is
> not
> > on
> > > > the
> > > > > same machine?
> > > > >
> > > > > I am not sure I see the point of that...
> > > > >
> > > > > If that is indeed its meaning, then how do I get around it in order
> > to
> > > > > implement my scenario?
> > > > >
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Timothy Bish <ta...@gmail.com>.
On 8/7/20 2:08 PM, Christopher Pisz wrote:
> Yes, I did a Google search.
> It yields code examples or javascript libs. I need a built client that
> connects with a different protocol, so I can quickly test that the server
> will allow clients to connect at all.
>
You can try the ActiveMQ JMS client library which uses a TCP or SSL 
socket connection and uses the Openwire protocol, or you could use Qpid 
JMS which speaks AMQP 1.0 and can connect via TCP, SSL or Websockets to 
test configured WS and WSS endpoints.

http://qpid.apache.org/components/jms/index.html


There's an older StompJMS library that isn't maintained but should still 
work to test connections

https://github.com/fusesource/stompjms



>
> On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jb...@apache.org> wrote:
>
>> There are lots of STOMP clients for various platforms written in various
>> programming languages many of which do not use websockets. What exactly do
>> you need? Did you try doing an Internet search?
>>
>>
>> Justin
>>
>> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <christopherpisz@gmail.com
>> wrote:
>>
>>> So I installed ActiveMQ on a remote machine this morning.
>>> Created the default broker.
>>> Attempted to connect with the client I wrote using websockets.
>>> Connection is refused.
>>>
>>> I then tried running the examples/protocols/stomp/stomp-websockets
>> example
>>> Attempted to connect with the client I write using websockets
>>> Connection is refused.
>>> Attempted to connect using the index.html from my machine rather than the
>>> remote(as localhost there)
>>> Connection refused.
>>>
>>> I don't know what to do.
>>> Is there another premade client I can connect with that doesn't use
>>> websockets, so I can at least narrow it down and see if the server works
>> at
>>> all?
>>> Any other suggestions?
>>>
>>>
>>>
>>> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <wayne.robinson@gmail.com
>>>
>>> wrote:
>>>
>>>> Websockets don’t use the same-origin policies that other AJAX requests
>>> do.
>>>> You will most likely need to serve them via TLS to prevent browser
>>> errors,
>>>> but there’s nothing special you need to do to setup CORS.
>>>>
>>>> On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
>>>> christopherpisz@gmail.com>
>>>> wrote:
>>>>
>>>>> I have a process that runs in California that wants to talk to a
>>> process
>>>> in
>>>>> New York, using Stomp over Websockets.
>>>>>
>>>>> Also note that my process is not a web app, but I implemented a stomp
>>>> over
>>>>> websocket client in C++, in order to connect things up to my backend.
>>>> Maybe
>>>>> this was or wasn't a good idea. So, I want my client to talk to the
>>>> server
>>>>> and subscribe, where their client pushed messages.
>>>>>
>>>>> I was implementing my own server when I saw that ApacheMQ supported
>>> Stomp
>>>>> over Websockets. So, I started reading the docs.
>>>>>
>>>>> It says:
>>>>>
>>>>> One thing worth noting is that web sockets (just as Ajax) implements
>> ?
>>>>> the same origin policy, so you can access only brokers running on
>> the >
>>>>> same host as the web application running the client.
>>>>>
>>>>> Is this a limitation of the server or the web client?
>>>>>
>>>>> With that limitation, if I understand right, the server is not going
>> to
>>>>> accept websocket connections from a client, of any kind, that is not
>> on
>>>> the
>>>>> same machine?
>>>>>
>>>>> I am not sure I see the point of that...
>>>>>
>>>>> If that is indeed its meaning, then how do I get around it in order
>> to
>>>>> implement my scenario?
>>>>>

-- 
Tim Bish


Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Christopher Pisz <ch...@gmail.com>.
Yes, I did a Google search.
It yields code examples or javascript libs. I need a built client that
connects with a different protocol, so I can quickly test that the server
will allow clients to connect at all.



On Fri, Aug 7, 2020 at 2:05 PM Justin Bertram <jb...@apache.org> wrote:

> There are lots of STOMP clients for various platforms written in various
> programming languages many of which do not use websockets. What exactly do
> you need? Did you try doing an Internet search?
>
>
> Justin
>
> On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <christopherpisz@gmail.com
> >
> wrote:
>
> > So I installed ActiveMQ on a remote machine this morning.
> > Created the default broker.
> > Attempted to connect with the client I wrote using websockets.
> > Connection is refused.
> >
> > I then tried running the examples/protocols/stomp/stomp-websockets
> example
> > Attempted to connect with the client I write using websockets
> > Connection is refused.
> > Attempted to connect using the index.html from my machine rather than the
> > remote(as localhost there)
> > Connection refused.
> >
> > I don't know what to do.
> > Is there another premade client I can connect with that doesn't use
> > websockets, so I can at least narrow it down and see if the server works
> at
> > all?
> > Any other suggestions?
> >
> >
> >
> > On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <wayne.robinson@gmail.com
> >
> > wrote:
> >
> > > Websockets don’t use the same-origin policies that other AJAX requests
> > do.
> > > You will most likely need to serve them via TLS to prevent browser
> > errors,
> > > but there’s nothing special you need to do to setup CORS.
> > >
> > > On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > > christopherpisz@gmail.com>
> > > wrote:
> > >
> > > > I have a process that runs in California that wants to talk to a
> > process
> > > in
> > > > New York, using Stomp over Websockets.
> > > >
> > > > Also note that my process is not a web app, but I implemented a stomp
> > > over
> > > > websocket client in C++, in order to connect things up to my backend.
> > > Maybe
> > > > this was or wasn't a good idea. So, I want my client to talk to the
> > > server
> > > > and subscribe, where their client pushed messages.
> > > >
> > > > I was implementing my own server when I saw that ApacheMQ supported
> > Stomp
> > > > over Websockets. So, I started reading the docs.
> > > >
> > > > It says:
> > > >
> > > > One thing worth noting is that web sockets (just as Ajax) implements
> ?
> > >
> > > > the same origin policy, so you can access only brokers running on
> the >
> > > > same host as the web application running the client.
> > > >
> > > > Is this a limitation of the server or the web client?
> > > >
> > > > With that limitation, if I understand right, the server is not going
> to
> > > > accept websocket connections from a client, of any kind, that is not
> on
> > > the
> > > > same machine?
> > > >
> > > > I am not sure I see the point of that...
> > > >
> > > > If that is indeed its meaning, then how do I get around it in order
> to
> > > > implement my scenario?
> > > >
> > >
> >
>

Re: ActiveMQ - Stomp over websockets - Same Origin Policy

Posted by Justin Bertram <jb...@apache.org>.
There are lots of STOMP clients for various platforms written in various
programming languages many of which do not use websockets. What exactly do
you need? Did you try doing an Internet search?


Justin

On Fri, Aug 7, 2020 at 1:00 PM Christopher Pisz <ch...@gmail.com>
wrote:

> So I installed ActiveMQ on a remote machine this morning.
> Created the default broker.
> Attempted to connect with the client I wrote using websockets.
> Connection is refused.
>
> I then tried running the examples/protocols/stomp/stomp-websockets example
> Attempted to connect with the client I write using websockets
> Connection is refused.
> Attempted to connect using the index.html from my machine rather than the
> remote(as localhost there)
> Connection refused.
>
> I don't know what to do.
> Is there another premade client I can connect with that doesn't use
> websockets, so I can at least narrow it down and see if the server works at
> all?
> Any other suggestions?
>
>
>
> On Wed, Jul 29, 2020 at 5:21 PM Wayne Robinson <wa...@gmail.com>
> wrote:
>
> > Websockets don’t use the same-origin policies that other AJAX requests
> do.
> > You will most likely need to serve them via TLS to prevent browser
> errors,
> > but there’s nothing special you need to do to setup CORS.
> >
> > On Thu, 30 Jul 2020 at 1:47 am, Christopher Pisz <
> > christopherpisz@gmail.com>
> > wrote:
> >
> > > I have a process that runs in California that wants to talk to a
> process
> > in
> > > New York, using Stomp over Websockets.
> > >
> > > Also note that my process is not a web app, but I implemented a stomp
> > over
> > > websocket client in C++, in order to connect things up to my backend.
> > Maybe
> > > this was or wasn't a good idea. So, I want my client to talk to the
> > server
> > > and subscribe, where their client pushed messages.
> > >
> > > I was implementing my own server when I saw that ApacheMQ supported
> Stomp
> > > over Websockets. So, I started reading the docs.
> > >
> > > It says:
> > >
> > > One thing worth noting is that web sockets (just as Ajax) implements ?
> >
> > > the same origin policy, so you can access only brokers running on the >
> > > same host as the web application running the client.
> > >
> > > Is this a limitation of the server or the web client?
> > >
> > > With that limitation, if I understand right, the server is not going to
> > > accept websocket connections from a client, of any kind, that is not on
> > the
> > > same machine?
> > >
> > > I am not sure I see the point of that...
> > >
> > > If that is indeed its meaning, then how do I get around it in order to
> > > implement my scenario?
> > >
> >
>