JAXB/MOXY XmlAdapter failing with Possible causes are an incorrect adapter class name or wrong loader has been set

I’m trying to create an adapter to marshal Point2D using a variant of the Point adapter listed in the Moxy docs site (https://www.eclipse.org/eclipselink/documentation/2.4/moxy/advanced_concepts006.htm)

I created MarshallingPoint and MarshallingPointAdapter classes in the same package as the class structure I’m trying to serialize and my adapter is importing jakarta.xml.bind.annotation.adapters.XmlAdapter instead of the javax.xml.bind.annotation.adapters.XmlAdapter used in the examples–this should be correct now, right? At any rate, I’ve also tried it with javax.xml.bind.annotation.adapters.XmlAdapter with the identical results.

I’m using a binding file (and no annotations) with

    <xml-java-type-adapter value="MarshallingPointAdapter" type="java.awt.geom.Point2D"/>

When I run it, I get the following: “An invalid XmlJavaTypeAdapter … was specified for package [tufts.sds]. Possible causes are an incorrect adapter class name or wrong loader has been set.”

I get this no matter what I change, even when I switch to using the example String adapter that converts strings to uppercase (http://blog.bdoughan.com/2012/02/jaxb-and-package-level-xmladapters.html), I still get the same error.

What the heck is this error trying to tell me? Help!

In case it sheds any light, here is my ersatz point class:

package tufts.sds;

public class MarshallingPoint {
       private int x, y;
       public MarshallingPoint() {
          this(0, 0);
       public MarshallingPoint(int x, int y) {
          this.x = x;
          this.y = y;
       public int getX() {
              return x;
       public int getY() {
              return y;

And here is my adapter:

package tufts.sds;  

import java.awt.geom.Point2D;    
import jakarta.xml.bind.annotation.adapters.XmlAdapter; 

public class MarshallingPointAdapter extends XmlAdapter<MarshallingPoint, Point2D> {
   public MarshallingPoint marshal(Point2D val) throws Exception {
      return new MarshallingPoint((int) val.getX(), (int) val.getY());
   public Point2D.Float unmarshal(MarshallingPoint val) throws Exception {
      return new Point2D.Float(val.getX(), val.getY());


As Andrew James pointed out in the comments, the problem was that the types need to be fully qualified.