• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Final Questions

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have problems interpreting the EXECUTION and PACKAGING Requirements.

Specifications says:

"When you submit your assignment, each part (client and server) must be executable using a command of this exact form:

java -jar <path_and_filename> [<mode>]

"

and then

"All elements of your submission must be packaged in a single JAR file. The JAR file must have the following layout and contents in its root:
The executable JAR containing the programs. This must be called runme.jar.
"


If this is a CLIENT/SERVER application you are supposed to have to mains:

1/ To start the server.
2/ To start the client.


How am I suppose to run two mains from one jar only? As far as I know in a Manifest file you can only specify ONE MAIN class right?

I do have three configuration guis:

1/ One to set up server configurations(db location, host and port)
2/ Antoher one that looks exactly the same to set up client
configurations when running in network mode.
3/ Another one to run client when in ALONE mode.

I could very well have this three little guis being populated off one main based on the command line argument being passed (no problem here).

My concern basically arises because I do not know how they are going to test the exam. If they take out the Server code and put it on to another machine then they will not be able to start the server because the logic that populates the server was in the client side machine SINCE THE SUNCERTIFY.PROPERTIES IS ALSO ON THE CURRENT DIRECTORY.

My other concern is the purpose of the suncertify.properties file. The assignment says that it must be located in the current working directory.

What does that mean ? Current working directory for the server code in the other machine? Or current working directory for the client machine?

The way I have it working now is that I have all my application running of one machine and both client and server read and write their configurations to the file in the current working directory(no problem here).

But what happens if they move part of my code around to really make it CLIENT/SERVER?? How is the Client going to read the properties that the server set up in the current working directory of the machine that server code is running from?


I have done a lot of work on this certification and I would not like to get an automatic failure because the requirements are not really clear. Oh well, maybe it is my ESL.

Please Andrew and others help.


Thanks,

-Dario Pardo.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) you can only have a single startup location in an executable jar. That suggests you must create one and redirect to either client or server from there depending on the commandline.
2) why should there be only one properties file on one machine? If client and server run from different locations, each would have its own copy. And do remember that the properties file is not shipped with the application, it is generated by the software as it runs (it is not mentioned in the files listed to be included, and I think my assignment dictates it be generated on the fly).
The client and server must be independent. If your client needs the properties set by the server in order to work or vice versa you must change your design to remove that dependency.
 
Antonio Pardo
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying.

I understand your suggestion about redirecting to either the client or the server based on the parameter from the command line. But that means that if you can only have 'ONE' jar file and two different machines...I will have to place that jar in both machines with the whole entire code in it no??

for example in Machine A (SERVER) I do:

java -jar <path_and_fileName> runme.jar SERVER

Output: Server Configuration Dialog comes up and I type a Database
location, hostname and port number.

That yields: Programatically start the RMI registry
Link the remote object to the opened port.
Generate properties file.

Then in Machine B (CLIENT) I do:

java - jar <path_and_fileName> runme.jar

Output: Network Client Configuration Dialog comes up with supposeddly
the database location, hostname and port number from the
properties file previously generated by the server. (How is the
network client going to pick up the settings from the server if
the suncertify.properties for the server is physically on a
different machine?)

That yields: (If you do not modify anything), successfull connection.

I guess I do not see the purpose of being able to change the client configurations since if you do you are not going to have a successfull connection because the server is running on a different port. I think the client should just connect. In a real app you would never tell the end user to start entering ports and hostnames because they do not know what those are. So by forcing the user to connect to the opened port by the server it seems to me the best solution possible. Even though from the post that I have been reading I deduct many different things.


Do you guys know how do they test the submission?

  • Do they put your jar with ALL YOUR FILES on two different machines and then run SERVER in one and (blank = network client) in the other?? or...
  • Do they take your stubs and put them in another machine?? or
  • Do they just put the jar in ONE machine and run a 'fake' client/ server application on one machine like I am doing??



  • Thanks a lot. Please keep replying.
     
    Jeroen T Wenting
    Ranch Hand
    Posts: 1847
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The application IS your runme.jar.
    That jar is a single unit, you can assume everything in it will be available together at all times.

    Depending on the parameter passed at startup, either the client or server will be started.

    The client and server configurations must both be fully configurable precisely because you should be able to start the server on different machines and ports.

    What if you hardcode the client to use a connection to localhost on port 1099 and the assessor runs the server on a machine somewhere on the other side of the world (maybe test1.suned.nl.sun.com) on port 12352?
    And even if you didn't have to code for that possibillity, you'd get an automatic failure if you didn't so you'd better do it
    Remember that customer requirements don't have to make sense. As long as they pay you enough you're going to be coding it (though in a real project for a real customer you'd try to talk some sense into them).
     
    Antonio Pardo
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks Jeroen.

    So that would lead to my last question then:

    If they physically place the runme.jar in one machine and start the server and set the server configuration, The server is going to start and write into the suncertify.properties.

    If I go ahead and run runme.jar again from another machine to start the network client how is that client supposed to pick up the configurations set up by the server which will be on a suncertify.properties file but on another machine?

    I guess I can have it working if I start the server on one machine set the
    properties, do an ipconfig, get the ip address and then start the client on another machine and enter the configurations that are going to comply with that server JUST BECAUSE I KNOW THEM. Now the properties file though will only have the last configuration saved.

    Now if you tell me that everything happens in one machine then problem solved. I have no more questions. Because both client and server are going to read from the same properties file and when the network client starts if the server is running then it will pick up the settings by the server.
     
    Jeroen T Wenting
    Ranch Hand
    Posts: 1847
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    While the client and server both write their configurations to the same file (when on the same machine) they should have nothing to do with each other.
     
    There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic