Can't send object from Sever to Client

Hi everyone, I'm a newby in this forum. I have a problem in Network programming. I'm creating a server and a client in my program for my homework. I used mysql.connector-java-5.0.7-bin.jar in my project.
Here is the problem; in my server class the necessary codes are
String username = inputFromClient.readUTF();
String password = inputFromClient.readUTF();
String sql = "SELECT * FROM user_information WHERE user_name = '"username"' AND password = '"password"'";
try {
stmt = connection.createStatement();
ResultSet rs =stmt.executeQuery(sql);
if(rs.next()){
outputToClient.writeUTF("Login succeeded");
System.out.println("Login succeeded");
String sql2 = "SELECT name from patient";
stmt = connection.createStatement();
objectToClient = new ObjectOutputStream(socket.getOutputStream());
ResultSet rs2 = stmt.executeQuery(sql2);
Vector v = new Vector();
while(rs.next()){
v.add(rs.getString(1));
objectToClient.writeObject(v);
else{
outputToClient.writeUTF("Login failed");
System.out.println("Login failed");
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}and in my client class necessary codes are
try {
     Socket socket = new Socket("localhost", 8000);
     System.out.println("Connected to server");
     dataFromServer = new DataInputStream(socket.getInputStream());
     dataToServer =new DataOutputStream(socket.getOutputStream());
     dataToServer.writeUTF(username);
     dataToServer.writeUTF(password);
     String answ = dataFromServer.readUTF();
     if(answ.equals("Login succeeded")){
          try {
               try {
                    Vector v = (Vector)objectFromServer.readObject();
               } catch (ClassNotFoundException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
          } catch (IOException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
     else
     } catch (UnknownHostException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
     } catch (IOException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
     }After I start Server loging process works fine but then I get this exception
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     at Client$4.actionPerformed(Client.java:298)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1879)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2199)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:450)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:288)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:264)
     at java.awt.Component.processMouseEvent(Component.java:5529)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3148)
     at java.awt.Component.processEvent(Component.java:5294)
     at java.awt.Container.processEvent(Container.java:2001)
     at java.awt.Component.dispatchEventImpl(Component.java:3996)
     at java.awt.Container.dispatchEventImpl(Container.java:2059)
     at java.awt.Component.dispatchEvent(Component.java:3844)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4249)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3929)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3859)
     at java.awt.Container.dispatchEventImpl(Container.java:2045)
     at java.awt.Window.dispatchEventImpl(Window.java:1810)
     at java.awt.Component.dispatchEvent(Component.java:3844)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:545)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:268)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:197)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:191)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:183)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:144)
And it points Vector v = (Vector)objectFromServer.readObject(); in Client class. It is a problem about sending Object but I can't figure it out. Maybe you can help? Thanks

Hi Aykt87,
In your server source, just have a look at this :
ResultSet rs2 = stmt.executeQuery(sql2);
Vector v = new Vector();
while(rs.next()){
v.add(rs.getString(1));
} rs2, rs?

