ejb@glassfish.java.net

JNDI default name

From: Hannes Stauss <hannes.stauss_at_stauss.at>
Date: Sun, 12 Feb 2006 22:04:34 +0100

Hi!
I have a simple stateless session bean:

--------------------------------------------------
package com.foo.server;

import javax.ejb.Remote;

@Remote
public interface Service {

        public String sayHello();

}


package com.foo.server;

public class ServiceBean implements Service {

        public String sayHello() {
                return "Hello";
        }

}


ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0" 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/ejb-jar_3_0.xsd ">
        <description>Chili Enterprise Systems</description>
        <display-name>Chili Enterprise Bean</display-name>
</ejb-jar>


and a standalone client:

-----------------------------------------------------------------------------
----------- package com.foo.client;

import javax.naming.InitialContext;

import com.foo.server.Service;

public class Main {

        private void run() {
                try {
                        InitialContext context = new InitialContext();
                        Service service = (Service)context.lookup(Service.class.getName());
                        System.out.println(service.sayHello());
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }

        public static void main(String[] args) {
                new Main().run();
        }

}


When I deploy the module on the server and browse the JNDI tree, there is no
JNDI name for my bean. Furthermore I get an NameNotFoundException when
running the client:

Feb 12, 2006 9:43:21 PM com.sun.corba.ee.spi.logging.LogWrapperBase doLog
INFO: "IOP00710299: (INTERNAL) Successfully created IIOP listener on the
specified host/port: all interfaces/33938"
javax.naming.NameNotFoundException: com.foo.server.Service not found
        at
com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:203
) at
com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:175)

....

I have tried with b32, b32f and b36, with netbeans and eclipse. Running sun-
JDK1.5.0_06 on a linux box. What is wrong? Why isn't there a JNDI name??

Help appreciated! Thanks

Hannes

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