Code Monkey home page Code Monkey logo

Comments (7)

maseev avatar maseev commented on July 21, 2024

Can you share a code example so I'll be able to reproduce the problem? This kind of errors usually occur when you're trying to save an object which doesn't implement the java.io.Serializable interface.

from spring-session-orientdb.

maseev avatar maseev commented on July 21, 2024

On second thought, I think it'll be a good idea to make OrientHttpSession::setAttribute throw an exception if an attribute is not serializable. Let me fix this really quick.

from spring-session-orientdb.

maseev avatar maseev commented on July 21, 2024

@grimace Here you go. Now it should be much easier to track down where you set this attribute which apparently doesn't implement the java.io.Serializable interface.

from spring-session-orientdb.

grimace avatar grimace commented on July 21, 2024

Ok, so tried with new Serialization check, with code, then exception. Not sure I understand, is it the SecurityContextImpl that's the issue because it's not serializable?

package com.grimace;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import io.github.maseev.spring.session.orientdb.EnableOrientHttpSession;
import org.springframework.web.bind.annotation.RequestMapping;

import java.security.Principal;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

@EnableOrientHttpSession
@SpringBootApplication
public class Application {

  @RequestMapping("/hello")
  public Map<String,Object> home() {
    Map<String,Object> model = new HashMap<String,Object>();
    model.put("id", UUID.randomUUID().toString());
    model.put("content", "Hello World");
    return model;
  }

  @RequestMapping("/user")
  public Principal user(Principal user) {
    return user;
  }

  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }
}
2016-12-16 15:53:36.586 ERROR 48739 --- [nio-9090-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : 
Servlet.service() for servlet [dispatcherServlet] in context with path [] 
 threw exception [Request processing failed; nested exception is com.orientechnologies.orient.core.exception.OSerializationException:  
   Linked type [class org.springframework.security.core.context.SecurityContextImpl:org.springframework.security.core.context.SecurityContextImpl@442b5a9f: 
   Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@442b5a9f: 
   Principal: org.springframework.security.core.userdetails.User@36ebcb: Username: user; Password: [PROTECTED]; 
   Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_USER; 
   Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: 
   RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null; Granted Authorities: ROLE_USER] cannot be serialized because is not part of registered entities.
    To fix this error register this class
	DB name="testdb"] with root cause

from spring-session-orientdb.

maseev avatar maseev commented on July 21, 2024

With the latest update this shouldn't be a problem any more.

from spring-session-orientdb.

maseev avatar maseev commented on July 21, 2024

@grimace Did this fix solve your problem?

from spring-session-orientdb.

grimace avatar grimace commented on July 21, 2024

yes! Problem solved. Thank you!

from spring-session-orientdb.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.