|
|
Hello,
Please think about two Glassfish 3.1 application servers with EE6 specification. A web container(servlet) on one application server wants to access an EJB component method on the other application server. Sending the source files and error message below.
APPLICATION SERVER 1:
EJBHelloController.java (servlet) :
package trader.web;
import ejb.NewSessionBeanRemote;
import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name = "EJBHelloController", urlPatterns = {"/helloEJB"})
public class EJBHelloController extends HttpServlet {
@EJB(name="NewSessionBean")
private NewSessionBeanRemote helloBean;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("");
out.println("");
out.println("Servlet EJBHelloController");
out.println("");
out.println("");
out.println(helloBean.getMessage());
out.println("");
out.println("");
} finally {
out.close();
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}
}
glassfish-web.xml (ejb reference configuration) :
<?xml version="1.0" encoding="UTF-8"?>
/BrokerTool_BKURT
Keep a copy of the generated servlet class' java code.
NewSessionBean
corbaname:iiop:1.2@192.6.10.197:3700#NewsApp-ejb/#NewsApp-ejb/NewSessionBean
APPLICATION SERVER 2:
NewSessionBean.java (ejb implementation) :
package ejb;
import java.util.Calendar;
import javax.ejb.Stateless;
@Stateless
public class NewSessionBean implements NewSessionBeanRemote {
@Override
public String getMessage() {
System.err.println("Merhaba from remote stateless session bean :" + Calendar.getInstance().getTime());
return "Merhaba from remote stateless session bean";
}
public NewSessionBean() {
}
}
NewSessionBeanRemote.java (ejb remote interface) :
package ejb;
import javax.ejb.Remote;
@Remote
public interface NewSessionBeanRemote {
public String getMessage();
}
ERROR MESSAGE :
HTTP Status 500 -
________________________________________
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: PWC1392: Error instantiating servlet class trader.web.EJBHelloController
root cause
com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class trader.web.EJBHelloController
root cause
java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=NewSessionBean,Remote 3.x interface =ejb.NewSessionBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:1.2@192.6.10.197:3700#NewsApp-ejb/#NewsApp-ejb/NewSessionBean,refType=Session into class trader.web.EJBHelloController
root cause
com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=NewSessionBean,Remote 3.x interface =ejb.NewSessionBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:1.2@192.6.10.197:3700#NewsApp-ejb/#NewsApp-ejb/NewSessionBean,refType=Session into class trader.web.EJBHelloController
root cause
javax.naming.NamingException: Lookup failed for 'java:comp/env/NewSessionBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=NewSessionBean,Remote 3.x interface =ejb.NewSessionBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:1.2@192.6.10.197:3700#NewsApp-ejb/#NewsApp-ejb/NewSessionBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'corbaname:iiop:1.2@192.6.10.197:3700#NewsApp-ejb/#NewsApp-ejb/NewSessionBean__3_x_Internal_RemoteBusinessHome__' [Root exception is org.omg.CORBA.BAD_PARAM: FINE: IOP00100009: string_to_object conversion failed due to bad schema specific part in name NewsApp-ejb/#NewsApp-ejb/NewSessionBean__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No]]
root cause
javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=NewSessionBean,Remote 3.x interface =ejb.NewSessionBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:1.2@192.6.10.197:3700#NewsApp-ejb/#NewsApp-ejb/NewSessionBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'corbaname:iiop:1.2@192.6.10.197:3700#NewsApp-ejb/#NewsApp-ejb/NewSessionBean__3_x_Internal_RemoteBusinessHome__' [Root exception is org.omg.CORBA.BAD_PARAM: FINE: IOP00100009: string_to_object conversion failed due to bad schema specific part in name NewsApp-ejb/#NewsApp-ejb/NewSessionBean__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No]
root cause
org.omg.CORBA.BAD_PARAM: FINE: IOP00100009: string_to_object conversion failed due to bad schema specific part in name NewsApp-ejb/#NewsApp-ejb/NewSessionBean__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No
root cause
org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1 logs.
Could you please help about the error?
Thanks,
Serdar