Interestingly enough when I worked in Japan I found-as a general rule but not always the higher the position of the person, and often older, the more likely you were to encounter discrimination from them.

I found people working in 'ordinary' jobs such as farmers, much more open minded. Probably because they didn't work in the system, and their jobs allowed them to develop their own opinion.

Sadly, it's not so much that Japanese 'don't like' gaiijin. It is more the case the system is still firmly entrenched in this belief. And since Japanese work in a system, in a group, they are more likely to adopt the belief of the group. Individuality is in many cases discouraged. And I feel this is the end result.

But I worked with many many incredibly hospitable and genuinely kind Japanese people. It is not always the case. Where you come across this situation (of discrimination) it is best to develop a sense of humour. And not come away with negative feelings.