while sending a mail with pdf attachment in amazon server using javamail API, Its throwing null pointer exception in the logs. But same code is working in local.
The problem may be that you can't access the URL in filePath.
Is filePath a "file:" URL? If so, why not just use a FileDataSource?