users@glassfish.java.net

Re: Debug _at_EJB (javax.ejb.EJB) annotation in Web Application

From: <glassfish_at_javadesktop.org>
Date: Tue, 09 Jun 2009 04:39:26 PDT

Hello,

Situation: REST WebService is in the same .ear-File as other EJBs and i want to call the EJBs local, but Glassfish doesn't let me do that ;)

So i have the same problem ...and everytime and every variation of this suggestions above doesn't work...

my web.xml looks like this:

[i]
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
  <servlet>
          <display-name>JAX-RS REST Servlet</display-name>
          <servlet-name>REST-Servlet</servlet-name>
          <servlet-class>
                  com.sun.jersey.spi.container.servlet.ServletContainer
          </servlet-class>
          <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
          <servlet-name>REST-Servlet</servlet-name>
          <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  
  <ejb-local-ref>
        <ejb-ref-name>com/inside/foo/impl/FooBean/local</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home>com.inside.foo.Foo</local-home>
        <local>com.inside.foo.Foo</local>
        <ejb-link>FooBean</ejb-link>
  </ejb-local-ref>
  
</web-app>
[/i]

and my Call looks like this:

[i]
        InitialContext ic = new InitialContext();
        Foo bean = (Foo) ic.lookup("java:comp/env/com/inside/foo/impl/FooBean/local");
[/i]

i am using GlassFish nServer v2.1 and everytime when i try this the variable "bean" is null...where is my mistake?

regards Hannes
[Message sent by forum member 'szeminator' (szeminator)]

http://forums.java.net/jive/thread.jspa?messageID=349963