wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes help jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "help jboss" Watch "help jboss" New topic
Author

help jboss

salsim salsim
Greenhorn

Joined: Apr 22, 2003
Posts: 2
Hi all,
I am doing development on a W2K machine and have developed an ejb and it is working fine in the local machine. Now I have deployed the ejb in JBOSS server which is running in a Redhat machine. In the redhad machine I am able to access the ejb. When I try to access it from some other machine I get the following exception.
javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect]
javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at client.Client.main(Client.java:48)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
at java.net.Socket.connect(Socket.java:425)
at java.net.Socket.connect(Socket.java:375)
at java.net.Socket.<init>(Socket.java:290)
at java.net.Socket.<init>(Socket.java:118)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:122)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
I have set the jndi.properties file to point to the Redhad machine.
Please help me.
Thanks in advance
salsim
Volodymyr Shram
Ranch Hand

Joined: Oct 17, 2002
Posts: 47
You are trying to connect not to remote machine (with Jboss service) but to localhost (i.e. machine, on which you runing your application). Beacuse of there are no jboss service at your client machine you have to set correct IP of jboss server (not 127.0.0.1!) at you lookup statement.
Regards, Volodymyr Shram.
salsim salsim
Greenhorn

Joined: Apr 22, 2003
Posts: 2
jboss server run on ip 10.31.12.164. this is java class :
class Client
{
public static Context getInitialContext() throws NamingException
{
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL,"jnp://10.31.12.164:1099");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");



return new InitialContext(props);
}
public static void main(String[] args)
{
try
{
// Get a naming context
Context context = getInitialContext();

Object ref = context.lookup("EjbJNDI");
.
.
.
.
In the properties I use the server IP instead of "localhost"
What is wrong with it?
thanks
Volodymyr Shram
Ranch Hand

Joined: Oct 17, 2002
Posts: 47
Try this way:

where YOUR_JBOSS_SERVER is name of your server with jboss (i.e. string name or clear IP address without jnp://)
Regards, Volodymyr Shram.
Sarah Gong
Greenhorn

Joined: Feb 19, 2004
Posts: 2
I am using the example from the Jboss workbook. The ejb deployed successfully on Redhat9 which is run on the local machine.When I run the client program, I got this error:
run.client_61:
[java] done with getInitialContext
[java] javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 10.150.132.221; nested exception is:
[java] java.net.ConnectException: Connection refused]
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:647)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
[java] at com.titan.clients.Client_61.main(Client_61.java:34)
[java] Caused by: java.rmi.ConnectException: Connection refused to host: 10.150.132.221; nested exception is:
[java] java.net.ConnectException: Connection refused
[java] at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
[java] at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
[java] at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
[java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
[java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
[java] ... 3 more
[java] Caused by: java.net.ConnectException: Connection refused
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
[java] at java.net.Socket.connect(Socket.java:452)
[java] at java.net.Socket.connect(Socket.java:402)
[java] at java.net.Socket.<init>(Socket.java:309)
[java] at java.net.Socket.<init>(Socket.java:124)
[java] at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
[java] at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
[java] at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
[java] ... 8 more

Here is my client_61.java
package com.titan.clients;
import com.titan.customer.CustomerHomeRemote;
import com.titan.customer.CustomerRemote;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.naming.Context;
import javax.naming.NamingException;
import java.util.Properties;
/**
* Example which creates and removes CustomerEJB beans
*
*/
public class Client_61
{
public static void main(String [] args)
{
try
{
if (args.length<3 || args.length%3!=0)
{
System.out.println("Usage: java com.titan.clients.Client_61 <pk1> <fname1> <lname1> ...");
System.exit(-1);
}
// obtain CustomerHome
Context jndiContext = getInitialContext();
System.out.println("done with getInitialContext");
Object obj = jndiContext.lookup("CustomerHomeRemote");
System.out.println("done with jndilookup");
CustomerHomeRemote home = (CustomerHomeRemote)
PortableRemoteObject.narrow(obj, CustomerHomeRemote.class);

// create Customers
for(int i = 0; i < args.length; i++)
{
Integer primaryKey = new Integer(args[i]);
String firstName = args[++i];
String lastName = args[++i];
CustomerRemote customer = home.create(primaryKey);
customer.setFirstName(firstName);
customer.setLastName(lastName);
customer.setHasGoodCredit(true);
}
// find and remove Customers
for(int i = 0; i < args.length; i+=3)
{
Integer primaryKey = new Integer(args[i]);
CustomerRemote customer = home.findByPrimaryKey(primaryKey);
String lastName = customer.getLastName( );
String firstName = customer.getFirstName( );
System.out.print(primaryKey+" = ");
System.out.println(firstName+" "+lastName);
// remove Customer
customer.remove();
}
}
catch (java.rmi.RemoteException re)
{
re.printStackTrace();
}
catch (Throwable t)
{
t.printStackTrace();
}
}

public static Context getInitialContext() throws NamingException
{

java.util.Hashtable JNDIParm = new java.util.Hashtable();
JNDIParm.put(Context.PROVIDER_URL, "localhsot");
JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
javax.naming.InitialContext ctx = new InitialContext(JNDIParm);
return ctx;

}

//public static Context getInitialContext() throws Exception
//{ System.out.println("Coming into getInitial Context");
// return new InitialContext();
//}
}

Any help is appreciated!
Sarah Gong
Greenhorn

Joined: Feb 19, 2004
Posts: 2
Sorry, the "localhost" spelled wrong. I correct it, it still doesn't work!
Thanks in advance!
Sarah
Redding
Greenhorn

Joined: Aug 21, 2002
Posts: 6
I am having the same exact problem! Did you ever resolve this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help jboss