Pls try to add EJB jar dependency called to your geronimo-web.xml so that EJB is visible to your web application.for example:
 <sys:dependencies>
<sys:dependency>
<sys:groupId>default</sys:groupId>
<sys:artifactId>CounterBean</sys:artifactId>
<sys:version>1.0</sys:version>
<sys:type>car</sys:type>
</sys:dependency>
</sys:dependencies>

On Wed, Apr 15, 2009 at 5:52 PM, Shawn Jiang <genspring@gmail.com> wrote:
I encounter the same problem. Here is my case.

1, deploy a ear package contain a session bean(deployed JNDI name "CounterBeanRemote") implement a remote interface.  

2, deploy a war package that contains a servlet using @EJB(mappedName="CounterBeanRemote") to inject the EJB.



When I access the servlet, I get:

Exception: Some objects to be injected were not found in jndi: [javax.naming.NameNotFoundException: Name "java:openejb/Deployment/CounterBeanRemote/org.test.CounterRemote" not found.]
	org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:171)

Any advice per question can we inject EJB from a war outside the EJB ear  ?


On Thu, Jan 29, 2009 at 1:06 AM, Oddward <superheldenkiller@web.de> wrote:

1. yes, the ear is running when i get the error
2. in ${geronimo.home}/var/log/geronimo.log i get the following:

[OpenEJB] Auto-deploying ejb MpeMessageDispatcher:
EjbDeployment(deployment-id=myAdEJB.jar/MpeMessageDispatcher)
...
[startup] Jndi(name=MpeMessageDispatcherRemote) -->
Ejb(deployment-id=myAdEJB.jar/MpeMessageDispatcher)
...
[startup] Created Ejb(deployment-id=myAdEJB.jar/MpeMessageDispatcher,
ejb-name=MpeMessageDispatcher, container=Default Stateless Container)

i tried
Webserviceclass:
       @EJB(name="MpeMessageDispatcherRemote")
       protected MpeMessageDispatcherInterface mpe;

with no success

thx


djencks wrote:
>
> Is the ear that contains the ejb running when you get this error?
>
> When an ejb app starts, openejb prints the global jndi names it binds
> the ejbs under in ${geronimo.home}/var/log/geronimo.log.  Can you look
> and see what name your ejb is actually bound under?
>
> thanks
> david jencks
>
> On Jan 21, 2009, at 11:23 AM, Oddward wrote:
>
>>
>> Hello,
>>
>> i have a Webservice that needs access an EJB inside an EAR. Im using
>> geronimo 2.1 with tomcat. I followed these instructions
>> http://cwiki.apache.org/GMOxDOC21/referring-to-an-ejb-from-outside-its-ear.html
>> with no result. I think its for EJBs not Servlets.
>>
>> here some code snipits:
>>
>>
>> Webserviceclass:
>>      @EJB(name="dispatcher")
>>      protected MpeMessageDispatcherInterface mpe;
>> Web.xml:
>>   <dep:environment>
>>        <dep:moduleId>
>>            <dep:groupId>com.webservice.app</dep:groupId>
>>            <dep:artifactId>appwebservice</dep:artifactId>
>>            <dep:version>1.0</dep:version>
>>            <dep:type>car</dep:type>
>>        </dep:moduleId>
>>         <sys:dependencies>
>>            <sys:dependency>
>>                <sys:groupId>myadear</sys:groupId>
>>                <sys:artifactId>myad-ear</sys:artifactId>
>>                <sys:version>1.0</sys:version>
>>              <sys:type>car</sys:type>
>>            </sys:dependency>
>>    </sys:dependencies>
>>    </dep:environment>
>>    <web:context-root>/IPhoneAppWS</web:context-root>
>>    <name:ejb-ref>
>>      <name:ref-name>dispatcher</name:ref-name>
>>      <name:pattern>
>>              <name:groupId>my-ear</name:groupId>
>>              <name:artifactId>myear</name:artifactId>
>>              <name:version>1.0</name:version>
>>              <name:name>MpeMessageDispatcher</name:name>
>>      </name:pattern>
>>    </name:ejb-ref>
>> </web:web-app>
>>
>> EJBinterface:
>> @Remote
>> public interface MpeMessageDispatcherInterface {
>>
>> EJB:
>> @Stateless(name="MpeMessageDispatcher")
>> public class MpeMessageDispatcher implements
>> MpeMessageDispatcherInterface {
>>
>> javax.xml.ws.WebServiceException: Service resource injection failed
>> ....
>> Caused by: java.lang.InstantiationException: Some objects to be
>> injected
>> were not found in jndi: [javax.naming.NameNotFoundException: Name
>> "java:openejb/Deployment/myear/MpeMessageDispatcher/
>> myear.mpe.MpeMessageDispatcherInterface"
>> not found.]
>>      at
>> org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:
>> 171)
>>      at
>> org
>> .apache
>> .geronimo
>> .jaxws
>> .annotations.AnnotationHolder.newInstance(AnnotationHolder.java:39)
>>      at
>> org.apache.geronimo.cxf.pojo.POJOEndpoint.<init>(POJOEndpoint.java:76)
>>      ... 65 more
>> inject
>>
>> thx
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/inject-EJB-in-Webapplication-tp21590354s134p21590354.html
>> Sent from the Apache Geronimo - Users mailing list archive at
>> Nabble.com.
>>
>
>
>

--
View this message in context: http://www.nabble.com/inject-EJB-in-Webapplication-tp21590354s134p21710008.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.




--
Shawn



--
viola