user_00 (2) [Avatar] Offline
#1
Hello,

I'm using EJB3, GlassFish 3.0.1 and eclipse helios

I have a remote EJB
@Stateless (mappedName="TestBean")
public class TestBean implements TestBeanRemote {
public int add(int a, int b){
return a+b;
}
}

And the Remote Interface
@Remote
public interface TestBeanRemote {
public int add(int a, int b);
}

application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlnssmiliesi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6">
<application-name>ear.proj</application-name>
<display-name>ear.proj</display-name>
<module>
<web>
<web-uri>war.proj</web-uri>
<context-root>/war</context-root>
</web>
</module>
<module>
<ejb>ejb.proj.jar</ejb>
</module>
</application>

I have an empty sun-ejb-jar.xml and I did not define ejb-jar.xml as I read that it's optional since EJB3
I'm putting my EJB in the EAR along with the WEB

I'm trying to call this EJB in a POJO class
InitialContext ic = new InitialContext();
ic.lookup("java:global/ear.proj/ejb.proj/TestBean");

I get the following exception
javax.naming.NamingException: Lookup failed for java:global/ear.proj/ejb.proj/TestBean' in SerialContext [Root exception is javax.naming.NameNotFoundException: ear.proj]

I guess that the problem is in the EJB setup in my EAR as it's said in the GlassFish EJB FAQ that Each portable global JNDI name is printed out to the server.log during deployment while I can not find any portable keyword in the log

Instead I can see the following
INFO: Cannot find module ejb.proj.ejb.jar in application bundle

Is there something I'm missing?