Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

JNDI url problem

Thread view: 
gk - 08 Oct 2005 11:48 GMT
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.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.