Kennedy is warning his audience of the dangers of accepting someone else's opinions simply because it is easier than thinking for themselves and coming up with their own opinions.
The 'comfort of opinion' is the sense of satisfaction one gets from having an opinion on a subject - when we have an opinion, we feel secure in our understanding of the subject. We know what's going on, and we know how we feel about it, and there's no need to worry about it. The 'discomfort of thought' is the difficulty and effort involved in thinking for yourself, questioning your worldview, and reaching an informed opinion.
An alternate phrasing could be "It is easy and pleasant to accept another's opinion without thought.", with the implication that, despite being easy, it is wrong or dangerous to do so. "Think for yourself" and "Question your assumptions" are frequently used phrases that have a similar meaning. All of these are very common exhortations in graduation speeches.