users@glassfish.java.net

Re: Interop with Glassfish and other application servers

From: <glassfish_at_javadesktop.org>
Date: Sat, 22 Dec 2007 19:14:35 PST

Hi Chris,

My servlet class looks like this:
public class FooServlet extends HttpServlet { @EJB(mappedName="corbaname:iiop:1.2_at_host-ejb:3700#foo.FooRemote")
private FooRemote foo;

web.xml:
=======
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <servlet>
        <servlet-name>FooServlet</servlet-name>
        <servlet-class>foo.FooServlet</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>BarServlet</servlet-name>
        <servlet-class>BarServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>FooServlet</servlet-name>
        <url-pattern>/FooServlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>BarServlet</servlet-name>
        <url-pattern>/BarServlet</url-pattern>
    </servlet-mapping>
    </web-app>

sun-web.xml (I could've totally omitted this file and should work as well. Generated by NetBeans)
=========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
  <context-root>/WebApplication1</context-root>
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="classdebuginfo" value="true">
      <description>Enable debug info compilation in the generated servlet class</description>
    </property>
    <property name="mappedfile" value="true">
      <description>Maintain a one-to-one correspondence between static content and the generated servlet class' java code</description>
    </property>
  </jsp-config>
</sun-web-app>

The ejb-jar only contains:
foo.FooRemote.class
foo.FooBean.class

and uses the default global jndi-name (i.e., foo.FooRemote).

Both the servelt side and ejb side are running a recent glassfish v2 build (close to v2 ur1).

-cheng
[Message sent by forum member 'cf126330' (cf126330)]

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