# EJB Injection Problem und weitere Frage



## Gelöschtes Mitglied 5909 (22. Okt 2008)

Hallo,

ich habe ein Problem mit der Dependency Injection bei EJB 3.0 mit Glassfish.

Ich habe mir mal ein kleines Tutorial angeschaut wo das ganze sehr einfach funktioniert:

http://j2ee.netbeans.org/NetBeans_EJB3.html

Aus dem Grund verwende ich für dieses Projekt Ausnahmsweise mal Netbeans und genau das was in dem
Tutorial wie von selbst geht Klappt bei mir nicht:

Ich möchte ein EJB in ein Servlet Injecten und der spuckt mir dann folgendes aus:

com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref de.mas.ejb3.servlet.TestServlet/webShopBean@jndi: de.mas.ejb3.logic.WebShopRemote@null@de.mas.ejb3.logic.WebShopRemote@Session@null into class de.mas.ejb3.servlet.TestServlet

Wenn ich das ganze richtig verstanden habe findet er die Bean nicht im JNDI Context. Jetzt sind das ganze meine ersten J2EE gehversuche und ich weiß zwar was JNDI ist, aber nicht wie ich das ganze richtig einrichten kann. Das verwirrende ist dass im Netbeans Projekt keine ejb-jar.xml vorhanden ist, was aber auch bei EJB 3 nicht nötig is afaik.
Wo trage ich aber die JNDI namen bzw ids ein, damit Glassfish das ganze findet und auflösen kann?


-----------------

Dann habe ich noch eine weitere Frage. Wie man oben sieht baue ich einen kleinen WebShop (zu Demozwecken für Studienarbeit) und verwende für die Persistenz JPA, Logik EJB und Darstellung Servlet/JSP (vielleicht les ich mich noch in JSF ein, mal schaun). Die Kommunikation zwischen den Schichten ist mir klar (wenn das oben genannte Problem beseitigt ist sollte das ganze ja klappen), aber innerhalb der Geschäftslogik nicht. Das WebShopBean von oben soll für die Basisfunktionen zuständig sein: Login, alle Artikel anzeigen, Artikel nach Kategorie Anzeigen etc.
Wenn ein Benutzer aber etwas bestellen will, verwende ich das OrderBean, dass zusätzliche Funktionalität bereitstellt.
Wie leite ich die Funktionalität weiter? soll ich in den Servlets mehrere EJBs Injekten? In einer EJB eine neue Instanz einer anderen EJB zu erstellen ist denke ich schwachsinn, da es ja die Aufgabe des Containers bzw Application Servers ist. Wie gewährleiste ich dass ich in der gleichen Session bleibe?

Gibt es dafür eine einfache Variante oder muss ich mich auchnoch in JMS einarbeiten ?

Fragen über Fragen, ich hoffe mir kann sie jemand beantworten 

besten Dank im vorraus.


----------



## gex (22. Okt 2008)

Hi

Welche Projekte hast du?
- ein Web-Projekt (WAR)
- ein EJB-Projekt
- ein Enterprise Projekt (EAR)

Im EAR hast du sowohl das WAR wie auch das EJB Projekt als Java EE Module drin?

Deployst du nun das EAR, oder nur das WAR? Wenn du nur das WAR deployst fehlt dir natürlich das EJB.

Ansonsten wäre vielleicht ein paar Informationen zu deinem Projekt Setup hilfreich.


----------



## Gelöschtes Mitglied 5909 (22. Okt 2008)

Nun zuerst habe ich in Eclipse mit JPA meine "Entitiy Beans" gemacht.
Dannach wusste ich nicht genau wie ich in Eclipse ein Lauffähiges Webprojekt mache und bin auf das Tutorial
oben gestoßen. Dann habe ich die JPA Beans in ein neues "Enterprise Application" Projekt in Netbeans kopiert.
Das ganze hat folgende Struktur:





Netbeans Spuckt beim bauen folgendes aus:

