Problem while generating a publishing location: java.lang.NullPointerException

I have a show-stopping publishing problem with a particular edition.

When I run it, it fills the console.log with these errors below:

ERROR [PSGeneratePubLocation] Problem while generating a publishing location for variant xxx and contentid xxxx
java.lang.NullPointerException

Many instances but all are for 3 binary templates for the same item type.

I cannot see an obvious root of the problem.
Here are the various observations and things that I have eliminated:

-The bindings on the binary templates are correct
-The location scheme is correct
-The binary content list previews OK, with delivery/location elements populated according to the location scheme logic
-The binaries publish in the correct folders with the correct filename. However in the nonBinary page templates all img src="" attributes that ought to point to these binaries are instead empty
-When previewing these pages render OK. But change the context to 1 and the src attributes are empty
-All items are in a publishable state
-No orphan in-no-folder items

Rhythmyx 6.5.2

Has anyone come across something similar? Any pointers?
Your help is very welcome, am happy to elaborate on any point that I missed/muddled.

Regards,
Giannis

This tells me that there is some thing wrong with the location scheme. Check the location scheme that applies to this image type and template in all the contexts.

Hi bjoginipally,

The location scheme for Context 1 is working: Remember that these binaries do publish on our Dev server, in the correct folder and with the correct filename.

I changed the location scheme to a simple foo.jpg and that worked as well, and my problem persisted.

What breaks is in velocity templates any instance of a $rx.location.generate() or a $link bound to such a function returns nothing for context=1. Yes, the location scheme for context 1 does work as I said.

Hi iordanidis
Some implementations use separate contexts for links and for publishing.
If you have another context like 301 (Site Folder Assembly), check the location generation for that context. If you have not set up a specific location scheme for the template and content type you are using, then the system uses a default location scheme set on the context itself.

Many thanks bjoginipally,

Some of the content lists had the wrong context. Fixing that made everything publish OK and removed the NullPointerException errors from the console.

Many thanks again,
Giannis