gpt4 book ai didi

javascript - 野蝇 10 AMQ119032 : User does not have permission CREATE_NON_DURABLE_QUEUE on address

转载 作者:行者123 更新时间:2023-12-02 14:14:45 25 4
gpt4 key购买 nike

我正在使用 WildFly 10.1..0.Final,我想使用 STOMP over WebSocket 连接 JavaScript 客户端。我正在使用 stomp.js。 WildFly 包括 Apache ActiveMQ Artemis Message Broker 版本 1.1.0.wildfly-017。

首先,我使用 add-user.bat 添加了一个名为“myguest”的用户。该用户是“应用程序用户”。

接下来,我尝试了许多不同的方法来配置主题和安全设置。请检查我尝试配置主题的不同方式。都不起作用。

我尝试创建“jms.topic.chat”主题和一些变体。不工作。

我的standalone-full.xml是:

   ...
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
<role name="myguest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<security-setting name="jms.topic.chat">
<role name="myguest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
<role name="guest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
</security-setting>
<security-setting name="topic.chat">
<role name="myguest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
<role name="guest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
</security-setting>
<security-setting name="jms.topic.chat2">
<role name="myguest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
<role name="guest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
</security-setting>
<security-setting name="topic.chat2">
<role name="myguest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
<role name="guest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true" manage="true"/>
</security-setting>

<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0"/>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>

<!-- I create it for Websocket -->
<remote-acceptor name="websocket-stomp" socket-binding="netty-ws"/>
<in-vm-acceptor name="in-vm" server-id="0"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="chat" entries="java:jboss/exported/topic/chat"/>
<jms-queue name="chat2" entries="java:jboss/topic/chat2"/>
<jms-queue name="chat3" entries="java:/topic/chat" durable="false"/>
<jms-queue name="chat4" entries="java:/topic/chat4"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>

...

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="iiop" interface="unsecure" port="3528"/>
<socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>

<!-- This is created for me: -->
<socket-binding name="netty-ws" port="61614" fixed-port="false"/>


<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>

这是 HTML 客户端:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->

<title>STOMP over Websockets to HornetQ</title>

<!-- Bootstrap -->
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
.connectionconfig input {
width: 100%;
}

</style>


<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>

<script src="js/sockjsclient/dist/sockjs-1.1.1.js"></script>
<script src="js/stomp/stomp.js"></script>
<script type="text/javascript">

var idClient = 1; // 1,2,3,...
var clientName = "cliente"+idClient; // cliente1, cleinte2, cliente3, ...


var destination = $('#destination').val();

var stompClient = null;

function connect() {

var url = $('#connect_URL').val();
var login = $('#connect_loging').val();
var password = $('#connect_password').val();
destination = $('#destination').val();

console.log(url+" "+login+" "+password+" "+destination);
stompClient = Stomp.client(url);

//stompClient.connect({}, function(frame) {
stompClient.connect(login,password, function(frame) {
setConnected(true);
console.log('Connected: ' + frame);

stompClient.subscribe(destination, function(messageOutput) {
if (messageOutput.body) {
showMessageOutput(JSON.parse(messageOutput.body));
} else {
console.log("got empty message");
}
});



});
}

function setConnected(connected) {
document.getElementById('connect').disabled = connected;
document.getElementById('disconnect').disabled = !connected;
document.getElementById('conversationDiv').style.visibility
= connected ? 'visible' : 'hidden';
document.getElementById('response').innerHTML = '';
}

function disconnect() {
if(stompClient != null) {
stompClient.disconnect();
}
setConnected(false);
console.log("Disconnected");
}

function sendMessage() {
var from = document.getElementById('from').value;
var text = document.getElementById('text').value;

stompClient.send("/app/chat.private", {},
JSON.stringify({'from':from, 'text':text}));
}

function showMessageOutput(messageOutput) {
var response = document.getElementById('response');
var p = document.createElement('p');
p.style.wordWrap = 'break-word';
p.appendChild(document.createTextNode(messageOutput.from + ": "
+ messageOutput.text + " (" + messageOutput.time + ")"));
response.appendChild(p);
}



$( document ).ready(function() {
// E.G. Cliente 1, Cliente 2, etc
$("#clientIdSpan").html(idClient);

disconnect();

$("#from").val(clientName); // cleinte1, cleinte2, etc..



});


</script>
</head>

