Which version of JBossAS do you use?
Create a application.xml with the correct order of modules. So in your case, list the WAR first and then the EJB jar. Then create a jboss-app.xml (if you don't already have one) and add the following to it:
Place the jboss-app.xml in the META-INF of the EAR. This will ensure that the order in which the modules are listed in application.xml will be strictly followed.