I got a solution for this. Dont know if this is the proper way or not. So, posting it here.
Created another libary project and added the common
java files used by the application and the MDB.
Inclueded the libary in the war and
ejb project.
Will like to know is there are anyother ways for doing this in neatbeans.