File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Can't connect (ejb - glassfish) and (ejb client - weblogic) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can Watch "Can New topic

Can't connect (ejb - glassfish) and (ejb client - weblogic)

Eduardo Aguirre Bermúdez

Joined: Dec 22, 2009
Posts: 1

Hi I'm triyng to use a EJB3.0 in glassfish from a client in weblogic, however I obtain the error:

javax.naming.CommunicationException: Cannot connect to ORB [Root exception is org.omg.CORBA.COMM_FAILURE: Connection refused: connect vmcid: 0x0 minor code: 0 completed: No]
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(
at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(
at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(
at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(
at com.sun.jndi.cosnaming.CNCtx.(
at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(
at javax.naming.spi.NamingManager.getInitialContext(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.InitialContext.(
at jsp_servlet.__index._jspService(
at weblogic.servlet.jsp.JspBase.service(
at weblogic.servlet.internal.StubSecurityHelper$
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(
at weblogic.servlet.internal.ServletStubImpl.execute(
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(
at weblogic.servlet.internal.ServletStubImpl.execute(
at weblogic.servlet.internal.ServletStubImpl.execute(
at weblogic.servlet.internal.WebAppServletContext$
at Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(
at weblogic.servlet.internal.WebAppServletContext.execute(
Caused by: org.omg.CORBA.COMM_FAILURE: Connection refused: connect vmcid: 0x0 minor code: 0 completed: No
at weblogic.iiop.Utils.mapToCORBAException(
at weblogic.iiop.IORManager.locateNameService(
at weblogic.corba.orb.ORB.resolve_initial_references(
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(
... 25 more
Caused by: Connection refused: connect
at Method)
at weblogic.socket.SocketMuxer.newSocket(
at weblogic.socket.ChannelSocketFactory.createSocket(
at weblogic.socket.AbstractMuxableSocket.createSocket(
at weblogic.socket.AbstractMuxableSocket.createSocket(
at weblogic.iiop.MuxableSocketIIOP.newSocket(
at weblogic.iiop.MuxableSocketIIOP.createSocket(
at weblogic.socket.AbstractMuxableSocket.connect(
at weblogic.iiop.MuxableSocketIIOP.connect(
at weblogic.iiop.MuxableSocketIIOP.createConnection(
at weblogic.iiop.EndPointManager.createEndPoint(
at weblogic.iiop.EndPointManager.findOrCreateEndPoint(
at weblogic.iiop.EndPointManager.findOrCreateEndPoint(
at weblogic.iiop.IORManager.locateNameService(
... 27 more

Here is mi Bean:

package adios;

import java.rmi.RemoteException;
import javax.ejb.Stateless;

* Session Bean implementation class AdMundo
public class AdMundo implements AdMundoRemote, AdMundoLocal {

* Default constructor.
public AdMundo() {
// TODO Auto-generated constructor stub
public void habla(){
System.out.println("Adios Mundo");


My remote interface:

package adios;
import javax.ejb.Remote;

public interface AdMundoRemote {
public void habla();

and my client:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

<%@page import="java.util.Properties"%>
<%@page import="javax.naming.Context"%>
<%@page import="javax.naming.InitialContext"%>

<%@page import="adios.*"%>
<%@page import=""%>
<%@page import="com.sun.jndi.cosnaming.CNCtxFactory"%><html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Weblogic JSP Page</title>
Properties props = new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
props.put(Context.PROVIDER_URL, "iiop://");

InitialContext ctx = new InitialContext(props);

AdMundoRemote aMR= (AdMundoRemote) ctx.lookup("corbaname:iiop:");

//Object obj = ctx.lookup(AdMundo.class.getName()+"/remote");

//AdMundoHome home = (AdMundoHome)javax.rmi.PortableRemoteObject.narrow(obj, AdMundoHome.class);

//AdMundo hello = home.create();

%><%String texto = "blabla";
<h1><%=texto %></h1>

I use an ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="" xmlns:xsi="" xsi:schemaLocation="">


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "">

for glassfish, I hope you can help me.

By the way If I modify the lookup, I sometimes obtaien another error, jus saying that can't find the resource.

Thanks in advance.
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

"iron wk"

Please click on the "My Private Messages" link on top of this page, for a message from JavaRanch.

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: Can't connect (ejb - glassfish) and (ejb client - weblogic)
It's not a secret anymore!