It is tricky to ensure that you are using an appropriate version combination of NetBeans, Java and GlassFish. I don't know of any single piece of documentation that helps, but this is what you can do:
In your case, although you don't mention you GlassFish version, since you are using NetBeans 15 you must use a JDK >= 11. From the Release Notes for NetBeans 15:
The Apache NetBeans 15 binary releases require JDK 11+, and officially
support running on JDK 11 and JDK 17.
So your current NetBeans environment which uses JDK 10 is invalid. GlassFish is not your biggest concern; you need to update NetBeans to use a valid JDK first.
This answer summarizes GlassFish 6.x <=> JDK compatibility. If you are using a GlassFish release < 6 then you must use JDK 8 which is not supported by any recent release of NetBeans.
And regardless of all that, unless you have a compelling reason for doing so, you should stop using JDK 10. It is unsupported, may present security risks, and is definitely problematic for a working NetBeans/Java/GlassFish environment. Once you have installed a valid JDK, also ensure that you remove all traces of JDK 10 from your environment.
One stable combination you might consider is NetBeans 15 + JDK 11 + GlassFish 6.1, but there are plenty of other possibilities.
Update your question if you still have problems after upgrading your JDK.