Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7167537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:35:47+00:00 2026-05-28T14:35:47+00:00

Exception: Error 500: Could not serialize flow execution; make sure all objects stored in

  • 0

Exception:

Error 500: Could not serialize flow execution; make sure all objects stored in 
           flow or flash scope are serializable
Servlet: grails
URI: /payment.com/grails/payment/makePayment.dispatch
Exception Message: payment.com.ValidationService$$EnhancerByCGLIB$$d0f2434f 
Caused by: Could not serialize flow execution; make sure all objects stored in 
           flow or flash scope are serializable 
Class: Unknown 
At Line: [-1] 
Code Snippet:

Discussion:

payment.com: project name         
payment: is the name of (domain, view, controller)
makePayment: is a webflow to make payment
ValidationService: is a service to test if credit card is valid or not

Problem:
i got this error with in my grails project

i have a grails webflow that makes a payment, in this webflow i use grails 
command object to validate input values.
when i call the method isValid from Validation service i got this error

Note:

i try to serialize domain class, controller, service, & command object class, 
but i couldn't solve this issue.

any help, thanks

Edit:

Validation Service

 package payment.com

 import java.io.Serializable;

 class ValidationService implements Serializable{

// Filter out non-digit characters
def getDigitsOnly (String s) {
  StringBuffer digitsOnly = new StringBuffer ();
  char c;
  for (int i = 0; i < s.length (); i++) {
    c = s.charAt (i);
    if (Character.isDigit (c)) digitsOnly.append (c);
  }
  return digitsOnly.toString ();
}

// Perform Luhn check
def isValid (String cardNumber) {
  String digitsOnly = getDigitsOnly (cardNumber);
  int sum = 0;
  int digit = 0;
  int addend = 0;
  boolean timesTwo = false;

  for (int i = digitsOnly.length () - 1; i >= 0; i--) {
    digit = Integer.parseInt (digitsOnly.substring (i, i + 1));
    if (timesTwo){
      addend = digit * 2;
      if (addend > 9) addend -= 9;
    }else{
      addend = digit;
    }
    sum += addend;
    timesTwo = !timesTwo;
  }
  int modulus = sum % 10;

  if (modulus == 0){
      return true
  }else{
    return false
  }
}
}

MakePaymentStep1Command

package payment.com

import org.codehaus.groovy.grails.validation.Validateable;
import java.io.Serializable;
import payment.com.ValidationService;

@Validateable
class MakePaymentStep1Command implements Serializable{
ValidationService ValidationService
String cardNumber

static constraints ={
    cardNumber(blank:false, size:11..16, validator:{ val, obj->
        if (!obj.ValidationService.isValid(val)){
            return ['payment.cardNumber.invalid']
        }
        return true;
    })
}
 }

Payment Controller

class PaymentController{
....
....
def MakePaymentFlow = {
....
    Step1{
        on('submit').to('Step1Submit')
    }
    Step1Submit{
        action {MakePaymentStep1Command cmd ->
            flow.step1Bean = cmd
            if (!flow.step1Bean.validate()){
                error()
            }
        }
        on('error').to('Step1')
        on('success'){
            flow.message = null
        }.to('Step2')
    }


....
}


}

The Error happens here:

 if (!flow.step1Bean.validate()){
     error()
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:35:48+00:00Added an answer on May 28, 2026 at 2:35 pm

    you have a (src/groovy) directory in your grails project. put your validation Service class under this directory, and your makepaymentStepCommand will be as:

    MakePaymentStep1Command

    package payment.com
    
    import java.io.Serializable;
    import payment.com.Validation;
    
    class MakePaymentStep1Command implements Serializable{
    Validation validation
    String cardNumber
    
    static constraints ={
        cardNumber(blank:false, size:11..16, validator:{ val, obj->
             if (!obj.validation.isValid(val)){
                return ['payment.cardNumber.invalid']
             }
             return true;
        })
    }
    }
    

    I am not sure if this works, but try it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I Handler 404 errors without the framework throwing an Exception 500 error
I am getting a Method not found: 'Boolean MyCompany.LibraryAssembly.SomeFunction(System.String)' exception/error when running a VB.NET
I have the following error Exception in thread main javax.naming.NameNotFoundException: CounterBean not bound trying
In my monorails project. I use attribute Rescue [Rescue(generalerror, typeof(System.Exception))] but the error 500
I'm getting this error Error 500: Executing action [pay] of controller [org.gamestrike.PaymentController] caused exception:
After I make two C# HttpWebRequests that throw an exception because of (500) Internal
I actually have two questions regarding exception/error handling in the iPhone app that I
I've created a servlet for sending the exception or error details to the webmaster.
What causes the FAIL - Deploy Upload Failed, Exception: null error message in tomcat?
For the attached code, I get the following compile time error : exception during

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.