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 6728743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:12:24+00:00 2026-05-26T10:12:24+00:00

Client sends 50k customers in an xml file. I use Spring Batch’s JaxBMarshaller and

  • 0

Client sends 50k customers in an xml file. I use Spring Batch’s JaxBMarshaller and run in a Spring Batch job.

Spring batch job gets a file, processes, and writes.

Problem is, it’s ALL or NONE validation with jaxb. If I have 50k objects and only 2 of them fail validation, I still need 49,998 objects to be processed by business.

There’s a class, javax.xml.bind.ValidationEventHandler; you can set it to JaxBMarshaller but it only returns true or false and provides no access to the object being marshaled.

I also added on the chunk Reader; error still throws.

Sample schema:

<xs:element name="CustomerLists">
   <xs:complexType>
       <xs:sequence>
           <xs:element name="Customer" maxOccurs="unbounded" type="Customer"/>
       </xs:sequence>
   </xs:complexType>
</xs:element>

Sample Xml:

<a:CustomerLists xmlns:a="http://foo.com">

    <a:Customer>
        ...
    ...
        ...
    </a:Customer>

    <a:Customer>
        ...
    ...
    ...
    </a:Customer>

    <a:Customer>
        ...
    ...
    ...
    </a:Customer>

</a:CustomerLists>

Suggestions?

  • 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-26T10:12:24+00:00Added an answer on May 26, 2026 at 10:12 am

    The javax.xml.bind.ValidationEventHandler is the correct mechanism to use with JAXB. You can access the problematic object for an unmarshal operation through the ValidationEvent:

    package blog.jaxb.validation;
    
    import javax.xml.bind.ValidationEvent;
    import javax.xml.bind.ValidationEventHandler;
    
    public class MyValidationEventHandler implements ValidationEventHandler {
    
        public boolean handleEvent(ValidationEvent event) {
            System.out.println("\nEVENT");
            System.out.println("SEVERITY:  " + event.getSeverity());
            System.out.println("MESSAGE:  " + event.getMessage());
            System.out.println("LINKED EXCEPTION:  " + event.getLinkedException());
            System.out.println("LOCATOR");
            System.out.println("    OBJECT:  " + event.getLocator().getObject());
            return true;
        }
    
    
    }
    

    For More Information

    • http://blog.bdoughan.com/2010/12/jaxb-and-marshalunmarshal-schema.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client server application that sends XML over TCP/IP from client to
Our client sends us a flat file as input, which we then take and
I have a server-client architecture where the client sends an XML to the server
So I'm having this code that processes what the client sends on a pattern.
I am trying to receive a file that client sends using DataInputStream and write
The question is about the following operation: Flash client sends TeX code (or file)
I am going to write a TCP server, the client sends me XML message,
Here's as far as I understand it: Client & Server make connection Client sends
I learned an example of usage of sockets. In this example a client sends
COM Object (Server) sends event notification successfully to COM Client Without: ATL MFC How

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.