```
pre-init:
init-private:
init-userdir:
init-user:
init-project:
do-init:
post-init:
init-check:
init:
deps-jar:
deps-j2ee-archive:
init:
init:
deps-jar:
compile:
library-inclusion-in-manifest:
dist-ear:
deps-jar:
compile:
library-inclusion-in-manifest:
dist-ear:
init:
deps-jar:
compile:
library-inclusion-in-manifest:
dist-ear:
init:
deps-module-jar:
deps-ear-jar:
init:
deps-jar:
compile:
library-inclusion-in-manifest:
dist-ear:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
do-ear-dist:
dist-ear:
pre-pre-compile:
pre-compile:
do-compile:
post-compile:
compile:
pre-dist:
do-dist-without-manifest:
do-dist-with-manifest:
Building jar: G:\Eigene Dateien\NetBeansProjects\webshop\dist\webshop.ear
post-dist:
dist:
BUILD SUCCESSFUL (total time: 0 seconds)
```

Wenn ich das ganze dann starte deployed netbeans das ganze automatisch:


```
pre-run-deploy:
Checking for missing JDBC drivers ...
Start registering the project's server resources
Finished registering server resources
Incrementally deploying webshop#webshop-app-client.jar_localhost:4852_server
Incrementally deploying webshop#/webshop-war_localhost:4852_server
Incrementally deploying webshop#webshop-ejb.jar_localhost:4852_server
Incrementally deploying webshop_localhost:4852_server
Completed incremental distribution of webshop
post-run-deploy:
run-deploy:
Browsing: [url]http://localhost:8084/webshop-war/[/url]
run-display-browser:
run-ac:
run:
BUILD SUCCESSFUL (total time: 12 seconds)
```

In der Glassfish Administrationsoberfläche finde ich zwar kein ejb Module, aber eine "Unternehmensanwendung":





Dort sind ist eine ejb.jar und eine war.

Wenn ich auf die URL gehe komme ich auch auf die richtige Seite. Wenn ich aber das Servlet aufrufe kommt folgende Errorpage:





Und die Server log dazu:


