I have a problem with storing data into Redis storage. Redis is dockerized. I have to mention that connection to Redis is successfully opened and querying data works perfectly fine - there is no issues at all but when I'm trying to store data the exception bellow occurs.
Exception:
org.springframework.data.keyvalue.core.UncategorizedKeyValueException: nested exception is java.lang.NullPointerException
at org.springframework.data.keyvalue.core.KeyValuePersistenceExceptionTranslator.translateExceptionIfPossible(KeyValuePersistenceExceptionTranslator.java:49)
at org.springframework.data.keyvalue.core.KeyValueTemplate.resolveExceptionIfPossible(KeyValueTemplate.java:484)
at org.springframework.data.keyvalue.core.KeyValueTemplate.execute(KeyValueTemplate.java:379)
at org.springframework.data.keyvalue.core.KeyValueTemplate.update(KeyValueTemplate.java:209)
at org.springframework.data.keyvalue.repository.support.SimpleKeyValueRepository.save(SimpleKeyValueRepository.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Model:
@RedisHash("TaskSubscriber")
public class TaskSubscriber implements Serializable {
private static final long serialVersionUID = 20190329202800L;
private String id;
private String destination;
private String username;
@SuppressWarnings("unused")
public TaskSubscriber() { }
public TaskSubscriber(String sessionId, String destination, String username)
{
this.id = sessionId;
this.destination = destination;
this.username = username;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
Repository:
@Repository
public interface TaskSubscriberRepository extends JpaRepository<TaskSubscriber, String> {
List<TaskSubscriber> findAllByDestination(String destination);
List<TaskSubscriber> findAllByUsername(String username);
}
In service class I'm just calling save method from TaskSubscriber repository passing TaskSubscriber model with data.
Does anyone have an idea how to fix this? Thank you in advance.