San Jaisy
San Jaisy

Reputation: 17048

Missing runtime type for required type handler for type: fete.bird.entity.Root Microsteam with micronaut

I have the below root object

public class Root {
    private Map<UUID, Country> country = new HashMap<>();
    private Map<UUID, Prediction> prediction = new HashMap<>();
    private Map<UUID, UserMatchPoints> userMatchPoint = new HashMap<>();

    @NonNull
    public Map<UUID, Country> getCountry() {
        return this.country;
    }
    @NonNull
    public Map<UUID, Prediction> getPrediction() {
        return this.prediction;
    }
    @NonNull
    public Map<UUID, UserMatchPoints> getUserMatchPoint() {
        return this.userMatchPoint;
    }
}

I am using Java Record and java 17

public record Country(UUID id,
                      String name,
                      String shortName,
                      String url,
                      Optional<Integer> matchPlayed,
                      Optional<Integer> win,
                      Optional<Integer> draw,
                      Optional<Integer> lost,
                      Optional<Integer> points) {
}

public record Prediction(UUID id,
                         UUID matchId,
                         UUID winnerCountry,
                         WinningTime winningTime,
                         int firstTeamScore,
                         int secondTeamScore,
                         int penaltyFirstTeamScore,
                         int penaltySecondTeamScore,
                         UUID userId) {
}

Build.gradle

tasks.withType<JavaExec> {
    jvmArgs("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED")
}

Exception

 ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: Error instantiating bean of type  [io.micronaut.eclipsestore.DefaultRootProvider]

Caused by: org.eclipse.serializer.persistence.exceptions.PersistenceException: Missing runtime type for required type handler for type: fete.bird.entity.Root
    at org.eclipse.serializer.persistence.types.PersistenceTypeHandlerManager$Default.validateExistingType(PersistenceTypeHandlerManager.java:390)
    at org.eclipse.serializer.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandler(PersistenceTypeHandlerManager.java:439)
    at org.eclipse.serializer.persistence.types.PersistenceTypeHandlerManager$Default.lambda$ensureTypeHandlers$2(PersistenceTypeHandlerManager.java:486)
    at org.eclipse.serializer.collections.ChainStorageStrong.iterate(ChainStorageStrong.java:1316)
    at org.eclipse.serializer.collections.HashEnum.iterate(HashEnum.java:693)
    at org.eclipse.serializer.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandlers(PersistenceTypeHandlerManager.java:485)
    at org.eclipse.serializer.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandlersByTypeIds(PersistenceTypeHandlerManager.java:477)
    at org.eclipse.store.storage.embedded.types.EmbeddedStorageManager$Default.ensureRequiredTypeHandlers(EmbeddedStorageManager.java:344)
    at org.eclipse.store.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:251)
    at org.eclipse.store.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:95)
    at io.micronaut.eclipsestore.conf.StorageManagerFactory.createStorageManager(StorageManagerFactory.java:68)
    at io.micronaut.eclipsestore.conf.$StorageManagerFactory$CreateStorageManager0$Definition.doInstantiate(Unknown Source)
    at io.micronaut.context.AbstractInitializableBeanDefinition.instantiate(AbstractInitializableBeanDefinition.java:770)
    at io.micronaut.context.BeanDefinitionDelegate.instantiate(BeanDefinitionDelegate.java:156)
    at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2311)

Upvotes: -1

Views: 63

Answers (1)

San Jaisy
San Jaisy

Reputation: 17048

The issue was I had created the data already with another package structure and later I changed it to another package, so the serialization was not able to find the new package name for the root.

Upvotes: 0

Related Questions