```
**RemoteBusinessJndiName: de.mas.ejb3.logik.WebShopRemote; remoteBusIntf: de.mas.ejb3.logik.WebShopRemote
LDR5010: Alle EJBs von [webshop] erfolgreich geladen!
Fehler beim Versuch, Manifesterweiterungen der JAR-Datei G:\Eigene Dateien\NetBeansProjects\webshop\dist\gfdeploy\webshop-ejb.jar zu verarbeiten; ignorieren Sie diesen Fehler, und fahren Sie fort
java.io.FileNotFoundException: G:\Eigene Dateien\NetBeansProjects\webshop\dist\gfdeploy\webshop-ejb.jar (Das System kann die angegebene Datei nicht finden)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at java.util.jar.JarFile.<init>(JarFile.java:133)
        at java.util.jar.JarFile.<init>(JarFile.java:97)
        at com.sun.enterprise.appclient.jws.ExtensionFileManager.findExtensionTransitiveClosure(ExtensionFileManager.java:240)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.findExtensions(AppclientJWSSupportInfo.java:1543)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.prepareAppclient(AppclientJWSSupportInfo.java:1384)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.prepareNestedAppclient(AppclientJWSSupportInfo.java:1495)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.prepareApplication(AppclientJWSSupportInfo.java:1244)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.startJWSServicesForApplication(AppclientJWSSupportInfo.java:475)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportManager.handleApplicationEvent(AppclientJWSSupportManager.java:156)


        at com.sun.enterprise.server.event.ApplicationLoaderEventNotifier.notifyListeners(ApplicationLoaderEventNotifier.java:117)
        at com.sun.enterprise.server.AbstractLoader.notifyAppEvent(AbstractLoader.java:883)
        at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:189)
        at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126)
        at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:244)
        at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:225)
        at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:217)
        at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:442)
        at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:120)
        at com.sun.enterprise.server.PEMain.run(PEMain.java:411)
        at com.sun.enterprise.server.PEMain.main(PEMain.java:338)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.server.PELaunch.main(PELaunch.java:412)
Registering ad hoc servlet: WebPathPath: context root = "/webshop", path = "/webshop-app-client'
Java Web Start services started for application com.sun.enterprise.appclient.jws.ApplicationContentOrigin@13892b3 registration name=webshop
    com.sun.enterprise.appclient.jws.NestedAppclientContentOrigin@1275595 registration name=webshop, context root=/webshop/webshop-app-client, module name=
, parent=webshop
WEB0302: Sun-Java-System/Application-Server wird gestartet.
WEB0712: Sun-Java-System/Application-Server HTTP/1.1 wird gestartet auf 8084
WEB0712: Sun-Java-System/Application-Server HTTP/1.1 wird gestartet auf 8185
WEB0712: Sun-Java-System/Application-Server HTTP/1.1 wird gestartet auf 4852
SMGT0007: Selbstverwaltungsregeldienst ist aktiviert
Start des Anwendungsservers abgeschlossen.
JavaServer Faces-Implementierung (1.2_04-b20-p03) von Sun wird für Kontext '' initialisiert
JBIMA0452: Successfully processed 0 Service Assemblies during startup.
JBIFW0012: JBI framework startup complete.
WebModule[/webshop-war]StandardWrapper.Throwable
java.lang.RuntimeException: WEB5002: Ausnahmefehler in handleBeforeEvent.
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:263)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref de.mas.ejb3.servlet.TestServlet/webShopBean@jndi: [email]de.mas.ejb3.logic.WebShopRemote@null@de.mas.ejb3.logic.WebS[/email]hopRemote@Session@null into class de.mas.ejb3.servlet.TestServlet
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        ... 30 more
Caused by: javax.naming.NameNotFoundException: de.mas.ejb3.logic.WebShopRemote#de.mas.ejb3.logic.WebShopRemote not found
        at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 33 more
StandardWrapperValve[TestServlet]: PWC1382: Ausnahmezuweisung für Servlet TestServlet vornehmen
java.lang.RuntimeException: WEB5002: Ausnahmefehler in handleBeforeEvent.
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:263)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref de.mas.ejb3.servlet.TestServlet/webShopBean@jndi: [email]de.mas.ejb3.logic.WebShopRemote@null@de.mas.ejb3.logic.WebS[/email]hopRemote@Session@null into class de.mas.ejb3.servlet.TestServlet
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        ... 30 more
Caused by: javax.naming.NameNotFoundException: de.mas.ejb3.logic.WebShopRemote#de.mas.ejb3.logic.WebShopRemote not found
        at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 33 more
WebModule[/webshop-war]StandardWrapper.Throwable
java.lang.RuntimeException: WEB5002: Ausnahmefehler in handleBeforeEvent.
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:263)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref de.mas.ejb3.servlet.TestServlet/webShopBean@jndi: [email]de.mas.ejb3.logic.WebShopRemote@null@de.mas.ejb3.logic.WebS[/email]hopRemote@Session@null into class de.mas.ejb3.servlet.TestServlet
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        ... 30 more
Caused by: javax.naming.NameNotFoundException: de.mas.ejb3.logic.WebShopRemote#de.mas.ejb3.logic.WebShopRemote not found
        at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 33 more
StandardWrapperValve[TestServlet]: PWC1382: Ausnahmezuweisung für Servlet TestServlet vornehmen
java.lang.RuntimeException: WEB5002: Ausnahmefehler in handleBeforeEvent.
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:263)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref de.mas.ejb3.servlet.TestServlet/webShopBean@jndi: [email]de.mas.ejb3.logic.WebShopRemote@null@de.mas.ejb3.logic.WebS[/email]hopRemote@Session@null into class de.mas.ejb3.servlet.TestServlet
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        ... 30 more
Caused by: javax.naming.NameNotFoundException: de.mas.ejb3.logic.WebShopRemote#de.mas.ejb3.logic.WebShopRemote not found
        at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 33 more
```
 



Der JNDI SUchbaum sieht folgendermaßen aus:


----------



## gex (22. Okt 2008)

Clear zuerst mal deine Glassfish-Console, mach ein 'Clean and Build' und danach 'Undeploy and Deploy' des EAR.

Kommt dann dieser Fehler noch?

