Ciao a tutti, qualcuno saprebbe aiutarmi riguardo questa eccezione?

Server returned HTTP response code: 500 for URL:

java.io.IOException: Server returned HTTP response code: 500 for URL:

Ho creato un java project e ho utilizzato questo codice:

Codice PHP:

package restfull
;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
/**
 * Main.java
 *
 * @author [url]www.javadb.com[/url]
 */
public class Main implements Serializable{

    
/**
     *
     */
    
private static final long serialVersionUID 1L;

    
/**
     * Extends the size of an array.
     */
    
public void sendPostRequest() {

        
//Build parameter string
        
String data "nome=pluto&cognome=pippo";
        try {

            
// Send the request
            
URL url = new URL("https://ip");
            
//URLConnection conn = url.openConnection();
            //HttpsURLConnection.setDefaultHostnameVerifier ( new NullHostnameVerifier ()) ;
            
HttpsURLConnection conn = ( HttpsURLConnection url.openConnection () ;

            
conn.setDoOutput(true);
            
conn.setRequestProperty("Accept-Charset""UTF-8");
            
conn.setRequestProperty("Content-Type""application/x-www-form-urlencoded;charset=" "UTF-8");


            
conn.setHostnameVerifier ( new NullHostnameVerifier ()) ;
            
conn.setDoOutput(true);
            
conn.setUseCaches(false);
            
conn.setRequestProperty("Content-Type""text/plain");
            
OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());


            
//write parameters
            
writer.write(data);
            
writer.flush();

            
// Get the response
            
StringBuffer answer = new StringBuffer();
            
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            
String line;
            while ((
line reader.readLine()) != null) {
                
answer.append(line);
            }
            
writer.close();
            
reader.close();

            
//Output the response
            
System.out.println(answer.toString());

        } catch (
MalformedURLException ex) {
            
ex.printStackTrace();
        } catch (
IOException ex) {
            
ex.printStackTrace();
        }
    }
    
/**
     * Starts the program
     *
     * @param args the command line arguments
     */
    
public static void main(String[] args) {
        new 
Main().sendPostRequest();
    }

    private static class 
NullHostnameVerifier implements HostnameVerifier {
        public 
boolean verify String hostnameSSLSession session ) {
            return 
true ;
        }
   }

grazie mille.