IOException on Connection

Hi,
here is my program when i run that program, it throws an IOException which is as under.
Io Exception : the Network Adaptor could not extablish the connection.
Plz help me
THANKS IN ADVANCE.
import java.sql.*;
public class OracleDb {
Connection dbCon;
public OracleDb() {
public Connection doConn() throws SQLException{
try {
          Class.forName("oracle.jdbc.driver.OracleDriver");
dbCon = DriverManager.getConnection("jdbc:oracle:thin:@Farukh:1522:orcl","Scott","Tiger");
     catch (ClassNotFoundException e) {
          System.out.println("DataBase Driver not Found");
          System.out.println(e.toString());
System.out.println(e.getMessage());
return dbCon;

Hi,
here is my program when i run that program, it throws an IOException which is as under.
Io Exception : the Network Adaptor could not extablish the connection.
Plz help me
THANKS IN ADVANCE.
import java.sql.*;
public class OracleDb {
Connection dbCon;
public OracleDb() {
public Connection doConn() throws SQLException{
try {
          Class.forName("oracle.jdbc.driver.OracleDriver");
dbCon = DriverManager.getConnection("jdbc:oracle:thin:@Farukh:1522:orcl","Scott","Tiger");
     catch (ClassNotFoundException e) {
          System.out.println("DataBase Driver not Found");
          System.out.println(e.toString());
System.out.println(e.getMessage());
return dbCon;
} Io Exception : the Network Adaptor could not extablish the connection.
This error means that your connection information is not good. In particular, it usually means either your database server host name or the DB port number is bad.
In your example, I would check "Farukh" and "1522" to see if these values are correct.
BTW, the default DB port is 1521. Are you sure 1522 is correct?
Thanks.
Sung

Similar Messages

  • Java.io.IOException: Persistent connection dropped

    Hi all,
    I am currently testing my midlet that uses a HTTP connection to link to a server using the emulator. However, I keep getting the following exception about a minute after the connection is established:
    java.io.IOException: Persistent connection dropped after first chunk sent, cannot retry
    at com.sun.midp.io.j2me.http.Protocol.sendRequest(+102)
    at com.sun.midp.io.j2me.http.Protocol.sendRequest(+6)
    at com.sun.midp.io.j2me.http.Protocol.closeOutputStream(+4 )
    at com.sun.midp.io.BaseOutputStream.close(+14)
    at java.io.DataOutputStream.close(+7)
    at Conn.sendData(+25)
    at Conn.doPost(+17)
    at Conn.upload(+4)
    at UploadThread.run(+7)
    Here is the code for my sendData() method
    public static void sendData( HttpConnection connection, String data ) throws IOException
         byte[ ] dataOut = data.getBytes();
         DataOutputStream os = connection.openDataOutputStream();
            try
              os.write( dataOut );
              os.flush();
         finally
              os.close();
    }Any help or suggestions as to why I am getting this exception would be greatly appreciated.

    Should i use a persistent connection and could you try to explain what the
    exception actually means?I just thought that the connection may be dropped somehow (maybe a timeout) and it may be related to closing OutputStream you obtain from the connection.
    Every time i send data i create a new thread that opens up a new connection
    and sends the data and receives the response.
    I does this as i am only sending and receiving very small amounts of data. I am thinking that there can be a better design for your application. Is it possible?
    1. If you are using the same connection (i mean socket connection not output)
    why do you close the OutputStream after sending each data. As far as i know flush does this already.
    So why dont you close both the connection and the OutputStream when the job of your program ends.
    2. If you are not using the same connection for each thread, (aagain) why dont you open and close both the connection and the OutputStream in your finally block of your thread?
    Regards.

  • Inputstream.java.io.IOException  ,  applet connection

    I'm working on a problem with the failure of a java
    applet connection to a java servlet.
    The connection is via the internet, and over port 80.
    the java console loggin reports the following
    There was an attempt to redirect a url request,
    but the attempt was not allowed by the client. IOException caught in run
    could some one let me know what the URL re-direction is here,
    much apreciated,
    slainte

    I have often found this problem with inexperts java programmers.
    I could tell you better luck next time, but today I feel generous, so I will answer.
    There is a redirect domain problem. When you try to connect the site you receive an ICMP error message, which is the responsable of the error message you can see. That occurs because the URL connects to another URL different (surely because its original URL has changed to another) and you only have to discover the new URL, and try to connect to it.

  • Database control shows java.lang.Exception: IOException in connect refuse

    Hi All,
    I need some help on this issue.
    I followed MOS Doc 259387.1 to reset dbsnmp password because its password is unknown.
    The error is
    Error
    java.lang.Exception: IOException in sending Request :: Connection refused
    Thanks in advance.
    leim

    Hi,
    Posting this error in metalink you could get nice directions...
    I have the same problem, and looks fixed now...
    Try review doc 420761.1
    And what I do, was:
    Stop dbconsole
    start dbconsole (fails)
    review logs generated and look this errors:
    $ORACLE_HOME/<hostname>_<instance_name>/sysman/log
    doing there a directory listing by date, "ls -ltr" the last file showed is the modified one, in my case was:
    rw-r--- 1 oracle oinstall 920007 Oct 27 19:33 emoms.log
    -rw-r----- 1 oracle oinstall 522694 Oct 27 19:34 emdb.nohup
    -rw-r----- 1 oracle oinstall 39130 Oct 27 19:38 emdctl.trc
    tail emdctl.trc
    2009-10-27 19:19:05 Thread-14236448 ERROR main: nmectl.c: nmectl_validateTZRegion, agentTZoffset =-360,and testTZoffset for -05:00:-300 do not match
    2009-10-27 19:19:05 Thread-1125024 WARN http: snmehl_connect: connect failed to (<hostname>:3938): Connection refused (error = 111)
    And tail emdb.nohup gives you the instructions to fix the first one, in my case, solving the TZRegion was enough.
    $ tail emdb.nohup
    ----- Tue Oct 27 19:19:05 2009::The agentTZRegion value in /oracle/product/102/db_1/dbserver.uadec.mx_siin/sysman/config/emd.properties is not in agreement with what agent thinks it should be.Please verify your environment to make sure that TZ setting has not changed since the last start of the agent.
    If you modified the timezone setting in the environment, please stop the agent and exectute 'emctl resetTZ agent' and also execute the script 'mgmt_target.set_agent_tzrgn' to get the value propagated to repository -----
    Hope this could help you.
    Regards
    Edited by: EnriqueGB on 27/10/2009 08:16 PM

  • Socket I/P stream's read fails to throw IOException when connection is lost

    Hi,
    Socket.getInputStream().readShort() blocks till it reads from the server. It throws an IOException if the connection is lost before calling the method. But it is not throwing an IOException if the connection is lost after blocking.
    That is....
    // If the connection is lost before calling, it is throwing an IOException.
    short s = mySocket.getInputStream().readShort();
    // But, while it is blocked and if I shutdown the server, it's never throwing
    // an IOException and it stays blocked.How should I get around this problem?
    Thank you!

    It's true; a timeout is really the best way.
    One approach I thought about using, where I was in control of the protocol, was to periodically send a "nop" type operation to the socket; a message that doesn't do anything. Obviously not all applications have this liberty, either because you aren't in control of the protocol, or because you want to keep your application single threaded. It's also kind of hackish, and not as good as the timeout mechanism in most respects.
    You also have to be a little careful about what you define as a "connection failure". If, for example, you set up a TCP/IP socket without a timeout, and then physically disconnect the ethernet cable, the connection will in fact stay up. If you come back an hour later and plug in the cable again, the connection will still be there and will pass traffic again.

  • Calling a WebServices From Java Stored Proc fails with Connection refused

    I have followed the example in Note:220662.1 on Metalink step by step.
    I am using two windows machines (2000 SP4). I have Oracle 9.2.0.5 EE on one of them and OC4J 9.0.4 standalone on the other(running on JVM 1.4.2_05-b04). The 2 servers "see" each other over the network.
    I can execute the stub from the database machine:
    C:\WebServices\HelloWorld>java HelloWorldImplWSStub
    Hello World - The current time is Sat Aug 21 11:56:20 EDT 2004When running it from the database, I get:
    SQL> select ws_hello_world from dual;
    select ws_hello_world from dual
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: [SOAPException:
    faultCode=SOAP-ENV:IOException; msg=Connection refused;
    targetException=java.net.ConnectException: Connection refused]
    Elapsed: 00:00:21.02The trace file generated on the database server machine looks like:
    [SOAPException: faultCode=SOAP-ENV:IOException; msg=Connection refused; targetException=java.net.ConnectException: Connection refused]
      at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(OracleSOAPHTTPConnection.java:765)
      at org.apache.soap.rpc.Call.invoke(Call.java:261)
      at HelloWorldImplWSStub.sayHelloWorld(HelloWorldImplWSStub.java:52)Here is the stub code generated using JDeveloper 9.0.5.1:
    import oracle.soap.transport.http.OracleSOAPHTTPConnection;
    import org.apache.soap.encoding.SOAPMappingRegistry;
    import java.net.URL;
    import org.apache.soap.rpc.Call;
    import org.apache.soap.Constants;
    import java.util.Vector;
    import org.apache.soap.rpc.Response;
    import org.apache.soap.rpc.Parameter;
    import org.apache.soap.Fault;
    import org.apache.soap.SOAPException;
    import java.util.Properties;
    public class HelloWorldImplWSStub  {
      public HelloWorldImplWSStub() {
        m_httpConnection = new OracleSOAPHTTPConnection();
        m_smr = new SOAPMappingRegistry();
      public static String endpoint = "http://oc4jsrv:8888/MyWorkarea-OC4J-context-root/HelloWorldImplWS";
      public String getEndpoint() {
        return _endpoint;
      public void setEndpoint(String endpoint) {
        _endpoint = endpoint;
      private static OracleSOAPHTTPConnection m_httpConnection = null;
      private static SOAPMappingRegistry m_smr = null;
      public static String sayHelloWorld() throws Exception {
        String returnVal = null;
        URL endpointURL = new URL(_endpoint);
        Call call = new Call();
        call.setSOAPTransport(m_httpConnection);
        call.setTargetObjectURI("HelloWorldImplWS");
        call.setMethodName("sayHelloWorld");
        call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
        Vector params = new Vector();
        call.setParams(params);
        call.setSOAPMappingRegistry(m_smr);
        Response response = call.invoke(endpointURL, "");
        if (!response.generatedFault()) {
          Parameter result = response.getReturnValue();
          returnVal = (String)result.getValue();
        else {
          Fault fault = response.getFault();
          throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
        return returnVal;
      public void setMaintainSession(boolean maintainSession) {
        m_httpConnection.setMaintainSession(maintainSession);
      public boolean getMaintainSession() {
        return m_httpConnection.getMaintainSession();
      public void setTransportProperties(Properties props) {
        m_httpConnection.setProperties(props);
      public Properties getTransportProperties() {
        return m_httpConnection.getProperties();
       public static void main(String[] argv) throws Exception   {    
        HelloWorldImplWSStub hstub = new HelloWorldImplWSStub();    
        System.out.println(hstub.sayHelloWorld());  
    }The PL/SQL function code:
    CREATE OR REPLACE FUNCTION ws_hello_world RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'HelloWorldImplWSStub.sayHelloWorld() return java.lang.String';Any help would be greatly appreciated.

    Hello,I have the same problem. Did you find any solution to it?
    Thanks. Diego (Argentina)

  • Help with connection to mysql database, Getting error : No suitable Driver

    Below is my code :
    1) i have added the mysql driver (mm.mysql-2.0.14-bin.jar)in my classpath
    2) the code is getting compiling properly
    3) while running it using tomcat, it says "NO SUITABLE DRIVER"
    PLEASE HELP !!
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class logincheck extends HttpServlet {
    public void doGet(HttpServletRequest request,HttpServletResponse response)
    throws IOException, ServletException
    Connection con = null;
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    PreparedStatement stmt = null;
    ResultSet rs = null;
    String userid = request.getParameter("userid");
    String password = request.getParameter("password");
    try {
    /** LOADING THE DRIVER FOR MYSQL DATABASE ***/
    Class.forName ("org.gjt.mm.mysql.Driver";
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } //End of try-catch 1
    try{
         /*** CONNECTING TO THE DATABASE USING DATABASE NAME, USERNAME AND PASSWORD */
    con = DriverManager.getConnection("jdbc:mysql://localhost:8080/own");
    /****** this checks whether the entry for the user is in the database *****/
    stmt = con.prepareStatement("SELECT *FROM userinfo WHERE userid = ? AND passwd = ?");
    stmt.setString(1,userid);
    stmt.setString(2,password);
    rs = stmt.executeQuery();
    if(!rs.next())
    else
         /****************** IF THE USER AND PASSWORD ARE VALID *****************/
    //} // END OF RS.....
    // NEED HTML FOR INVALID USERID SHOWING MESSAGE ...
    con.close();
    }catch(SQLException esql){
    System.out.println(esql.getMessage());
    } // End of try-catch 2
    } // goGet
    public void doPost(HttpServletRequest request,HttpServletResponse response)
    throws IOException, ServletException {
    doGet(request, response);
    } // goPost
    } // end logincheck function ...

    And i see another thing that confuses me. Your URL connection string is
    con = DriverManager.getConnection("jdbc:mysql://localhost:8080/own"); meaning that your database is in your machine and listens in port 8080 for incoming connections. But that is the default port that Tomcat listens! Maybe you should change this line to
    con = DriverManager.getConnection("jdbc:mysql://localhost:3306/own");where 3306 is MySQL's default port.
    Hope these help.

  • ORA-12519 with servlet connect

    Hi,
    I'm facing a strange behaviour on my tomcat webserver with a servlet. I'm using Oracle 10g as the database and try to access it with my servlet.
    The doPost-method throws the following exception while trying to establish the connection to the RDBMS:
    "SQLException:
    Connecting not possible:
    Listener refused the connection with the following error:
    ORA-12519, TNS:no appropriate service handler found The Connection descriptor used by the client was: localhost:1521:DBTEN"
    After starting my servlet, the connection to the database for other applications blocks with the same error message
    for a few minutes. After these few minutes connecting to the database is possible again!!! Restarting the database and the listener also helps...
    public void doPost( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException {
    Connection conn = null;
    response.setContentType( "text/html" );
    PrintWriter out = response.getWriter();
    String connStr = "jdbc:oracle:thin:@localhost:1521:DBTEN";
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    }catch( ClassNotFoundException cnf ){
    out.println( "CNFException: "+cnf.getMessage() );
    //retrieve Connection
    try{
    conn = DriverManager.getConnection( connStr, "scott", "tiger" );
    }catch( SQLException sqle ){
    out.println( "SQLException: <BR> Connecting not possible: <BR> "+sqle.getMessage()+"<BR>" );
    When I put that part in a 'normal' main program everything is ok. I can connect to the database and access tables with select statements and everything is ok.
    public static void main(String[] args) {
    Connection conn = null;
    //retrieve Connection
    try{
    String connStr = "jdbc:oracle:thin:@localhost:1521:DBTEN";
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    }catch(ClassNotFoundException cnf){
    System.out.println( "CNFException: "+cnf.getMessage() );
    conn = DriverManager.getConnection( connStr, "scott", "tiger" );
    }catch( SQLException sqle ){
    System.out.println( "SQLException:"+sqle.getMessage() );
    Does anyone have an idea what the problem is in this case?
    Regards,
    Lars

    "Note: The use of the DriverManager class to establish a connection to a database is deprecated." --
    http://download-uk.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25320/getconn.htm
    To open a connection use something like this:
    OracleDataSource ods = new OracleDataSource();
    ods.setUser("username");
    ods.setPassword("password");
    ods.setURL("jdbc:oracle:thin:@localhost:1521:XE");
    ods.getConnection();
    Instead of this:
    Class.forName("oracle.jdbc.OracleDriver");
    DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "username", "password");

  • Import, package, connection

    Here's my problem. This a second forum, first one; no answer.
    I think here are all the necessary information, codes are quite long...
    I have 3 servlets, S1, S2, S3. and a java class Data.
    All these servlets, classes and build.xml are in a same folder ( WEB-INF/src/
    Compiler says that S1 and S2 are ok, but S3; there are 4 errors.
    And when I try ( S2 works fine ) to open url S3 a web browser says;
    The requested resource.... is not available.
    S1
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public abstract class S1 extends HttpServlet {
    public void doGet(HttpServletRequest req,
    HttpServletResponse resp)
    throws IOException, ServletException
    Connection db = null;
    and so on...
    protected abstract void execute(HttpServletRequest req,
    PrintWriter out,
    Connection db) throws Exception;
    S2
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class S2 extends S1 {
    public void execute(HttpServletRequest req,
    PrintWriter out,
    Connection db) throws Exception
    Connection con = null;
    and so on...
    S3
    // I believe the problem is JUST in S3. I think that S1 and S2 are ok.
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class S3 extends S1 {        // THIS  MUST EXTEND S1
    public void execute(HttpServletRequest req, PrintWriter out, Connection db) throws Exception {}
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {}
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    and so on...
    Compiler says 4 errors;
    S3.java:15: cannot find symbol
    [javac] symbol: class S1
    [javac] public class S3 extends S1 {
    [javac] ^
    S3.java:64: cannot find symbol
    [javac] symbol : variable db
    [javac] location: class S2.S3
    [javac] db = Data.getConnection();
    [javac] ^
    S3.java:64: cannot find symbol
    [javac] symbol : variable Data
    [javac] location: class S2.S3
    [javac] db = Data.getConnection();
    ^
    S3.java:65: cannot find symbol
    [javac] symbol : variable db
    [javac] location: class S2.S3
    [javac] Statement stmt6 = db.createStatement();
    [javac] ^
    [javac] 4 errors
    And I have a class Data and method getConnection is in it;
    import java.sql.*;
    public class Data {
    public static Connection getConnection() throws Exception {
    Please, help. Can someone solve this? Why S3 can't find S1 and its symbols??

    Please use 'New to Java' forum for compilation errors. This is unrelated to servlets.

  • Connection problem to 10.1.2 OC4J mbeanserver

    Hi All -
    I am trying to connect to OC4J mbean server in OAS 10.1.2. I found the reqd code in the oracle docs.
    //Import the JSR-160 classes and interfaces from jmx_remote_api.jar
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.util.Hashtable;
    import java.util.Iterator;
    import java.util.Set;
    import javax.naming.Context;
    import javax.management.MBeanServerConnection;
    import javax.management.remote.JMXConnector;
    import javax.management.remote.JMXConnectorFactory;
    import javax.management.remote.JMXServiceURL;
    public class OC4j
    public static void main( String[] args )
    OC4j oc4j = new OC4j();
    oc4j.oc4jstat();
    private void oc4jstat(){
    String url="service:jmx:rmi:///opmn://localhost:6003/home/";
    JMXConnector jmxCon = null ;
    try {
    // Define the connection target
    JMXServiceURL serviceUrl = null;
    try
    serviceUrl = new JMXServiceURL(url);
    catch ( MalformedURLException e )
    // TODO Auto-generated catch block
    e.printStackTrace();
    // Use to pass environment properties to be used while
    // retrieving a connection
    Hashtable env= new Hashtable();
    // Define the provider root package
    env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
    "oracle.oc4j.admin.jmx.remote");
    Hashtable credentials= new Hashtable();
    // Connect using the oc4jadmin super-user administrator account
    credentials.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
    credentials.put(Context.PROVIDER_URL,url);
    credentials.put(Context.SECURITY_PRINCIPAL,"oc4jadmin");
    credentials.put(Context.SECURITY_CREDENTIALS,"password");
    //credentials.put("login","ias_admin");
    //credentials.put("password","ias_admin1");
    // Specify the login/password to use for the connection
    env.put(JMXConnector.CREDENTIALS, credentials);
    // env.put(JMXConnectorConstant.PROPRIETARY_MBEANSERVER_DOMAIN_NAME, "default");
    // Get an instance of the JMXConnector interface for OC4J's rmi protocol
    // User is not yet connected
    try
    jmxCon = JMXConnectorFactory.newJMXConnector(serviceUrl, env);
    catch ( IOException e )
    // TODO Auto-generated catch block
    e.printStackTrace();
    // Connect to the target OC4J instance defined in the JMXServiceURL
    try
    jmxCon.connect();
    catch ( IOException e )
    // TODO Auto-generated catch block
    e.getLocalizedMessage();
    // Retrieve the MBeanServerConnection instance that acts as a proxy
    // for the OC4J MBeanServer we are connecting to.
    MBeanServerConnection con = null;
    System.out.println("jmxcon :"+jmxCon);
    try
    con = jmxCon.getMBeanServerConnection();
    System.out.println("Connection Succeeded..");
    catch ( IOException e )
    System.out.println("Connection failed\n");
    e.printStackTrace();
    // Use the MBeanServerConnection instance to perform remote
    // operations on the OC4J MBeanServer. This call retrieves
    // all MBeans registered with the server.
    Set mbeans = null;
    try
    mbeans = con.queryNames(null, null);
    catch ( IOException e )
    e.printStackTrace();
    Iterator iter = mbeans.iterator();
    // Display each MBean's ObjectNameIterator iter= mbeans.iterator();
    while(iter.hasNext())
    System.out.println(iter.next().toString());
    // Important!!! Release the connection, ideally using a Finally block
    finally {
    if(jmxCon!=null)
    try
    jmxCon.close();
    catch ( IOException e )
    // TODO Auto-generated catch block
    e.printStackTrace();
    Since , i am using 10.1.2 i am not able to use the jar file adminclient.jar whic is required for oracle.oc4j.admin.jmx.remote.api.JMXConnectorConstant class.
    Hence i used this way of connecting.
    I also tried out this way :
    //credentials.put("login","ias_admin");
    //credentials.put("password","ias_admin1");
    But i am not able to get any connection either way to the oc4j instance.
    This is the error that i am getting:
    java.io.IOException: Not connected
    jmxcon :javax.management.remote.rmi.RMIConnector: jmxServiceURL=service:jmx:rmi:///opmn://localhost:6003/home/OC4J_BPEL
    Connection failed
         at javax.management.remote.rmi.RMIConnector.getMBeanServerConnection(RMIConnector.java:353)
         at javax.management.remote.rmi.RMIConnector.getMBeanServerConnection(RMIConnector.java:337)
         at OC4j.oc4jstat(OC4j.java:102)
         at OC4j.main(OC4j.java:24)
    Exception in thread "main" java.lang.NullPointerException
         at OC4j.oc4jstat(OC4j.java:117)
         at OC4j.main(OC4j.java:24)
    Am i missing something here ?
    Thanks
    Ajay

    jgrocock,
    even though Jdev 1013 is production, BPEL PM 10.1.3 is not yet production, and so is the BPEL Designer for JDev - this is the reason for little issues like this here .. I would recommend (as you are writing a label, looks like you work for ORacle) to go ahead and file a bug that we can ensure in the QA cycle it's fixed..
    thx clemens

  • FTPS connection

    Hello Community,
    I have created a certificate to use ftps with proftp and with a ftps-client (curl).
    Instead of using curl I want to write my own ftpsclient.
    The Problem is, I got an handshake exception after 1 minute.
    I hope you can help me out.
    Here is my code:
    public void connect(String address, int port) throws SocketException, IOException
              super.connect(address, port);
              this.secure();
    public void secure() throws IOException
    this.sendCommand("AUTH", "TLS");
              SSLSocket socket = (SSLSocket)
    this.context.getSocketFactory().createSocket(this._socket_,
    this.getRemoteAddress().getHostAddress(), this.getRemotePort(), true);
              System.out.println("SSLSocket created");
              try{
    socket.startHandshake(); // * Error HandshakeException *//
    System.out.println("HANDSHAKE DONE");
    catch(Exception ex){
    ex.printStackTrace();
              this._socket_ = socket;
              this._controlInput = new BufferedReader(new
    InputStreamReader(socket.getInputStream(), getControlEncoding()));
              this._controlOutput = new BufferedWriter(new
    OutputStreamWriter(socket.getOutputStream(), getControlEncoding()));
              this.setSocketFactory(new FtpsSocketFactory(this.context));
              this.sendCommand("PBSZ", "0");
              this.sendCommand("PROT", "P");
    }

    OK i solved this. The problem was proftp. So I rewrited the code.
    But now I get a Unrecognized SSL message, plaintext connection? error message.
    I dont know how to solve this, yet.
    Thanks
    Olaf

  • SOAP Connection

    I tried to establish a SOAP connection using the SOAP connection tutorial and got the same connection problems posted by others on this forum - i.e.
    Testing connection...
    [SOAPException: faultCode=SOAP-ENV:IOException; msg=Connection refused: connect; targetException=java.net.ConnectException: Connection refused: connect]
    void org.apache.soap.SOAPException.<init>(java.lang.String, java.lang.String, java.lang.Throwable)
    void oracle.soap.transport.http.OracleSOAPHTTPConnection.send(java.net.URL, java.lang.String, java.util.Hashtable, org.apache.soap.Envelope, org.apache.soap.encoding.SOAPMappingRegistry, org.apache.soap.rpc.SOAPContext)
    org.apache.soap.rpc.Response org.apache.soap.rpc.Call.invoke(java.net.URL, java.lang.String)
    org.apache.soap.rpc.Response oracle.jdevimpl.webservices.util.JDevServiceManager.invokeMethod(java.lang.String, org.apache.soap.rpc.Parameter)
    java.lang.String[] oracle.jdevimpl.webservices.util.JDevServiceManager.list()
    void oracle.jdevimpl.webservices.wizard.connection.TestConnectionPanel$2.run()
    Unable to connect to SOAPServerConnection1 (http://127.0.0.1/soap/servlet/soaprouter) Connection test failed: unable to connect.
    I have tried the connection using localhost,127.0.0.1, my host name (both name and net id, with the port as 8888 and 8988, and all combinations of these hosts/ports in both Netscape and IE. I have unchecked proxy server in both places suggested by other posts on this forum, and I did not put a user name or password in the SOAP connection wizard (although I did try it with the admin PW entered once). I also tried putting a ? mark in at the end of the URL (suggested by one of the SOAP Connection Problem answers).
    I then changed the port number in default-web-site.xml from 0 to 8888, reinstalled the OC4J server, restarted it, and this didn't work, in any of the URL variations mentioned above.
    Any ideas on how to make this connection work would be much appreciated.

    Hi, I'm new on the topic :(
    I want to use the native SOAP implementation that is in 9iAS release 2, do I have to set something or make a 9iAS post-installation task for get it?, maybe installing a patch?
    If I want to use the 9iAS native SOAP, do I have to deploy the soap servlet explicitily?, and if I don't, what is the SOAP Servlet URL that I have to write on the SOAP Server Connection Wizard of Jdeveloper 9.0.3? I've tryied with the Apache SOAP (deploying the soap servlet) and then I've tryied with the soap servlet page with success (http://<ip>:<port>/soap/servlet/soaprouter), but when I try to create a SOAP connection from JDeveloper on this installation, the Test Connection fails too. The message that is displayed:
    "Testing connection...
    Not using Proxy Server (my comment: that's true, because I have the DB and the 9iAS installation on the JDeveloper cliente machine)
    java.lang.Exception
    org.apache.soap.rpc.Response oracle.jdevimpl.webservices.util.JDevServiceManager.invokeMethod...
    JDevServiceManager.java:255
    Unable to connect to SOAPServerConnection1 (http://<ip>:<port>/soap/servlet/soaprouter)
    Connection test failed: unable to connect.
    I've a similar problem, have I?
    Could anybody give me an advice?
    Thanks a lot in advance.
    Pablo Ibarra.

  • Io exception when attempt to connect to servlet

    java.io.IOException: Persistent connection dropped after first chunk sent, cannot retryback from buy
    There was no stack or trace of the exception.
    I try to post some stuff to the servlet to retrieve information. Sometime it works just well but sometimes it doesnt work at all and just give me the above Exception.
    Could anyone help me please!

    can you show us some code...

  • Jdbc derby connectivity

    Hi I m new to java database connectivity part.
    I have written one program to connect with Derby database but whenever i execute the program i get following error:
    What could be the problem
    C:\Documents and Settings\milindk\Desktop>java TestDB
    java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/
    fmgdb;user=fmguser;password=fmguser
            at java.sql.DriverManager.getConnection(Unknown Source)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at TestDB.runTest(TestDB.java:28)
            at TestDB.main(TestDB.java:12)Source Code is as below
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    class TestDB
    public static void main(String args[])
    try
    runTest();
    catch (SQLException ex)
    for (Throwable t : ex)
    t.printStackTrace();
    catch (IOException ex)
    ex.printStackTrace();
    public static void runTest() throws SQLException, IOException
    Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/fmgdb;user=fmguser;password=fmguser");
    try
    Statement stat = conn.createStatement();
    stat.executeUpdate("CREATE TABLE Greetings (Message CHAR(20))");
    stat.executeUpdate("INSERT INTO Greetings VALUES ('Hello, World!')");
    ResultSet result = stat.executeQuery("SELECT * FROM Greetings");
    if (result.next())
    System.out.println(result.getString(1));
    result.close();
    stat.executeUpdate("DROP TABLE Greetings");
    finally
    conn.close();
    }

    I have modified my souce code accordingly
    but still i m getting following error.
    C:\>java TestDB
    java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
            at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:169)
            at TestDB.runTest(TestDB.java:33)
            at TestDB.main(TestDB.java:12)Source Code
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    class TestDB
    public static void main(String args[])
    try
    runTest();
    catch (SQLException ex)
    for (Throwable t : ex)
    t.printStackTrace();
    catch (IOException ex)
    ex.printStackTrace();
    catch (ClassNotFoundException ex)
    ex.printStackTrace();
    public static void runTest() throws SQLException, IOException,ClassNotFoundException
    //Connection conn = getConnection();
    Class.forName("org.apache.derby.jdbc.ClientDriver");
    Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/fmgdb;user=fmguser;password=fmguser");
    try
    Statement stat = conn.createStatement();
    System.out.println("Creating a table");
    stat.executeUpdate("CREATE TABLE Greetings (Message CHAR(20))");
    stat.executeUpdate("INSERT INTO Greetings VALUES ('Hello, World!')");
    ResultSet result = stat.executeQuery("SELECT * FROM Greetings");
    if (result.next())
    System.out.println(result.getString(1));
    result.close();
    stat.executeUpdate("DROP TABLE Greetings");
    finally
    conn.close();
    /*public static Connection getConnection() throws SQLException, IOException
    Properties props = new Properties();
    FileInputStream in = new FileInputStream("database.properties");
    props.load(in);
    in.close();
    String drivers = props.getProperty("jdbc.drivers");
    if (drivers != null) System.setProperty("jdbc.drivers", drivers);
    String url = props.getProperty("jdbc.url");
    String username = props.getProperty("jdbc.username");
    String password = props.getProperty("jdbc.password");
    return DriverManager.getConnection(url, username, password);
    }

  • How to display gauge progress refer to HTTP connection time taken

    Hi,
    I would like to know how can I display the gauge progress depend on the HTTP connection time taken.
    I have the source code below but it can't show the gauge progress parallel to the HTTP connection working.
    That's kind of those who solve me this problem.
    Source code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.io.*;
    import javax.microedition.io.*;
    import java.util.*;
    public class HttpExample extends MIDlet implements CommandListener
         private Gauge gauge;
         private Command exit, start;
         private Display display;
         private Form form;
         long AUD, CAN;
         public HttpExample()
              display = Display.getDisplay(this);
              exit = new Command("Exit", Command.EXIT, 1);
              start = new Command("Start", Command.EXIT, 1);
              form = new Form("");
              gauge = new Gauge("Updating Currency Rate", false, 100, 0);
              form.append(gauge);
              form.addCommand(exit);
              form.addCommand(start);
              form.setCommandListener(this);
              display.setCurrent(form);
         public void startApp() throws MIDletStateChangeException
              display.setCurrent(form);
         public void pauseApp()
         public void destroyApp(boolean unconditional)
         public void commandAction(Command command, Displayable displayable)
              if (command==exit)
                   destroyApp(false);
                   notifyDestroyed();
              else if(command==start)
                   Updater updater = new Updater(this);
                   updater.start();
         class Updater implements Runnable
         private HttpExample MIDlet;
         public Updater(HttpExample MIDlet)
              this.MIDlet=MIDlet;
         public void run()
              try
                   transmit();
              catch (Exception error)
                   System.err.println(error.toString());
         public void start()
              Thread thread = new Thread(this);
              try
                   thread.start();
              catch (Exception error)
         private void transmit() throws IOException
              StreamConnection connection=null;
              InputStream in= null;
              StringBuffer buffer=new StringBuffer();
              try
                   connection=(StreamConnection) Connector.open("http://www.geocities.com/cyfan118/index.html");
                   in=connection.openInputStream();
                   int ch;
                   while ((ch=in.read())!=-1)
                        gauge.setValue(gauge.getValue() + 1);
                        buffer.append((char)ch);
                   String line=new String(buffer.toString());
                   int p=line.indexOf("AUD");
                   int p1=line.indexOf("CAN");
                   String a=line.substring(p+4,p+7);
                   String b=line.substring(p1+4,p1+7);
                   AUD=Long.parseLong(a);
                   CAN=Long.parseLong(b);
                   buffer=new StringBuffer();
              catch (IOException error)
                   Alert alert=new Alert("Error","Cannot connect",null,null);
                   alert.setTimeout(Alert.FOREVER);
                   alert.setType(AlertType.ERROR);
                   display.setCurrent(alert);
    }

    This code looks like it should work to update the progress during the connection but it is not going to start updating the guage until it has made the connection and is downloading data. If you want to show something on the screen during the time the program is doing Connector.open() you are going to need to have the update code in yet another thread or timer.

Maybe you are looking for

  • My ipod touch 1st generation doesnt turn on

    I have an iPod touch 8gb 1st generation. i attempt to turn it on, but it just turns of by itself. i have charged it by the computer and the wall outlet.

  • Powershell import-spweb fails with "parent does not exist" error.

    So, I have a sp 2010 site at http://myfarm/sites/it/d22 and I want to copy the contents to http://myfarm/sites/bb/d62 . I perform Export-SPWeb -Identity  http://myfarm/sites/it/d22  -Path d:\temp\d22  -IncludeUserSecurity –IncludeVersions All  -NoFil

  • How to know the Function Module of a standard datasource?

    Hi All, As per my understanding there will be an underlying Function Module for each SAP BI datasource. But I dont know how to know the name of that  Function Module for a particular datasource.Could anybody pls help me as i am need of this urgently.

  • On announcing my site (1st time), iWeb encounters an error

    On trying to announce my site (1st time), iWeb encounters an error while trying to locate my default email program. Can anyone explain, please? Any advice very gratefully accepted. annfromvic

  • Macbook Pro w/ Retina

    I'm a professional photogrpher and technologist who has long been a PC user.  After the recent release of the latest Macbook Pro with Retina display I am considering purchasing one along with a new Cinema Display. The native resolution for the new Ma