Details
-
Bug
-
Resolution: Won't Do
-
Minor
-
None
-
EJB 3.0 RC5 - PFD
-
None
-
None
-
Compatibility/Configuration
Description
PLEASE NOTE: this code works when the WAR file (servlet) deployed on a REMOTE JBoss, the problem is when the WAR file is in the same deploy directory of the EAR file (ejb) but not in the EAR itself.
If it was in the EAR itself, it works.
package test.client;
import java.io.IOException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import test.common.UserContext;
public class SimpleServlet extends GenericServlet {
private static final long serialVersionUID = 1L;
public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException {
System.out.println("service called (Service)");
String retVal = "FAILED";
try
catch (NamingException e)
{ e.printStackTrace(); } res.getWriter().println(
"<HTML>" +
"<HEADER><TITLE>Test EJB3</TITLE></HEADER>" +
"<BODY>" +
"<P>" + retVal +
"</P>" +
"</BODY>" +
"</HTML>");
}
}
package test.server;
import java.io.Serializable;
import java.util.Date;
import javax.ejb.Stateful;
import test.common.UserContextRemote;
@Stateful(name="usercontext")
public class UserContextBean implements UserContextRemote, Serializable {
/**
*/
private static final long serialVersionUID = 5825562882270540623L;
private Date loginTime = null;
public String login() {
if (loginTime == null)
else
{ return "You already login " + toString(); }}
}
package test.common;
import javax.ejb.Remote;
@Remote
public interface UserContextRemote extends UserContext {
}
package test.common;
public interface UserContext {
public String login();
}
java.lang.ClassCastException: $Proxy49
at test.client.SimpleServlet.service(SimpleServlet.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)