```
**RemoteBusinessJndiName: de.mas.ejb3.logik.WebShopRemote; remoteBusIntf: de.mas.ejb3.logik.WebShopRemote
LDR5010: Alle EJBs von [webshop] erfolgreich geladen!
Fehler beim Versuch, Manifesterweiterungen der JAR-Datei G:\Eigene Dateien\NetBeansProjects\webshop\dist\gfdeploy\webshop-ejb.jar zu verarbeiten; ignorieren Sie diesen Fehler, und fahren Sie fort
java.io.FileNotFoundException: G:\Eigene Dateien\NetBeansProjects\webshop\dist\gfdeploy\webshop-ejb.jar (Das System kann die angegebene Datei nicht finden)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at java.util.jar.JarFile.<init>(JarFile.java:133)
        at java.util.jar.JarFile.<init>(JarFile.java:97)
        at com.sun.enterprise.appclient.jws.ExtensionFileManager.findExtensionTransitiveClosure(ExtensionFileManager.java:240)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.findExtensions(AppclientJWSSupportInfo.java:1543)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.prepareAppclient(AppclientJWSSupportInfo.java:1384)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.prepareNestedAppclient(AppclientJWSSupportInfo.java:1495)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.prepareApplication(AppclientJWSSupportInfo.java:1244)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportInfo.startJWSServicesForApplication(AppclientJWSSupportInfo.java:475)
        at com.sun.enterprise.appclient.jws.AppclientJWSSupportManager.handleApplicationEvent(AppclientJWSSupportManager.java:156)
```


----------



## Gelöschtes Mitglied 5909 (26. Okt 2008)

so ich hab das projekt nochmal neu angelegt und alle Klassen zerst mit den Netbeans wizzards erstellt bevor ich sie dann mit copy & paste ersetzt habe. Dieses mal bekomm ich eine andere aber ähnliche Exception

Interessant ist, dass wenn ich im Servlet


```
private WebShopRemote webShopBean = new WebShopBean();
```

statt


```
@EJB
    private WebShopRemote webShopBean;
```

schreibe, dann gehts. Das ist aber nicht sinn der sache. den eintrag im Servlet habe ich mit 

enterprise ressources
-> cann enterprise bean 

in Netbeans gemacht. Vielleicht hilft das weiter.

// Edit

das gleiche Problem tritt auf wenn ich den EntityManager injecten will. Ist ziemlich eindeutig ein jndi problem würde ich mal behaupten. 

Ich weiß nichteinmal wo ich jndi in der j2ee app konfiguriere. Wenn mir des jemand sagen könnte wäre es schon ein anfang.



