I only wanted to try some security thing (which will be my next post ;-), so I used a JSP for a quick test (which took rather long ;-)
I had had just a glance at http://cwiki.apache.org/GMOxDOC21/mytime-very-simple-session-ejb-example.html and there is neither web.xml nor ejb-ref. My original Exception without ejb-ref was javax.naming.NotContextException: ejb/Secured3Bean at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:171) at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:611) at javax.naming.InitialContext.lookup(InitialContext.java:392) I think this Exception is misleading, there should be a message like "ejb-ref" is missing. Throwing a NotContextException in this case is like if you are searching something in a database and throwing an EntryNotFoundException when the database is down. On your suggestion I tried <ejb-local-ref> <ejb-ref-name>ejb/Secured3</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local>ejb3.Secured3</local> <ejb-link>Secure3</ejb-link> </ejb-local-ref> but this gives the exception below. Thanks, Juergen java.lang.NullPointerException at org.apache.openejb.util.LinkResolver.resolveLink(LinkResolver.java:69) at org.apache.openejb.assembler.classic.EjbResolver.resolveLink(EjbResolver.java:121) at org.apache.openejb.assembler.classic.EjbResolver.resolve(EjbResolver.java:180) at org.apache.openejb.config.JndiEncInfoBuilder.buildEjbRefs(JndiEncInfoBuilder.java:172) at org.apache.openejb.config.JndiEncInfoBuilder.build(JndiEncInfoBuilder.java:129) at org.apache.geronimo.openejb.deployment.EjbRefBuilder.buildNaming(EjbRefBuilder.java:153) at org.apache.geronimo.j2ee.deployment.NamingBuilderCollection.buildNaming(NamingBuilderCollection.java:53) at org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasicWebModuleAttributes(AbstractWebModuleBuilder.java:842) at org.apache.geronimo.jetty6.deployment.JettyModuleBuilder.addGBeans(JettyModuleBuilder.java:365) at org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(SwitchingModuleBuilder.java:165) at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:647) at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:255) at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:134) at sun.reflect.GeneratedMethodAccessor496.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34) at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867) at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239) at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116) at org.apache.geronimo.deployment.plugin.local.RedeployCommand.redeploySameConfiguration(RedeployCommand.java:225) at org.apache.geronimo.deployment.plugin.local.RedeployCommand.run(RedeployCommand.java:101) at java.lang.Thread.run(Thread.java:619) djencks wrote: > > > On Jun 17, 2009, at 8:43 AM, Juergen Weber wrote: > >> >> Hi, >> >> I ran again into the problem of looking up an EJB3 from JNDI in a >> JSP (Ger >> 2.1.4) >> >> The bean is >> >> @Stateless(name="Secure3") >> public class Secured3Bean implements Secured3 >> >> Deployment log says >> 2009-06-17 17:31:22,989 INFO [startup] Assembling app: >> /projekte/geronimo-jetty6-javaee5-2.1.4/var/temp/geronimo- >> deployer4457332012373548807.tmpdir/Secured3Bean_ejb.jar >> 2009-06-17 17:31:22,993 INFO [startup] Jndi(name=Secure3Remote) --> >> Ejb(deployment-id=Secured3Bean/Secure3) >> >> So I guess JNDI name is Secure3Remote. >> but context.lookup("java:comp/env/Secure3Remote") throws an >> exeption, also >> context.lookup("Secure3Remote") and all other permutations I could >> think of. >> >> http://cwiki.apache.org/GMOxDEV/client-jndi-names.html did not help. >> >> Could someone please give a hint what name I should try. > > For phiosophical reasons I would not recommend using an ejb directly > from a jsp, rather I'd suggest a servlet that constructs an easily > rendered data model; in the servlet you can use annotations. > > If you use a jsp you need to mention the ejb-ref in your web.xml and > that should give you the name to look up. > > thanks > david jencks > >> >> Thanks, >> Juergen >> >> -- >> View this message in context: >> http://www.nabble.com/JNDI-Name-for-EJB3-tp24076429s134p24076429.html >> Sent from the Apache Geronimo - Users mailing list archive at >> Nabble.com. >> > > -- View this message in context: http://www.nabble.com/JNDI-Name-for-EJB3-tp24076429s134p24089247.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