<body>
<noscript><h2>Enable Java script and reload this page to run Websocket Demo</h2></noscript>
<h1>Cliente <span id="clientIdSpan">x</span></h1>
<div>
<div class="connectionconfig">
<dl>
<dt><label for="connect_URL">Server URL</label></dt>
<dd><input type="text" id="connect_URL" placeholder="ws://..." value="ws://localhost:61614/stomp"></dd>
<dt><label for="connect_loging">Loging</label></dt>
<dd><input type="text" id="connect_loging" placeholder="User loging: sergio o guest" value="myguest"></dd>
<dt><label for="connect_password">Password</label></dt>
<dd><input type="text" id="connect_password" placeholder="User passwor" value="myguest"></dd>
<dt><label for="destination">Destination</label></dt>
<dd><input type="text" id="destination" placeholder="Destination" value="jms.topic.chat"></dd>
<dt><label for="from">Nickname</label></dt>
<dd><input type="text" id="from" placeholder="Choose a nickname"/></dd>
</dl>

</div>
<br />
<div>
<button id="connect" onclick="connect();">Connect</button>
<button id="disconnect" disabled="disabled" onclick="disconnect();">
Disconnect
</button>
</div>
<br />
<div id="conversationDiv">
<input type="text" id="text" placeholder="Write a message..."/>
<button id="sendMessage" onclick="sendMessage();">Send</button>
<p id="response"></p>
</div>
</div>

</body>
</html>

Chrome 的控制台输出是:

Opening Web Socket...
stomp.js:145 Web Socket Opened...
stomp.js:145 >>> CONNECT
login:myguest
passcode:myguest
accept-version:1.1,1.0
heart-beat:10000,10000

<<< CONNECTED
version:1.1
session:-109518014
server:ActiveMQ-Artemis/1.1.0.wildfly-017 ActiveMQ Artemis Messaging Engine
heart-beat:10000,10000

connected to server ActiveMQ-Artemis/1.1.0.wildfly-017 ActiveMQ Artemis Messaging Engine

Connected: CONNECTED
heart-beat:10000,10000
server:ActiveMQ-Artemis/1.1.0.wildfly-017 ActiveMQ Artemis Messaging Engine
session:-109518014
version:1.1

>>> SUBSCRIBE
id:sub-0
destination:jms.topic.chat


<<< ERROR
message:AMQ339016\c Error creating subscription sub-0
content-type:text/plain
content-length:102

AMQ119032: User: myguest does not have permission='CREATE_NON_DURABLE_QUEUE' on address jms.topic.chat

我在控制台 Web 浏览器中收到此错误:

<<< ERROR
message:AMQ339016\c Error creating subscription sub-0
content-type:text/plain
content-length:102

AMQ119032: User: myguest does not have permission='CREATE_NON_DURABLE_QUEUE' on address jms.topic.chat

我不明白为什么忽略为“jms.topic.chat”模式配置的 create-non-durable-queue="true"标志。

我在互联网上没有找到有关 AMQ119032 错误的信息。以及 WildFly 10 管理 XML 配置的方式。

谢谢

最佳答案

我发现问题是什么,当您创建应用程序用户时,您需要添加用户拥有的组。问题在于“add-user.bat”脚本将其称为“组”,而在消息传递 ActiveMQ 中将其称为“Angular 色”。当“add-user.bat 询问组时,您是否希望该用户属于可写的组,例如“guest”。

您希望该用户属于哪些组? (请输入逗号分隔的列表,或者留空不填写)[ ]: guest

目前这对我有用。

What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : myguest2
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
- The password should be different from the username
- The password should not be one of the following restricted values {root, admin, administrator}
- The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password : myguest2
WFLYDM0098: The password should be different from the username
Are you sure you want to use the password entered yes/no? yes
Re-enter Password : myguest2
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: guest
About to add user 'myguest2' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'myguest2' to file 'C:\WildFlyServer\wildfly-10.1.0.Final\standalone\configuration\applicationusers.properties'
Added user 'myguest2' to file 'C:\WildFlyServer\wildfly-10.1.0.Final\domain\configuration\application-users.properties'
Added user 'myguest2' with groups guest to file 'C:\WildFlyServer\wildfly-10.1.0.Final\standalone\configuration\application-roles.properties'
Added user 'myguest2' with groups guest to file 'C:\WildFlyServer\wildfly-10.1.0.Final\domain\configuration\application-roles.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting conn
ection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="bXlndWVzdDI=" />
Presione una tecla para continuar . . .

关于javascript - 野蝇 10 AMQ119032 : User does not have permission CREATE_NON_DURABLE_QUEUE on address,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39134984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com