```
LDR5010: Alle EJBs von [webshop] erfolgreich geladen!
EJB5059: Ausnahmefehler beim Erstellen des EJB-Objekts: [WebShopBean]
create object exception
com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: de.mas.ejb.session.WebShopBean/context@Field-Injectable Resource. Class name = de.mas.ejb.session.WebShopBean Field name=context@java.lang.String@de.mas.ejb.session.WebShopBean/context@@ into class de.mas.ejb.session.WebShopBean
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:127)
        at com.sun.ejb.containers.StatefulSessionContainer.createBeanInstance(StatefulSessionContainer.java:926)
        at com.sun.ejb.containers.StatefulSessionContainer.createRemoteBusinessObjectImpl(StatefulSessionContainer.java:664)
        at com.sun.ejb.containers.EJBHomeImpl.createRemoteBusinessObjectImpl(EJBHomeImpl.java:123)
        at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:189)
        at $Proxy56.create(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:233)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
        at com.sun.ejb.codegen._GenericEJBHome_Generated_DynamicStub.create(com/sun/ejb/codegen/_GenericEJBHome_Generated_DynamicStub.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:372)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: javax.naming.NameNotFoundException
        at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:268)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:975)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 61 more
WebModule[/webshop-war]StandardWrapper.Throwable
java.lang.RuntimeException: WEB5002: Ausnahmefehler in handleBeforeEvent.
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:263)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Resolved Ejb-Ref LoginServlet/webShopBean@jndi: de.mas.ejb.session.WebShopRemote - > WebShopBean into class LoginServlet
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        ... 29 more
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacede.mas.ejb.session.WebShopRemote [Root exception is java.lang.reflect.UndeclaredThrowableException]
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 32 more
Caused by: java.lang.reflect.UndeclaredThrowableException
Caused by: javax.ejb.CreateException: ERROR creating stateful SessionBean
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: de.mas.ejb.session.WebShopBean/context@Field-Injectable Resource. Class name = de.mas.ejb.session.WebShopBean Field name=context@java.lang.String@de.mas.ejb.session.WebShopBean/context@@ into class de.mas.ejb.session.WebShopBean
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:127)
        at com.sun.ejb.containers.StatefulSessionContainer.createBeanInstance(StatefulSessionContainer.java:926)
        at com.sun.ejb.containers.StatefulSessionContainer.createRemoteBusinessObjectImpl(StatefulSessionContainer.java:664)
        at com.sun.ejb.containers.EJBHomeImpl.createRemoteBusinessObjectImpl(EJBHomeImpl.java:123)
        at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:189)
        at $Proxy56.create(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:233)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
        at com.sun.ejb.codegen._GenericEJBHome_Generated_DynamicStub.create(com/sun/ejb/codegen/_GenericEJBHome_Generated_DynamicStub.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:372)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: javax.naming.NameNotFoundException
        at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:268)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:975)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 61 more
StandardWrapperValve[LoginServlet]: PWC1382: Ausnahmezuweisung für Servlet LoginServlet vornehmen
java.lang.RuntimeException: WEB5002: Ausnahmefehler in handleBeforeEvent.
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:263)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Resolved Ejb-Ref LoginServlet/webShopBean@jndi: de.mas.ejb.session.WebShopRemote - > WebShopBean into class LoginServlet
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        ... 29 more
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacede.mas.ejb.session.WebShopRemote [Root exception is java.lang.reflect.UndeclaredThrowableException]
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 32 more
Caused by: java.lang.reflect.UndeclaredThrowableException
Caused by: javax.ejb.CreateException: ERROR creating stateful SessionBean
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: de.mas.ejb.session.WebShopBean/context@Field-Injectable Resource. Class name = de.mas.ejb.session.WebShopBean Field name=context@java.lang.String@de.mas.ejb.session.WebShopBean/context@@ into class de.mas.ejb.session.WebShopBean
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:127)
        at com.sun.ejb.containers.StatefulSessionContainer.createBeanInstance(StatefulSessionContainer.java:926)
        at com.sun.ejb.containers.StatefulSessionContainer.createRemoteBusinessObjectImpl(StatefulSessionContainer.java:664)
        at com.sun.ejb.containers.EJBHomeImpl.createRemoteBusinessObjectImpl(EJBHomeImpl.java:123)
        at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:189)
        at $Proxy56.create(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:233)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
        at com.sun.ejb.codegen._GenericEJBHome_Generated_DynamicStub.create(com/sun/ejb/codegen/_GenericEJBHome_Generated_DynamicStub.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:372)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:922)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
        at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
        at com.sun.web.server.J2EEInstanceListener.handleBeforeEvent(J2EEInstanceListener.java:259)
        at com.sun.web.server.J2EEInstanceListener.instanceEvent(J2EEInstanceListener.java:119)
        at org.apache.catalina.util.InstanceSupport.fireInstanceEvent(InstanceSupport.java:331)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1163)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:832)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: javax.naming.NameNotFoundException
        at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:268)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:975)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:287)
        ... 61 more
```


----------



## Gelöschtes Mitglied 5909 (26. Okt 2008)

wenn mich nicht alles täuscht müsste zumindest ein teil in der sun-web.xml stehen. 


```
<ejb-ref>
    <ejb-ref-name></ejb-ref-name>
    <jndi-name></jndi-name>
  </ejb-ref>
```

und 


```
<resource-ref>
      <res-ref-name> </res-ref-name>
      <jndi-name> </jndi-name>
  </resource-ref>
```


Die erste frage die ich mir Stelle ist was ich da eintragen sollte.
Session Beans gehören in den oberen teil, der EntityManager wohl in den unteren Teil. 

Ich kann da ja nicht einfach irgendwas rein schreiben. Dann steht es zwar im Context drinnen, aber irgendwie blick ich die zuordnung nicht. Woher weiß der Container wenn er was rausholen soll was was ist??? Da gibt keine Klassenangabe und nix. Wenn es dann von Session Beans auch noch mehrere ausprägungen gibt was is dann?


----------

