Two Laptop Bag*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can Watch "Can New topic
Author

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

Eduardo Aguirre Bermúdez
Greenhorn

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(CNCtx.java:382)
at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(CNCtx.java:307)
at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:260)
at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:222)
at com.sun.jndi.cosnaming.CNCtx.(CNCtx.java:74)
at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.java:32)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:197)
at jsp_servlet.__index._jspService(__index.java:104)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:408)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:318)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: org.omg.CORBA.COMM_FAILURE: Connection refused: connect vmcid: 0x0 minor code: 0 completed: No
at weblogic.iiop.Utils.mapToCORBAException(Utils.java:885)
at weblogic.iiop.IORManager.locateNameService(IORManager.java:213)
at weblogic.corba.orb.ORB.resolve_initial_references(ORB.java:251)
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:360)
... 25 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at weblogic.socket.SocketMuxer.newSocket(SocketMuxer.java:333)
at weblogic.socket.ChannelSocketFactory.createSocket(ChannelSocketFactory.java:82)
at weblogic.socket.AbstractMuxableSocket.createSocket(AbstractMuxableSocket.java:220)
at weblogic.socket.AbstractMuxableSocket.createSocket(AbstractMuxableSocket.java:211)
at weblogic.iiop.MuxableSocketIIOP.newSocket(MuxableSocketIIOP.java:262)
at weblogic.iiop.MuxableSocketIIOP.createSocket(MuxableSocketIIOP.java:249)
at weblogic.socket.AbstractMuxableSocket.connect(AbstractMuxableSocket.java:192)
at weblogic.iiop.MuxableSocketIIOP.connect(MuxableSocketIIOP.java:234)
at weblogic.iiop.MuxableSocketIIOP.createConnection(MuxableSocketIIOP.java:218)
at weblogic.iiop.EndPointManager.createEndPoint(EndPointManager.java:464)
at weblogic.iiop.EndPointManager.findOrCreateEndPoint(EndPointManager.java:239)
at weblogic.iiop.EndPointManager.findOrCreateEndPoint(EndPointManager.java:256)
at weblogic.iiop.IORManager.locateNameService(IORManager.java:167)
... 27 more

Here is mi Bean:

package adios;

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

/**
* Session Bean implementation class AdMundo
*/
@Stateless
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;

@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"
"http://www.w3.org/TR/html4/loose.dtd">


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

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


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

InitialContext ctx = new InitialContext(props);

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

//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>
</body>
</html>


I use an ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>
=)</display-name>
<enterprise-beans>
<session>
<ejb-name>AdMundo</ejb-name>
<remote>adios.AdMundoRemote</remote>
<local>adios.AdMundoLocal</local>
<ejb-class>adios.AdMundo</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>

sun-ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>AdMundo</ejb-name>
<jndi-name>AdMundo</jndi-name>
</ejb>
</enterprise-beans>
</sun-ejb-jar>

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
Marshal

Joined: Jul 20, 2005
Posts: 9947
    
161

"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: http://aspose.com/file-tools
 
subject: Can't connect (ejb - glassfish) and (ejb client - weblogic)
 
Similar Threads
JNDI Name not found exception
Help to solve NoInitialContextException
JNDI Name not found error in SUN ONE SERVER
error while running EJB from java client on JBOSS
Deploying EJB in JBOSS Server, Got Error (Could not create deployment file, Connection refused)