Similar Messages

  • Can't send messages from outlook pop client 550 5.7.1 relay error

    my outlook users (pop3) are not able to send using the messaging server they receive a 550 5.7.1 no relaying error.
    they are located on a lan, the mail server is ouside of the lan (on its own lan) - is there a setting to change, to allow relaying from certain places, or a better solution?
    thanks,
    s7

    Authentication is the "safe" way to address this, but, you can rather easily find the ip address where the connection comes from.....
    Add "log_connection=1" to option.dat, recompile, and restart dispatcher, and the ip address gets logged...
    If your router/firewall does "store and forward", it may be that your second network is seen as coming from the router. If that's the case, and the same ip is also seen as the source for all your external mails, then reconfiguration of your router would be the best route.
    We find that routers/firewalls that try to "filter" smtp traffic usually are a "bad idea". These companies know how to do very good firewalls, but are often pretty limited in writing SMTP packages. We see lots of strange errors caused by such.

  • Mail can't send email from 123-reg accounts

    Hi all,
    I've got an issue with Mac Mail can’t send email from 123-reg accounts.
    I know there is a lot of articles on simular matters and some I have tried out with no luck, others are just speaking a whole other language.
    Any help would be greatly recived, here's my situation below:
    Running a iMac 2.8GHz Intel Core i5 on OS X 10.8.3
    I’m using 3 accounts on Macs Mail client, one is my iCloud account that is working fine and the other two are my 123-reg accounts that I use for business purposes. I’ve been working like this for a couple of years now and about 6 months ago I upgrade my operating system from Snow Leopard to Mountain Lion.
    2 or 3 months ago I randomly got a problem where I was unable to send any emails from my 123-reg account, I could only receive emails. I checked my settings and they were all correct and unchanged so I attempted to delete them and recreate the account but with no such luck.
    I then decided to check if it was a problem at 123-regs end and attempted to log into web mail. This worked and was able to both send and receive emails so eliminated that possibility.
    I also have these accounts set up on my iPhone, so checked if there was any issues and everything was working fine. I then checked my iphone details and made sure the same was on my desktop and still no such luck.
    I’ve tried out some of the articles I’ve found on here (the ones written in plain English) still no results. I’m not very IT illiterate and just wondered if anyone else has got any ideas, whether there is something specific with 123-reg accounts and Mac Mail?
    Many thanks.

    Thanks
    I just had another hunt around looking at posts and discovered that it was because I recently changed to BT Infinity and they had a block on.
    I didn't even think to question the ISP.
    https://discussions.apple.com/message/21173608#21173608

  • TS4291 I can't send mail from my iPad apps, I just get the error message, 'The recipient- was rejected by the server because it does not allow relaying.' Does anyone know what this means and how to fix the problem.

    I can't send mail from my iPad apps, I just get the error message, 'The recipient… was rejected by the server because it does not allow relaying.' Does anyone know what this means and how to fix the problem.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Using a POP account with multiple devices
    http://support.apple.com/kb/ht3228
    iOS: Adding an email account
    http://support.apple.com/kb/HT4810
    iOS: Setting up an Outlook.com, Hotmail, Live, or MSN email account
    http://support.apple.com/kb/ht1694
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    How to Sync Contacts with Your iPad Using iTunes
    http://www.dummies.com/how-to/content/how-to-sync-contacts-with-your-ipad-using- itunes.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    eMail Groups - You can use a third party app that many users recommend.
    MailShot -  https://itunes.apple.com/us/app/mailshot-pro-group-email-done/id445996226?mt=8
    Group Email  -  https://itunes.apple.com/us/app/group-email!-mail-client-attachments/id380690305 ?mt=8
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • How can i return object from oracle in my java code using pl/sql procedure?

    How can i return object from oracle in my java code using pl/sql procedure?
    And How can i returned varios rows fron a pl/sql store procedure
    please send me a example....
    Thank you
    null

    yes, i do
    But i can't run this examples...
    my problem is that i want recive a object from a PL/SQL
    //procedure callObject(miObj out MyObject)
    in my java code
    public static EmployeeObj callObject(Connection lv_con,
    String pv_idEmp)
    EmployeeObj ret = new EmployeeObj();
    try
    CallableStatement cstmt =
    lv_con.prepareCall("{call admin.callObject(?)}");
    cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
    //registerOutParameter(int parameterIndex, int sqlType,String sql_name)
    cstmt.execute();
    ret = (EmployeeObj) cstmt.getObject(1);
    }//try
    catch (SQLException ex)
    System.out.println("error SQL");
    System.out.println ("\n*** SQLException caught ***\n");
    while (ex != null)
    System.out.println ("SQLState: " + ex.getSQLState ());
    System.out.println ("Message: " + ex.getMessage ());
    System.out.println ("Vendor: " + ex.getErrorCode ());
    ex = ex.getNextException ();
    System.out.println ("");
    catch (java.lang.Exception ex)
    System.out.println("error Lenguaje");
    return ret;
    Do you have any idea?

  • Can we send files from iphone to another phone like samsung

    can we send files from iphone to another phone like samsung?

    Actually we are not mapping machine name something in webutil.cfg file. We just need to specify the path that from where we will transfer the file from application server to client. And the time time of transfer the path you will
    choose for client webutil will transfer the file on that location automatically.
    -Ammad

  • How can I send stuff from one iPhone to another via Bluetooth?

    How can I send stuff from one iPhone to another via Bluetooth?

    There are some apps that will let you send photos from one iOS device to another over BT.

  • I can't send emails from iPhone until I connect to my wifi! I am with bigpond and have a bigpond email address. Can anyone help me?

    I can't send emails from iPhone until I connect to my wifi at home. I am with bigpond and have a bigpond email address. Can anyone help me?

    Try closing the Mail app completely and see if it works properly when you re-open it : from the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • TS3899 I still can not send email from my ipad but iPhone works on those accounts

    I still can not send email from my .mac account or a .comcast.net from my ipad. I how 2 people so far that has brought to my attention. We have exchange accounts setup on the ipads for work. I compare the settings from iPad to iPhone from my view it appears identical. I am looking at an iPad 2 and a Mini.
    I turned on and off the ipads and nothing really changed. The emails come into those accounts.
    Any suggestions?
    Thanks
    VickiHTC

    When you say you can't send...as in they never get the email?  Does the email appear to send?  Error message?  When?
    It may be more than one iPad that has a problem....

  • I can't send email from my iPad. I am from Australia but on holidays in Greece. Does anyone know what is the smtp outserver for Greece that I should use?

    I can't send email from my iPad. I am from Australia but on holidays in Greece. Does anyone know what is the smtp outserver for Greece that I should use?

    As you haven't told us who your email provider is, no.
    There isn't an SMTP server for Greece - it is either provided by your email provider, or the Internet provider you are connected through.

  • I can not send email from my iPad .  Have been using it for over a year, all of a sudden I can only receive email.  I have a wifi connection in my home and have a A T &T cellular data plan?

    I can not send email from my iPad .  Have been using it for over a year, all of a sudden I can only receive email.  I have a wifi connection in my home and have a A T &T cellular data plan?

    I have a 1st gen iPhone that I just updated the software to 2.0.2
    Now whenever I press the mail icon it goes to the mail app for about 4 seconds, does nothing, no loading of folders, old messages, nothing.
    Then it reverts back to the home screen. Tried restarting, haven't tried restoring, thought I'd look here first.
    Anyone???

  • On 3G we cannot send emails from either our iPhones or iPad and this also happens with some WiFi connections but not all.  Yet we can always send emails from our Hotmail Email account.  What is causing this and what do we need to do to resolve it?

    On 3G we cannot send  Business emails from either our iPhones or Ipad and this also happens with some WiFi connections but not all.  Yet we can always send emails from our Hotmail Account using both 3G and WiFi.
    We bought the iPhones and Ipad so that we could send emails while we are out of the Office, but we are not able to do this unless we can find a WiFi connection. Incoming emails are fine.  We use IMAP, for Business emails just incase this is relevant and I know that Hotmail is POP3.
    Our technical IT knowledge is not great, so we look forward to your suggestions as to how to resolve this. 

    Contact whomever supports the email account and get the correct Outgoing email server settings from them.

  • Can't send email from Outlook with parentheses in address

    I can't send email from Outlook 2007 through my WRT400N when Outlook displays the address with parentheses as in this example: Firstname Lastname ([email protected])
    I can send if the address is in this form: Firstname Lastname <[email protected]>
    I have tested with the ISP and nothing gets through the router when the problem occurs. When I bypass the router, both forms of address will send correctly. This problem is perfectly reproducible. My router is brand new, but the problem did not show up for about a week after installation. OS is Win7. Any ideas? Thanks.
    -JimW
    Solved!
    Go to Solution.

    Try to forward the port 443 to 447 on the router.Check this link.

  • TS3899 I can't SEND email from Telus account in Alberta, Canada? Does anyone know how to set up the Outgoing server? Help! And thanks!

    Can't SEND email from Telus account in Alberta, Canada, unless I go to web mail. Does anyone know how to set up the Outgoing server? Incoming is fine. Outgoing used to work. We changed it when we went to another location, and can't get it back. Telus support can't fix it. Neither smtp.telus.net NOR mail.telus.net works for Outgoing server to send mail. Please help! Thanks.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • How can I send email from my yahoo alias account in iPhone5 mail?

    How can I send email from my yahoo alias account in iPhone5 mail?
    I have 2 email accounts: [email protected] is an alias of [email protected]
    In my old iPhone3 I had these accounts set up so that I could send and receive email from both accounts. I did this using the following settings:
    ‘Other’ POP account info:
    Name: xyz
    Address: [email protected]
    Description: alias
    Incoming mail server:
    Host name: pop.mail.yahoo.com
    User name: [email protected]
    Password: password for yahoo account
    Server port: 995
    Outgoing mail server:
    SMTP: smtp.o2.co.uk (o2 is the name of my phone network)
    Server port: 25
    ‘Yahoo!’ account info:
    Name: xyz
    Address: [email protected]
    Password: password for yahoo account
    Description: Yahoo!
    Outgoing mail server:
    Primary server: Yahoo! SMTP server
    Server port: 465
    I’ve tried using the same settings in my new iPhone5, but it doesn’t work. I can receive mail to both accounts, and can send from the Yahoo account, but I cannot send mail from the alias account. When I try, it displays the message: “Cannot send mail. A copy has been placed in your Outbox. The recipient ‘[email protected]’ was rejected by the server”.
    I’ve tried to configure the POP alias account using combinations of ‘pop.mail.yahoo.com’, ‘pop.mail.yahoo.co.uk’, ‘apple.pop.mail.yahoo.co.uk’ and ‘apple.pop.mail.yahoo.com’, for the incoming host, and ‘smtp.o2.co.uk’, ‘smtp.mail.yahoo.com’, ‘smtp.mail.yahoo.co.uk’, ‘apple.smtp.mail.yahoo.com’ and ‘apple.smtp.mail.yahoo.co.uk’ for the outgoing mail server. None of these have worked.
    I’ve also tried setting it up using IMAP instead of POP without success. I tried configuring it using combinations of ‘imap.mail.yahoo.com’, ‘apple.imap.mail.yahoo.com’, ‘imap.mail.yahoo.co.uk’ and ‘apple.imap.mail.yahoo.co.uk’ for the incoming mail server and ‘smtp.o2.co.uk’, ‘smtp.mail.yahoo.com’, ‘smtp.mail.yahoo.co.uk’, ‘apple.smtp.mail.yahoo.com’ and ‘apple.smtp.mail.yahoo.co.uk’ for the outgoing mail server.
    Yahoo say that if I can't send Yahoo! Mail from my mail program, I may be accessing the Internet through an ISP that is blocking the SMTP port, and that if this is the case, I should try setting the SMTP port number to 587 when sending email via Yahoo!'s SMTP server. I don't think that this is the problem, but I tried it just to make sure - without success.
    I’ve also heard that the problem might have something to do with the SPF settings of my alias domain provider. I’m not too sure exactly what SPF settings are, or how to change them, but from what I can gather it seems unlikely that this is the problem given that I was able to send mail from my alias account on my old iPhone3.
    Any help much appreciated: how can I get my alias account to send emails in iPhone5 mail?
    Many thanks,
    Patrick

    A new development: I've tried sending emails from the alias several times over the past 24 hours, but in general I've deleted them if they haven't sent within about half an hour.
    However, one of the messages I left sitting in the outbox did send successfully in the end, but this took about an hour.
    So: perhaps my problem is not in fact that I am completely unable to send mail from my alias, but that I can only do so intermittently and extremely slowly, and by ignoring the "cannot send" message.
    Any help appreciated.

Maybe you are looking for

  • Using Skype moderatorss to Harass me after I block...

    Okay this has never happened to me before so I have absolutely no idea what to do and am absolutely dumbfounded. I ran a website where this girl found me and started contacting me repeatedly. I finally decided she's friendly and just want someone to

  • Audio and Video out of Sync after Pro Res export

    I´m getting an audio/video sync issue when I´m exporting to Pro Res. I started off in a HDV1080i50 sequence. Audio sampling rate is 48khz. (16 bit depth) The sequence is less than 20 minutes long. It plays correctly on the timeline. When I export the

  • EDLNOT - Consignment Order

    Hi I had a quick question on EDLNOT message type of IDOC. Please let me know the answer when you get a chance. We use consignment order process in the Auto industry here document flow here is as follows: Scheduling agreement LK => Delivery into Consi

  • Extracting info out of a long raw

    I have a table (actually from the Peoplesoft financials system) with a field type of :- MIMEDATALONG LONG RAW() This field contains an XML document, I'm trying to extract the XML out of the field using SELECT. I've tried every function I know of, but

  • Can anybody help in german? is there a german forum?

    i need help with adobe acrobat 10