Mike, I only had to do two things to get my client running
remotely. First, the client has to know the server is remote.
I lookup the server name/IP in "document.properties":
// put the document server properties file into the system properties
Properties props = new Properties();
Properties sysprops = System.getProperties();
try
{
props.load(new java.io.FileInputStream("document.properties"));
sysprops.putAll(props);
}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(-1);
}
System.setProperties(sysprops);
System.out.println("java.naming.provider.url="+System.getProperty("java.nami
ng.provider.url"));
<junk deleted>
try
{
// get the naming context
InitialContext jndiContext = new InitialContext();
// get a reference to a sample document
Object ref = jndiContext.lookup("document/SampleDocument");
// get a reference to the home interface
SampleDocumentHome sdh =
(SampleDocumentHome)PortableRemoteObject.narrow(ref,
SampleDocumentHome.class);
// create the document
String id = (new java.rmi.server.UID()).toString();
SampleDocument doc = sdh.create(id);
Here is the document.properties file:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=192.168.1.102:1099
192.168.1.102 is my Linux server running jBoss.
The other change is on the server. All I had to do was change conf/
jboss.properties and set java.rmi.server.hostname=192.168.1.102 instead
of "localhost" (the default).
Hope this helps.
-tim
> -----Original Message-----
> From: Mike Newman [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 21, 2000 7:38 AM
> To: 'jBoss'
> Subject: RE: [jBoss-User] HELP ! client doesnt run on remote machine
>
>
> I am having problems doing the same thing. This should be a
> very trivial
> task but I have burned almost a full day on it.
>
> I keep getting "Connection refused to host:" when I run my
> test client: And
> yes I did change the:
>
> 1. JNDI.PROPERTIES entry:
> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
> java.naming.provider.url=<myRemoteServer>
> java.naming.factory.url.pkgs=org.jboss.naming
>
> 2. JBOSS.PROPERTIES entry:
> #java.rmi.server.useLocalHostName=true
> java.rmi.server.hostname=<myRemoteServer>
> #java.rmi.server.codebase=http://localhost:8080/
> jdbc.drivers=oracle.jdbc.driver.OracleDriver
>
> 3. I also hard-coded the URL my client code:
> System.setProperty("java.naming.factory.initial",
> "org.jnp.interfaces.NamingContextFactory");
> System.setProperty("java.naming.provider.url",
> "<myRemoteServer>:1099");
>
>
> Is there any documentation that describes what each of these settings
> actually control?
> Is there any documentation that describes how to set-up such
> a commonly used
> configuration?
>
>
> -Mike
>
>
> -----Original Message-----
> From: Rickard �berg [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 21, 2000 12:56 AM
> To: jBoss
> Subject: Re: [jBoss-User] HELP ! client doesnt run on remote machine
>
>
> Hey
>
> Tobias wrote:
> > I am still trying to get this working. I now tried the test
> suite. The
> > suite runs if started on the same machine on which the server is
> > located.
> > But as soon as I transfer the test suite to a remote
> machine it fails.
> > It gets the initial context (test 1) but the first lookup
> fails (test
> > 2).
> > Again, it states it is not allowed to connect to the
> localhost. But I
> > DID provide a proper jndi.properties file, I think:
> >
> > java.naming.factory.initial =
> org.jnp.interfaces.NamingContextFactory
> > java.naming.provider.url = krypton.company.com
> > java.naming.factory.url.pkgs = org.jboss.naming
> >
> > There is NO other jndi.properties file around. The server is a linux
> > (Redhat 6.2) machine and the client a Win 2000 machine. And
> yes, I did
> > adjust java.policy.
> >
> > What to do ? HELP !
>
> Try changing jboss.properties, java.rmi.server.hostname=localhost to
> java.rmi.server.hostname=<somehost>
>
> That's most likely it.
>
> This should not be there. Did I do that? :-(
>
> /Rickard
>
> --
> Rickard �berg
>
> Email: [EMAIL PROTECTED]
> http://www.telkel.com
> http://www.jboss.org
> http://www.dreambean.com
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]