我有一个带有队列的独立远程 Artemis 服务器,我想配置 WildFly 以便通过 WildFly 本身连接该队列。版本为WildFly 12.0.0.Final和Artemis 2.5.0。
在 Artemis 上,我在broker.xml文件中配置了一个队列,如下所示:
<addresses>
<address name="DemoQueue">
<anycast>
<queue name="DemoQueue" />
</anycast>
</address>
</addresses>
Run Code Online (Sandbox Code Playgroud)
然后我在 WildFly 上配置了一个池连接工厂,创建:
我在standalone-full.xml文件中的最终配置如下:
<server>
...
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
...
<outbound-socket-binding name="remote-artemis">
<remote-destination host="localhost" port="61616"/>
</outbound-socket-binding>
</socket-binding-group>
<subsystem xmlns="urn:jboss:domain:messaging-activemq:3.0">
<server name="default">
...
<remote-connector name="remote-artemis" socket-binding="remote-artemis"/>
<pooled-connection-factory name="remote-artemis" entries="java:/jms/RemoteArtemisCF" connectors="remote-artemis"/>
</server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<external-context name="java:global/federation/remotequeue" module="org.apache.activemq.artemis" class="javax.naming.InitialContext"> …Run Code Online (Sandbox Code Playgroud) 我有一个简单的配置服务器,带有使用spring-cloud-config-server启动器创建的 Spring Boot。
这是我的 application.yaml 文件:
spring:
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo
server:
port: 9999
Run Code Online (Sandbox Code Playgroud)
这是代码:
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
如果我尝试检索任何配置(例如调用http://localhost:9999/bar/default),我会从配置服务器收到异常。我在应用程序启动时遇到了同样的异常cloneOnStart: true。例外的是java.lang.StringIndexOutOfBoundsException: String index out of range: -1。我也尝试过其他 github 存储库,但没有成功。
如果我使用如下所示的本地存储库,一切都会正常工作:
spring:
cloud:
config:
server:
git:
uri: file:///path/to/config
Run Code Online (Sandbox Code Playgroud)
使用的版本有:
在堆栈跟踪的最后部分下面:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in …Run Code Online (Sandbox Code Playgroud)
我在运行此代码时收到“java.lang.ClassCastException: java.lang.Long cannot be cast to [B”:
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxIdle(10);
config.setMinIdle(1);
config.setMaxWaitMillis(30000);
JedisPool jedisPool = new JedisPool(config, "localhost", 6379);
Jedis jedis = null;
jedis = jedisPool.getResource();
String msisdn = "3331122333";
Long balance = new Long(1000);
int balanceValidity = 30;
Transaction t = jedis.multi();
t.watch(msisdn);
t.set(msisdn, balance.toString());
t.expire(msisdn, balanceValidity);
t.exec();
Run Code Online (Sandbox Code Playgroud)
运行此代码一切正常:
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
jedis.watch(msisdn);
jedis.set(msisdn, balance.toString());
jedis.expire(msisdn, balanceValidity);
jedis.publish("myChannel", msisdn + " " + balance.toString());
} finally {
if (jedis != …Run Code Online (Sandbox Code Playgroud)