Solved

How do I run the server?

Posted on 1997-05-04
3
216 Views
Last Modified: 2010-04-16
Hi,

  I've not yet use java server although I installed it this
  morning. However, before to continue I want to check
  something with someone who has already install java server
  and used servlets on his computer.
  The context: I want to devellop a RMI application with a
  servlet that can store some datas on the server side. My
  commercial provider is vir.com, and they don't have java
  server since it is a beta release. I read most of the doc
  on java server, servlets and RMI but I'm still unsure
  about some aspects:

  a) How can my PC be access from outside?
    They say that I need to use the name of my computer in
    my network configuration. This name is 'My Computer',
    and there I'm unsure if I should remove the space. And I
    don't know neither how one can avoid collisions on
    internet if 2 guys choose 'My_computer' since it will
    give 2 times 'http://My_computer/ as a URL. Furthermore,
    I suppose that I have to call my commercial provider
    with my usual icon before to start java server, no? And
    then anyone who is trying to access this URL (mine)
    directly will be connect, right?

  b) How did you debug your servlets with RMI? I don't see
    how I can  debug RMI applic. without using a
    server-servlet pair.  But I suppose that there's another
    way than calling from another machine, no? I want to
    have an applet and a servlet that talk together but
    I'm unsure if it is possible to run the client applet on
    the same machine during the debugging step... Please
    answer only if you have already done something close to
    that.

0
Comment
Question by:jfbe
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
jpk041897 earned 50 total points
Comment Utility
To answer your questions in order:

a) The machine (PC or otherwise) where the server resides, must have a unique IP address (and/or domain name). I.e: It must be a web server. Once you have access to such a macine you can either have the server running constantly on that machine or invoke it as if it were a CGI application to launch it remotley. The use of a Domain name (aka. a unique IP address) will avoid a colition.

You will still have to establish a dial up conection with your ISP (Internet Service Provider) but only to set up an active winsock .

As an alternative, you could set up 2 NIC's (Network interface cards) inside your PC (or a 2 pc network) and establish the winsock through those.

b) In order to test your application you again must have access to a web server. The esiest way to do this is to download O'Rilley's Website from:

http://www.ora.com

from the software | free software section.

This is a comertial web server that you can install on your machine, and one running you can address it as either localhost or 127.0.0.1 for testing purposes.

For instance:

http://localcost/MyAplette.html.

You can then use the same box to debug all parts of your app. simoultaneously.


Notes:

a.- Website uses the htdocs directory as the web root directory. That is, you must place your html docs in this directory or one of its subdirectoryes.

b.- Your server can run from any directory, but for flexibility it is recomended that you place itn in your web servers cgi-bin directory, allowing you to launch it remotley via CGI calls.
0
 

Author Comment

