Your code will work only if TestEJB is also ejb, you can not inject (use @EJB) ejb refrence in classes which are not ejb's, to call ejb outside ejb container you schould write:
InitialContext ctx = new InitialContext(); test object = (test)ctx.lookup("testjarname/testBean/local");
replace testjarname with real your ear or jar name where bean is packed.
Download JEMS installer for JBoss AS 4.0.4 from http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=193295&release_id=424215
. This is correct version to test EJB3Trail.