in ejb tutorial i have found the following code for JNDI set up
code
====
import javax.naming.*;
javax.rmi.PortableRemoteObject;
import java.util.Properties;
...........
...........
public class BeanClient {
public static void main(String[] args) {
// preparing properties for constructing an InitialContext object
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "localhost:1099");
My question is:
Question 1 :
what is this url "localhost:1099" ?
i am using JBoss application server. my application directory(context
path ) is "/myapps"
should i change this url to "localhost:1099/myapps" ??
question 2: what is this port "1099" . is it the admin server port ? is
it the port of local server ?
Bjorn Abelli - 08 Oct 2005 12:36 GMT
"gk" wrote...
[snipped code]
> what is this url "localhost:1099" ?
"localhost" is simply the adress to the server.
1099 is the number for the port where JBoss is listening for your
JNDI-reguests.
> i am using JBoss application server. my application
> directory(context path ) is "/myapps"
>
> should i change this url to "localhost:1099/myapps" ??
Nope, that doesn't make any sense. Just leave it as in the example, unless
you're working with a client on a different machine than where JBoss
resides.
The port doesn't have any directories... ;-)
From that port you can retrieve a "root context", from which you can do the
actual requests.
Something similar to this:
Context context = (Context) new InitialContext(properties);
Object e = context.lookup("Name of the service");
etc...
// Bjorn A
Bjorn Abelli - 08 Oct 2005 13:18 GMT
"Bjorn Abelli" wrote...
> "gk" wrote...
>> should i change this url to "localhost:1099/myapps" ??
>
> Nope, that doesn't make any sense. Just leave it as in the example, unless
> you're working with a client on a different machine than where JBoss
> resides.
On the other hand, that depends on how you configured the JNDI-names in
JBoss.
"/myapps" in "localhost:1099/myapps" could then mean that you have a
root-context named "myapps", and not just as a simple lookupname.
Then it could probably work, although I would rather use even that in the
actual lookup instead.
> From that port you can retrieve a "root context", from which
> you can do the actual requests.
[quoted text clipped - 5 lines]
>
> etc...
// Bjorn A
gk - 08 Oct 2005 13:37 GMT
Roedy Green - 09 Oct 2005 05:32 GMT
On 8 Oct 2005 03:48:50 -0700, "gk" <srcjnu@gmail.com> wrote or quoted
>what is this url "localhost:1099" ?
see http://mindprod.com/jgloss/localhost.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 09 Oct 2005 05:35 GMT
On 8 Oct 2005 03:48:50 -0700, "gk" <srcjnu@gmail.com> wrote or quoted
>question 2: what is this port "1099" . is it the admin server port ? is
>it the port of local server ?
It looks like some sort of local server is going to be set up using
port 1099. Both ends have to agree on the port, same as they do for
port 80 for HTTP. Presumably you could change it, if you changed the
server and all the clients.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 09 Oct 2005 05:36 GMT
On 8 Oct 2005 03:48:50 -0700, "gk" <srcjnu@gmail.com> wrote or quoted
>should i change this url to "localhost:1099/myapps" ??
I would say no. Read the docs to be sure. A service on 1099 has
nothing to do with the file system.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.