by:jfbe
Comment Utility
Hi jpk (John Paul maybe...)

  Well, I think that there's perhaps a misunderstood here...
 The way you seems to explain it, there can't be name conflict
 on the internet although the procedure I read in Sun's examples
 talked about an arbitrary name in my network configuration (in
 the Java Server documentation). The way you explain it, such  name collision is impossible because...I need a web server.
 Well, Java Server is a webs erver, no? There might be a
 procedure that someone, (my provider) follow to avoid name
 duplication, but in JavaServer doc, I had to choose my name.
 I still don't understand why you suggested me to download a  server:Javaserver is supposed to be a server, why downloading
 another server (O'rilley server?) Perhaps I missed something,  but I've the impression that you didn't catch the nature of my
 question: Someone told me ia email a bit after your answer that
 he's able to test javaserver and servlets even without being
 online and without this new server you brought...It could be
 pratical also for me to access my pc server from outside if I
 let my pc open...But I'm not planning to buy network cards..
 
   Few hours after your answer, I got the impression that one can
  access a servlet (and javaserver) from an applet from the
  same machine: all someone need probably is to open a url that
  lead to my virtual URL from another window (Netscape). This is
  essantial if I want to debugg a servlet-applet pair from
  the same machine. But I can't test it immediatelly, I just
  wanted to check before..

  I've mix RMI and Javaserver in the same question, I read
 few hundreds pages of documentation the same week and it
 was a bit fuzzy in my mind but when I got back to RMI doc,
 I had the impression that it was completelly independant from  Javaserver. In the fact, I'm suppose to be able to write
 a standalone server with RMI...I don't belive with your  profile that you are on expert
 to make money and get points, but I'll see if there's a way to  readjust it if it's me who don't understand.
 Your story about this other
 commercial server added to my confusion: in the case of java
 server and an applet, why would I need it? in teh case of RMI,   why?
 
0
 
LVL 6

Expert Comment

by:jpk041897
Comment Utility
OK, by parts,

Once you are actually plugged into the Internet (via ISP or dedicated line) you cannot allow name conflicts. Imagine what would happen if two diferent companies used www.javasoft.com as an address. IP's are the same thing, A DNS translates a domain (www.javasoft.com for example into an IP). Which page would you load from your browser?

To solve this a non-profit organisation called INTERNIC was formed. They control which domain names are owned by whom and assign an IP to each one.

When you use Intranets, on the othe rhand, you can assign any IP you desire, provided that either  your intranet, with arbitrary IP's, does not have dirrect acces to the Iinternet at the same time or that your intranets IP are assigned by Internic.

It would be highly unusual that a client browser were to access your pages if they are not registered on a DNS, but the oppoosite is not necesarily true. If your abitrary IP's are also used by other servers, messages that you intend for your own intranet could end up going elswhere.

Second, the computer name is a string that you assign your computer arbitrarily (do not confuse it with your domain name). Iit is used by Windows networks (not Internet)  to identify a given box. This name is designed for small intranets. TCP/IP based networks (amongst which we can count Internet) are designed to work arround the concept of IP's. An IP is a 32 bit number that is logicaly ored with a net mask (another 32 bit number) to provide a unique address. The dot notation (192.74.15.17 for example), and Domain names were invented later to solve the problem of a human identifing a specific macine out of a list of several hundreds (now millions). So if you are using the Internet you need a unique domain name and IP address.

Independantly of all of this, two IP addresses were invented (reserved) to provide a unique functunality these are: 127.0.0.1, which is equivalent to http://localhost and which means myself (this machine) and 255.255.255.255 which means broadcat (all machines). You can certanly run both a client and a server using 127.0.0.1 as an address for the server (for testing purposes) but your question specified "How can my PC be access from outside".

By this question I uderstand: How can another computer acces my PC and not how can my PC access itself.

Now you specified in your question that your machine is a PC. I have yet been unable to get a PC to establish a Winsock without either dialin an ISP or using 2 network cards. This is due to a bug in Windows 95/NT winsock application that does not allow a PC without a Network card to have a localy defined IP address. It allows you to configure it, but not to use it. When calling Microsoft about this they will tell you that the fix is to use network cards.

Now, under Javaserver, Website, IIS or any other web server you have to assign a Domain Name (again, not a computer name). This domain name is requested by you from Internic and, if it hasn't been assigned to anyone else, can be yours for 2 years in exchange of $100.00 US. This is where Website comes in.

 Website has a free version, and it allows you to use your ISP's domain as your own domain, thus saving you the cost of network cards. As far as I'm awarwe, Java Server does not allow you to use your ISP's domain as your own without raising several protential problems. Quite simply Java Server was designed from the ground up to prove that Java is mature enough to produce a Web Server, Web Site was designed with the programmer in mind, Cosidering that he/she is neither rich nor intrested in dishing out $100.00 evry 2 years for testing.

Both MS IIS and Netscape comerce Server are designed arround the idea that you are a rich company (both products cost well over a thousand dollars) and that your site will probably also be an ISP.

Regarding RMI, RMI is a JAVA extetion to DEC's ONC RPC standard. This standard is part of the TCP/IP protocol suite. In escence this means that in order to use it you must hace a TCP/IP stack loaded.

 In order to load a TCP/IP stack under Windows, you need to either have a network card or use Winsock So in order to test your RMI code you need one of these two options. (Not to mention that you will probably need a web server to use RMI over applets).

Now the problem with RMI (aka RPC) is that it requires 2 addresses to complete a transaction, the master and the slave (client and server). 127.0.0.1 can certanly be one of thoe addresses. Which will be the other one?

An additional problem with using 127.0.0.1 as a test address is the fact that on network cards (and winsock),  loopback (i.e.: localhost) calls don't ever reach the TCP layes of the OSI model, they are inmediatley resolved and processed by the network card hardware itself, never going into the firmware.

What this translates to is that if all of your testing is done via 127.0.0.1, there is set oprogramming errors that you can make (particularly when doing socket programming) that will not cause an exception. They won't cause it because the appropiate TCP protocol inmplementations were never called! This results in programs that work perfectly on your machine but not at the clients.

I personaly experienced this when I wrote an RMI application that crashed because the clients machine used a proxy server that mapped Intranet addresses to localhost automaticaly. Since I had done all my testing to localhost, as soon as I tried to establic communication between to diferent machines using this proxy, the prrogram died.

Now regarding your final issue; I am an expert, and I answer all questions based on personal experience (20 years of it) and to the best of my knoledge.

But I don't get a penny for ansering these questions. Expert exchange probably gets some, but I don't work for them, as an empolyee, contractor or in any other capacity I did register in their program as an expert (anybody who knows the anser to a question, any question, can) but I did it for 2 reasons only:

1.- The news servers are sending over 300 messages a day. I simply don't have the time to read this volume of questions. This forum on the other hand only posts 5 or 6 question a day. Since I enjoy helping other people (because I have been stuck myself in the past) and would have hoped that someone who is not a college student had the time and inclination to hep me  when I was in trouble, I try to help others as my time allows.

2.- Some of the questions placed in this forum leave me at a total loss as to the answer. Since the questions have a cost, users tend to spend more time doing research on the answer , so they only post what is (to them ) really tough questions. As a result, I often have to research the questions myself and experiment on my spare time. This makes me a better programmer, it allows me to help others better, and (I admit it) allows me to charge my cutomers (as an independent contractor) more money because I can provide answers to tough questions in a short time (which is why they hire me).

As a final note, without any intention of sounding, or beeing aggresive or insulting, I make it a point to try to answer as many 50 point questions or less as I can, since tose experts who have been hired by experts exchane will generaly ignore them because they are not worth hteir time. I belive an expert recieves either 1 or 10 US cents per point, so experts usualy go for the high point questions. Since I'm tring to help, I usualy go for the low point questions and genaraly only comment on the high ones unless I observe that they have gone unanswered  for several days or are clasified as urgent.

Finaly, you don't need this other comertial server (although the version I suggested is free). I recomended it because I have personaly worked with it,  have found it robust, usefull, verry easy to use and designed with programmes in mind. For instance it comes with its own JAVA class library that allows you to write JAVA CGI's that use the POST method. This is notoriously annoing with other Web servers ever since SUN decided to remove the getEnv() method from its API.

I hope I have addressed all your doubts, if not, please feel free to post another comment or e-mail me dirrectly at jkelleghan@usa.net.

I don't promise I will be able to respond inmediatley, but I will respond any questions you may have. And if you are spending money on this service that you can't affoard and I know the answer, I will gladly answer you outside of this service.

All I ask in exchange is that if ever I get stuck and you know the answer you return the courtesy.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now