users@glassfish.java.net

Accessing EJB from servlet - both are running on different machine

From: <glassfish_at_javadesktop.org>
Date: Thu, 29 Nov 2007 09:39:20 PST

I have a sample code which works fine on Windows platform, but when the same set of code is deployed on solaris - the EJB throws exception. I am not sure whether it is configuration or security issue on solaris - appreciate help.


[b]I get follwoing Exception on server side -[/b]
[#|2007-11-29T09:45:47.380-0700|WARNING|sun-appserver9.1|javax.enterprise.resource.corba.ee.S1AS-ORB.rpc.transport|_ThreadID=20;_ThreadName=p: thread-pool-1; w: 3;6000;7280;_RequestID=b348dd1e-d423-4d1f-8a96-7621a39bc346;|"IOP00410229: (COMM_FAILURE) Blocking read failed, expected to read additional bytes: max wait time = 6,000ms total time spent waiting = 7,280ms"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 229 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.blockingReadTimeout(ORBUtilSystemException.java:3476)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.blockingReadTimeout(ORBUtilSystemException.java:3500)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.blockingRead(SocketOrChannelConnectionImpl.java:1863)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doOptimizedReadStrategy(SocketOrChannelConnectionImpl.java:1733)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1263)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)



----------------------------
[b]1) EJB[/b]
@Stateless(description="TestJNDIBean", mappedName="ejb/TestJNDIBean", name="ejb/TestJNDIBean")
@PermitAll
public class TestJNDIBean implements pegs.test.jndi.TestJNDIRemote {
    
    /** Creates a new instance of TestJNDIBean */
    public TestJNDIBean() {
    }
    
    
    public String greeting(String message){
        System.out.println("Bean called....");
        return " Hello from TestJNDIBean,"+message;
    }
    
}



-------------------------------
[b]2) Sun-web.xml of client servlet[/b]
<ejb-ref>
    <ejb-ref-name>TestRemoteEJBServer</ejb-ref-name>
    <jndi-name>corbaname:iiop:138.113.192.87:3700#ejb/TestJNDIBean</jndi-name>
 </ejb-ref>




----------------------------
[b]3) EJB client code (Its is another servlet running on seperate machine in glassfish[/b])
public class TestJNDIServlet extends HttpServlet {
@EJB(name="TestRemoteEJBServer")
private TestJNDIRemote testJNDIRemote;

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        out.println("Servlet TestJNDIServlet - contact EJB server running on different instance " +testJNDIRemote.greeting("Pegs ") );
        out.close();
    }
    
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }
    
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }
    
    public String getServletInfo() {
        return "Short description";
    }

}



Thanks,
[Message sent by forum member 'kameshwarsingh' (kameshwarsingh)]

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