2
votes

My current goal is build a project using spring boot starters for testing distributed command using Jgroups.

I got this message when it runs: Received unknown message: org.axonframework.jgroups.commandhandling.JoinMessage

It comes from org.axonframework.jgroups.commandhandling.JGroupsConnector

@Override
public void receive(Message msg) {
    Object message = msg.getObject();
    if (message instanceof JoinMessage) {
        processJoinMessage(msg, (JoinMessage) message);
    } else if (message instanceof JGroupsDispatchMessage) {
        processDispatchMessage(msg, (JGroupsDispatchMessage) message);
    } else if (message instanceof JGroupsReplyMessage) {
        processReplyMessage((JGroupsReplyMessage) message);
    } else {
        logger.warn("Received unknown message: " + message.getClass().getName());
    }
}

Current POM

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>spring-axon-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>spring-axon-example</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.axonframework</groupId>
        <artifactId>axon-spring-boot-starter</artifactId>
        <version>3.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.axonframework</groupId>
        <artifactId>axon-spring-boot-starter-jgroups</artifactId>
        <version>3.2.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</project>

Console output

2018-07-20 08:38:01.652  WARN 9439 --- [localhost-29107] o.a.j.commandhandling.JGroupsConnector   : Received unknown message: org.axonframework.jgroups.commandhandling.JGroupsDispatchMessage

Application

package com.example.demo;

import org.axonframework.eventsourcing.eventstore.EventStorageEngine;
import org.axonframework.eventsourcing.eventstore.inmemory.InMemoryEventStorageEngine;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class SpringAxonExampleApplication {

public static void main(String[] args) {
    SpringApplication.run(SpringAxonExampleApplication.class, args);
}

@Bean
public EventStorageEngine eventStoreEngine() {
    return new InMemoryEventStorageEngine();
}
}

Applications.properties

spring.datasource.url=jdbc:mariadb://localhost/axoncqrs
spring.datasource.username=1
spring.datasource.password=1
server.port=8033
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

java.net.preferIPv4Stack=true
axon.distributed.enabled=true
axon.distributed.jgroups.bind-addr=GLOBAL
axon.distributed.jgroups.bind-port=7800
axon.distributed.jgroups.cluster-name=Axon
axon.distributed.jgroups.configuration-file=default_tcp_gossip.xml
axon.distributed.jgroups.gossip.hosts=localhost[12001]
axon.distributed.jgroups.gossip.auto-start=true

It's like there are two classes definition at the same time. I feel lost, Any clues?

Greetings

Francisco

1
That's weird Francisco, cant recall this happening to me when using the JGroups Distributed set up. Do you mind sharing all the dependencies you're using? That might shed some light on the situation.Steven
I updated the postFrancisco Ortiz
I answered the question, although I am still not positive that'll fix it... Additionally though, you can up the Axon Framework version to 3.3.2.Steven

1 Answers

0
votes

I was hoping that from your pom.xml and properties I might something to be amiss. But, the only thing I am able to guess is that you might have two different versions of the Axon Framework on your classpath / in your Maven repository.. Have you tried removing/clearing out all existing libraries your dependent on and running the application again?


Update

Bit late to the game, but I notice you are using the spring-boot-devtools dependency. Mind you, that Axon Framework at the moment does not play nicely with the devtools, as is marked in this issue for example. Have you tried removing the dependency to resolving the problem at hand?