users@glassfish.java.net

GLASSFISH V3 EJB and Web client

From: <glassfish_at_javadesktop.org>
Date: Wed, 20 Jan 2010 02:05:07 PST

Hello

I red the documentation of glassfishV3 server and install it
I created an EJB module very basic for test and deploy it
[u]remote interface:[/u]
@Remote
public interface remoteEJB {
        public abstract String sayHello(String name);
}
[u]Bean:[/u]
@Stateless
@Remote(remoteEJB.class)
public class testEJB implements remoteEJB {
        public String sayHello(String name) {
                String txt = &quot;Hello It's me=&gt;&quot; + name;
                return txt;
        }
}
[u]when deploy server log give info:[/u]
INFO: Portable JNDI names for EJB UsersBean : [java:global/jepr/UsersBean, java:global/jepr/UsersBean!org.linuxart.info.jepr.ejb.users.remoteUsers]

It test it with a remote client swing it's run fine
When I access to the bean with a Web client I receive error messages

[u]My jsp:[/u]
&lt;jsp:useBean id=&quot;bean&quot; class=&quot;test.User&quot; scope=&quot;request&quot; /&gt;
&lt;html&gt;
  &lt;head&gt;
            &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
            &lt;title&gt;GlassFish JSP Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;Hello World!&lt;/h1&gt;
    &lt;br&gt;
    mom = &lt;jsp:getProperty name=&quot;bean&quot; property=&quot;name&quot; /&gt;&lt;br&gt;
  &lt;/body&gt;
&lt;/html&gt;

[u]My Test class:[/u]
public class User {
        remoteEJB ejb;
        private String name;

        public User() {
                try {
                        Context context = new InitialContext();
                        remoteEJB ejb = (remoteEJB) context
                                        .lookup(&quot;java:global/jepr/remoteEJB&quot;);
                        String text = ejb.sayHello(&quot;jp&quot;);
                        name = text;
                } catch (NamingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }
        public String getName() {
                return name;
        }
        public void setName(String name) {
                this.name = name;
        }

}
[u]Result:[/u]
Hello World!
mom = null

[u]the error in the server log:[/u]
INFO: web_testEJB was successfully deployed in 204 milliseconds.

GRAVE: javax.naming.NamingException: Lookup failed for 'java:global/jepr/remoteEJB' in SerialContext [Root exception is javax.naming.NameNotFoundException: remoteEJB not found]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at test.User.&lt;init&gt;(User.java:19)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java from :52)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:406)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NameNotFoundException: remoteEJB not found
        at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:197)
        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:168)
        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:172)
        at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:172)
        at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)
        at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:101)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
        ... 34 more

I read a lot post on internet without found the reason of this error
Help will by aprecied

JPR
[Message sent by forum member 'ritzjp' (ritz_at_linuxart.info)]

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