Hello
I red the documentation of glassfishV3 server and install it
I created an EJB module very basic for test and deploy it
remote interface:
@Remote
public interface remoteEJB {
public abstract String sayHello(String name);
}
Bean
@Stateless
@Remote(remoteEJB.class)
public class testEJB implements remoteEJB {
public String sayHello(String name) {
String txt = "Hello It's me=>" + name;
return txt;
}
}
when deploy server log give info:
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 message
My jsp
<jsp:useBean id="bean" class="test.User" scope="request" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GlassFish JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<br>
mom = <jsp:getProperty name="bean" property="name" /><br>
</body>
</html>
My Test class:
public class User {
remoteEJB ejb;
private String name;
public User() {
try {
Context context = new InitialContext();
remoteEJB ejb = (remoteEJB) context
.lookup("java:global/jepr/remoteEJB");
String text = ejb.sayHello("jp");
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;
}
}
Result
Hello World!
mom = null
the error in the server log:
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.<init>(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=381912