EJB Injection d'erreur

J'ai un fichier EAR (JEE6) contenant un ejb-jar (échantillon-ejb) de fichier et un fichier war (échantillon-web).
Voici la structure:

sample-ear
         |----sample-ejb.jar
         |         |---TestEjb.java (@Singleton)
         |
         |----sample-web
                   |---StartupEjb.java (@Singleton,@Startup)
                   |---TestListener.java (@WebListener)

quand je veux injecter TestEjb à StartupEjb ou TestListener:

@EJB
private TestEjb testEjb;

J'obtiens l'erreur suivante:

Glassfish:

Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=com.sample.StartupEjb/testEjb,Remote 3.x interface =com.sample.TestEjb,ejb-link=null,lookup=,mappedName=,jndi-name=com.sample.TestEjb,refType=Session into class com.sample.StartupEjb: Lookup failed for 'java:comp/env/com.sample.StartupEjb/testEjb' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}

weblogic:

Caused By: weblogic.application.naming.ReferenceResolutionException: [J2EE:160200]Error resolving ejb-ref "com.sample.StartupEjb/testEjb" from module "sample-web-1.0-SNAPSHOT.war" of application "com.sample_sample-ear_ear_1.0-SNAPSHOT". The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because no EJBs in the application were found to implement the "com.sample.TestEjb" interface. Link or map this ejb-ref to its target EJB and ensure the interfaces declared in the ejb-ref are correct.

Les deux Glassfish et Weblogic ne peut pas trouver TestEjb!

Par ailleurs, quand j'ai créer une interface à distance pour TestEjb et l'utiliser pour l'injection, il fonctionne bien!
Mais je ne veux pas de définir des interfaces distantes et je veux utiliser les EJB sans interface. Je ne pense pas que je dois définir une interface à distance pour ce simple cas d'utilisation!

Vous pouvez télécharger le code source à partir d'ici: https://dl.dropbox.com/sh/63hn3n9y3p5ypvi/SsG9iZIvx9/sample.zip?dl=1

C'est un simple projet Maven créé à l'aide de NetBeans.

sur TestEJB?
J'ai utilisé @LocalBean et cela a fonctionné.parce que je suis en utilisant JEE6 je n'ai pas besoin de cette annotation plus, mais il ne fonctionne pas sans elle. bizarre ha!
C'est peut-être bizarre, mais "pas de vue" n'est pas entre les différents déploiement des "entités" de sorte que vous besoin d'une sorte de point de vue.

OriginalL'auteur Heidarzadeh | 2012-08-07