wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes A strange problem about the independent client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "A strange problem about the independent client" Watch "A strange problem about the independent client" New topic
Author

A strange problem about the independent client

Xin Gang Sun
Greenhorn

Joined: Sep 03, 2009
Posts: 17
Hello,
I find a new strange problem when I just want to submit. But no troubles according to the instructions.html.
I have four packages in the suncertify, they are client, common, server and db. The runme.jar is OK in the 3 modes. Then I have a test that make a client.jar which contains the client-side needed(suncertify.client & suncertify.common packages). I start a server by "java -jar runme.jar server", then I start a client by "java -jar client.jar" and the client-side GUI appears. It is strange that the client can not connect to the server. The "runme.jar"-client is OK, but "client.jar"-client is not. All of the classes it needs are in the client.jar with a new entry point, but the common entry point.
It puzzled me, though it is unnecessary according to the instructions.html.
If some friend understand, please tell me.
Thanks.


Xin Gang Sun
boolean scjp_6 = true;
boolean scjd_URLyBird = willBeTrue();
//I hope!
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5126
    
  12

Hi Xin,

Let me make some things clear to you:
  • you don't need a client.jar, only a runme.jar! For what reason do you want to create a client.jar
  • if you have to call "java -jar runme.jar -client" in order to start the standalone client, you will fail automatically (unless your instructions are different than mine). The allowed arguments are "alone", "server" and no argument for starting the client in networked mode.


  • So if your client.jar does not work, why create it? It is not required!

    Kind regards,
    Roel


    SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
    http://www.javaroe.be/
    Xin Gang Sun
    Greenhorn

    Joined: Sep 03, 2009
    Posts: 17
    Hi Roel,
    I know that. I will submit with the runme.jar and I don't want a automatic failure. Thank you and don't worried about that.
    I just try to separate the client-side and find some problems. There is no problem in my submission.
    Thanks.
    K. Tsang
    Bartender

    Joined: Sep 13, 2007
    Posts: 2231
        
        7

    Hi Xin, I see you try sepearating the classes into client and server jars. Well indeed it's not necessary for submission but in reality, it wouldn't run as you expected. Why? Let see. Stand-alone client talks to the local db - works fine because you should have the db files with the gui files. Now server, the setup window may run but it will not able to connect ... of course unless you include the db files in the server jar, which makes the gui setup not able to run - because ...

    Anyway it's the main class. some where you have new Client() or new Server() which makes all those files linked together making it inseparable. Of course you could always make separate main classes.


    K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
    Xin Gang Sun
    Greenhorn

    Joined: Sep 03, 2009
    Posts: 17
    Thank you,
    but I just separated cliend-side in the networking mode. In my thought, it has all it needs.
    Not mind, I'm going to submit.
    Good luck, friends.
    Roberto Perillo
    Bartender

    Joined: Dec 28, 2007
    Posts: 2258
        
        3

    Howdy, Xin!

    Champion, I understand your approach and the way you want to test your application. As long as you submit everything in a runme.jar and stick to the rules, you may perform any tests you want without any problem.

    Now, if I undestood your problem, you are able to start the server, but you can't have a client connect to it with success... is it correct? Are you able to connect to it if you have only one .jar file? If so, then I'd say that's sort of weird...


    Cheers, Bob "John Lennon" Perillo
    SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
    Xin Gang Sun
    Greenhorn

    Joined: Sep 03, 2009
    Posts: 17
    Yes, Roberto,
    you are right, use all of classes is ok, but use the enough classes is not. It is strange.
    Roel De Nijs
    Bartender

    Joined: Jul 19, 2004
    Posts: 5126
        
      12

    Hi Xin,

    Do you get any stacktrace? Or could you just not connect without any exception?

    Kind regards,
    Roel
    Xin Gang Sun
    Greenhorn

    Joined: Sep 03, 2009
    Posts: 17
    Hi Roel,
    Do you get any stacktrace? Or could you just not connect without any exception?

    Just catch a RemoteException, said that it can not connect to the server-side when the server is already running. The port and ip is correct. But server and client (networking mode) use different jar file.
    Not mind, I submitted it yesterday, no such problem in my submission.
    Thanks.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: A strange problem about the independent client
     
    Similar Threads
    RemoteException in B&S
    jar file
    UrlyBird 1.2.1 passed 359/400
    packaging runme.jar
    elp Needed for SCJD Assignment Deliverable