InitialDirContext Throwing ServiceUnavailableException socket closed

Any assistance is appreciated.
Problems occurring when multiple DirContext instances are created. Attempting to make a SSL connection to Active Directory on port 636. A single successful context can be established in the below code. However, a second instantiation of InitialDirContext(env) results in a javax.naming.ServiceUnavailableException: [domain]:636; socket closed error. Multiple contexts are desired to establish a connection pool.
A few items to note. Establishing four unsecure DirContext on port 389 works successfully. I can establish a DirContext on port 636, use the context, close the context then establish new contexts without a problem. A server certificate was imported to the C:\j2sdk1.4.2_11\jre\lib\security\cacerts file. Testing on a local computer. Below is sample code:
public static void main(String[] args) {
    try {
        System.setProperty("javax.net.debug","all");
        // Set up the environment for creating the initial context
        Hashtable env = new Hashtable();
         env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.SECURITY_PRINCIPAL, "[USER DN]");
        env.put(Context.SECURITY_CREDENTIALS, "[PWD]");
        //NON SSL
        //env.put(Context.PROVIDER_URL, "ldap://[server]:389");
        //SSL
        env.put(Context.PROVIDER_URL, "ldap://[server]:636");
        env.put(Context.SECURITY_PROTOCOL, "ssl");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        // Create the initial context
        DirContext ctx = null;
        DirContext ctx2 = null;
        DirContext ctx3 = null;
        DirContext ctx4 = null;
        try {
            //Works every time...
            ctx = new InitialDirContext(env);
        } catch (NamingException e) {
            e.printStackTrace();
        try {
        //Fails on port 636, works on port 389
        ctx2 = new InitialDirContext(env);
        } catch (NamingException e) {
            e.printStackTrace(); 
        try {
        //Works on port 636 (after 2nd attempt fails) and port 389
        ctx3 = new InitialDirContext(env);
        } catch (NamingException e) {
            e.printStackTrace();
        try {
        //Fails on port 636, works on port 389
        ctx4 = new InitialDirContext(env);
        } catch (NamingException e) {
            e.printStackTrace();
        Attributes attrs = ctx.getAttributes("[A USER DN]");
        System.out.println("Total attributes returned: " + attrs.size());
        try {
            ctx.close();
            ctx2.close();
            ctx3.close();
            ctx4.close();
        } catch (NamingException e) {
            e.printStackTrace();
    } catch (Exception ex) {
        ex.printStackTrace();
    System.exit(0);
}The java debug statements at the second exception:
Thread-1, WRITE: TLSv1 Handshake, length = 121
Thread-1, received EOFException: ignored
Thread-1, called closeInternal(false)
Thread-1, SEND TLSv1 ALERT:  warning, description = close_notify
Plaintext before ENCRYPTION:  len = 18
0000: 01 00 0F 78 84 EE 16 24   F6 99 B0 83 52 14 FF 86  ...x...$....R...
0010: 29 3C                                              )<
Thread-1, WRITE: TLSv1 Alert, length = 18
Thread-1, called close()
Thread-1, called closeInternal(true)Again, any assistance is appreciated.

Multiple contexts are desired to establish a connection pool.The JNDI LDAP provider already does connection pooling so you don't need multiple initial contexts at all.

Similar Messages

  • New root certificates cause socket closed error

    We have planning 9.3.1 services with ldap authentication. When we replaced our root certificates in dev we began getting errors. Mostly everything works, but after some inactivity a good log in will be flagged as an invalid user and throw the following exceptions:
    2010-03-29 07:43:48,141 [[ORB=_it_orb_id_1,Pool=1]::id-3] WARN com.hyperion.css.spi.impl.ldap.LDAPProvider.authenticate(Unknown Source) - javax.naming.ServiceUnavailableException: ldaps.lirr.org:636; socket closed; remaining name ''
    2010-03-29 07:43:48,141 [[ORB=_it_orb_id_1,Pool=1]::id-3] WARN com.hyperion.css.CSSAPIImpl.authenticate(Unknown Source) - com.hyperion.css.CSSAuthenticationException: Failed to authenticate user tlbarat against provider Novel1     Error Code: 2
    NestedException:
    javax.naming.ServiceUnavailableException: ldaps.lirr.org:636; socket closed; remaining name ''
    Does anyone know what we could be doing wrong? We changed to a load balanced virtual server. Could this have caused our issue? We tried setting java option -Dsun.net.inetaddr.ttl=0 but it didn't work. We need to move the change to prod next week. Any insight would be appreciated.

    The socket is being closed by the receiver, since it feels that the end of HTTP body stream has been reached. This could happen due to a number of reasons and cannot be directly discerened from your code.
    Does changing the buffer size help?
    Ironluca

  • Remote desktop connection manager on windows 8.1, can't connect to windows server 2012 R2, Socket closed

    remote desktop connection manager on windows 8.1, can't connect to windows server 2012 R2, Socket closed each time i try to open remote connection to the server,
    does remote desktop connection manager V2.2 not compatible with windows 8.1, and if so, is there are any other compatible versions
    or what's the problem,
    Mahmoud Sabry IT System Engineer

    this issue maybe will be fix by latest version, we still waiting for it
    maybe your issue can be fix using this methods
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/61f218a5-5ef8-49da-a035-90cdd64fc9a0/problem-with-remote-desktop-connection-manager-error-3334?forum=winserverTS
    http://shawn.meunier.com/?p=1#comment-43

  • JCOM on WLS 8.1 - SocketException: Socket closed

    After creating my application and accessing it - if I don't use it for a while
    I get the following exception when I access it. Other than creating a timer to
    ping it every 10 seconds or so - is there some way to keep the socket open?
    - Mike Reiche
    java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:124)
    at com.linar.jintegra.RpcConnectionHandler.send(RpcConnectionHandler.java:272)
    at com.linar.jintegra.Rpc.invoke(Rpc.java:239)
    at com.linar.jintegra.RemObjectExporter.invoke(RemObjectExporter.java:346)
    at com.linar.jintegra.StdObjRef.invoke(StdObjRef.java:57)
    at com.linar.jintegra.Dispatch.vtblInvoke(Dispatch.java:763)
    at excel._ApplicationProxy.getDefaultFilePath(_ApplicationProxy.java:1938)
    at excel.Application.getDefaultFilePath(Application.java:2237)

    Has anyone gotten an answer on this error? I also get a Socket Closed IOException
    after a couple of minutes of not communicating to a remote DCOM application.
    I also have to restart Weblogic to get it to communicate again. Works great as
    long as I make a request every 10 or 20 seconds.
    Rick Holland
    >
    I am having this exact same problem. I have a support case opened with
    BEA about
    it, and will let you know if I come up with a solution...
    In my case, however, I am gonna have a very hard time sending BEA a repeatable
    testcase that demonstrates this problem, as I access a DCOM app that
    I cant redistribute.
    Would your code be something that you can share with BEA? If so, that
    would be
    of tremendous help.
    "Mike Reiche" <mreiche@no_spam.com> wrote:
    After creating my application and accessing it - if I don't use it for
    a while
    I get the following exception when I access it. Other than creating
    a timer to
    ping it every 10 seconds or so - is there some way to keep the socket
    open?
    - Mike Reiche
    java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:124)
    at com.linar.jintegra.RpcConnectionHandler.send(RpcConnectionHandler.java:272)
    at com.linar.jintegra.Rpc.invoke(Rpc.java:239)
    at com.linar.jintegra.RemObjectExporter.invoke(RemObjectExporter.java:346)
    at com.linar.jintegra.StdObjRef.invoke(StdObjRef.java:57)
    at com.linar.jintegra.Dispatch.vtblInvoke(Dispatch.java:763)
    at excel._ApplicationProxy.getDefaultFilePath(_ApplicationProxy.java:1938)
    at excel.Application.getDefaultFilePath(Application.java:2237)

  • Error on content write: Socket closed

    Since a week or so we are getting the following stack trace on our WebCenter Portal (11.1.1.6.3). There are several content presenters on it, and so far I've not found out yet where the problem originates from. Has anyone experienced the same, or perhaps any pointers?
    <Aug 24, 2012 3:10:13 PM CEST> <Error> <oracle.webcenter.content.internal.http.HttpServiceImpl> <WCS-11001> <Error on content write: Socket closed
    oracle.webcenter.content.internal.http.InternalServerErrorException: Aug 24, 2012 3:10:13 PM oracle.webcenter.content.internal.http.HttpServiceExceptionFactory getException
    ALL: Error on content write: Socket closed
    at oracle.webcenter.content.internal.http.HttpServiceExceptionFactory.getException(HttpServiceExceptionFactory.java:191)
    at oracle.webcenter.content.internal.http.HttpServiceExceptionFactory.createInternalServerError(HttpServiceExceptionFactory.java:707)
    at oracle.webcenter.content.internal.http.HttpServiceExceptionFactory.createInternalServerError(HttpServiceExceptionFactory.java:685)
    at oracle.webcenter.content.internal.http.HttpServiceExceptionFactory.createInternalServerError(HttpServiceExceptionFactory.java:664)
    at oracle.webcenter.content.internal.http.Entity.sendResponse(Entity.java:205)
    at oracle.webcenter.content.internal.http.HttpServiceImpl.doGetOrHead(HttpServiceImpl.java:322)
    at oracle.webcenter.content.internal.http.HttpServiceImpl.service(HttpServiceImpl.java:179)
    at oracle.webcenter.content.http.GetHandlerServlet.service(GetHandlerServlet.java:225)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:62)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.wcps.client.PersonalizationFilter.doFilter(PersonalizationFilter.java:75)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.webcenter.content.integration.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:168)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:62)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    >

    We have a content presenter which loads a video file from the content server. It looks like the socket is unexpectedly closed at some point if the video is paused or stopped for some reason.

  • JDBC Adaper "socket closed"

    Hello All,
      We are trying to update a database table in Oracle through SAP XI.
      Our scenario is IDOC to JDBC.
      We are facing a problem during the JDBC connectivity between XI and Oracle.
      <b>In adapter monitoring the error saying that Java.sql.SQLException: IO Exception: "socket closed".</b>
    We are using XI 3.0 with Oracle 9.2 and at the other end the Database system(where the updation is to be done) is based on Oracle 8.1
    The above process works when we try to update the database table (created on Oracle 8i) throgh JAVA Application.
    <b>When this updation occurs throgh XI it fails!!</b>
    Thanks in Adv.
    Rajesh Yallabandi

    Good day Yallabandi,
    Can other SQL statment works?
    <u>If not then:</u>
    Please check that you supplied the JDBC adapter with the right and most updated matching JDB\CODBC driver for your destination database.
    You also need to load the right jars to your Adapter framwork using the SDM tool.
    Follow the "How To Install and configure JDBC" guide
    supplied by SAP (get it on the service market place).
    Good luck.
    Nimrod Gisis
    Message was edited by: Nimrod Gisis

  • Socket closed exception

    Hi all,
    I am trying to execute an XI scenario in which i am sending data from sap R/3 system to a table in Oracle 8.0 system using JDBC adapter.
    The XI server has JDBC 9.0 driver.
    On sending the message, status shown on the XI server is successful, but no data is getting posted in the table.
    In XI runtime workbench, in component monitoring, the error shown with the JDBC driver is SOCKET CLOSED.
    Pls if anybody can help me with this problem.
    Its very urgent.
    Thanks in advance.
    Regards
    Neetu

    Hi,
    The error shown in the Adapter Monitor in Runtime Workbench is:
    Receiver Adapter v1027 for Party '', Service 'HURES':
    Configured at 16:35:07 2006-05-12
    Last message processing started 15:16:02 2006-05-13, Error: Transform error in xml processor class, rollback:
    ERROR:Processing request: Error when executing statement for table/stored proc. 'sap_promotion': java.sql.SQLException: Io exception: Socket closed
         at com.sap.aii.adapter.jdbc.xml2sql.service(xml2sql.java:175)
         at com.sap.aii.adapter.jdbc.XI2JDBC.onInternalMessage(XI2JDBC.java:266)
         at com.sap.aii.adapter.jdbc.SapAdapterServiceFrameImpl.callSapAdapter_i(SapAdapterServiceFrameImpl.java:170)
         at com.sap.aii.adapter.jdbc.SapAdapterServiceFrameImpl.callSapAdapter(SapAdapterServiceFrameImpl.java:146)
         at com.sap.aii.af.modules.CallAdapterWithMessageBean.process_receiver(CallAdapterWithMessageBean.java:206)
         at com.sap.aii.af.modules.CallAdapterWithMessageBean.process(CallAdapterWithMessageBean.java:161)
         at com.sap.aii.af.mp.module.ModuleLocalLocalObjectImpl1.process(ModuleLocalLocalObjectImpl1.java:103)
         at com.sap.aii.af.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:221)
         at com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0.process(ModuleProcessorLocalLocalObjectImpl0.java:103)
         at com.sap.aii.af.listener.AFWListenerBean.onMessage(AFWListenerBean.java:216)
         at com.sap.aii.af.listener.AFWListenerLocalObjectImpl0.onMessage(AFWListenerLocalObjectImpl0.java:103)
         at com.sap.aii.af.ra.ms.impl.ServicesImpl.deliver(ServicesImpl.java:262)
         at com.sap.aii.adapter.xi.ms.XIEventHandler.onDeliver(XIEventHandler.java:611)
         at com.sap.aii.af.ra.ms.impl.core.queue.ReceiveConsumer.invokeHandler(ReceiveConsumer.java:353)
         at com.sap.aii.af.ra.ms.impl.core.queue.ReceiveConsumer.onMessage(ReceiveConsumer.java:98)
         at com.sap.aii.af.ra.ms.impl.core.queue.Queue.run(Queue.java:419)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Regards
    Neetu

  • JSSE causes OSB business services to receive Socket Closed

    Using WL 10.3.3 & OSB 11gR1 on jrockit 1.6.0_45  Redhat:
    After enabling the "Use JSSE SSL" option in the managed servers's SSL tab ( because web service clients want to use SHA256 certificates ), OSB business services ( outbound to service providers ) fail with
    Exception - Body: <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Fault xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>BEA-380000</faultcode>
    <faultstring>General runtime error: socket closed</faultstring>
    After a lot of debugging, I've found that the Connection Timeout option within the OSB HTTP transport is involved.
    OSB business services which use https AND have a non-zero value for HTTP transport's Connection timeout cause the Socket Closed error.
    Business services which do not use HTTPS or do not have a Connection Timeout do not receive the error.
    While setting the Connection Timeout to 0 allows the transaction to succeed, that leaves the OSB server vulnerable when the service provider host is not available.
    So I've reset the Connection Timeout values to 0, and added this JVM parameter to each OSB managed server
    -Dweblogic.http.client.defaultConnectTimeout=5000

    There are few BUGs reported for similar issues.
    OSB Server Showing "java.io.IOException: SSLEngine is closed" When Attempting to Connect to an External Web Service Using Two-Way SSL (Doc ID 1465618.1)

  • Socket Closed error please help us finding a fix for the same

    Hi everyone,
    I have a web application deployed on Weblogic 10.3.4.0. In the application there is hyperlink to download a resouce (say an PDF document). Upon clicking the link, IE shows the Open/Save/Cancel dialog box. If the Open/Save/Cancel dialog box is not acted upon by the user within 1 min after it pops up, Weblogic is closing the socket. This causes IE to only download a part of the file say 784 KB or something. Whereas the entire file maybe 1MB in size. Please help in fixing this issue ASAP.
    Thanks in Advance
    java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
    at weblogic.servlet.internal.ChunkOutput.writeChunkTransfer(ChunkOutput.java:525)
    at weblogic.servlet.internal.ChunkOutput.writeChunks(ChunkOutput.java:504)
    at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:382)
    at weblogic.servlet.internal.CharsetChunkOutput.flush(CharsetChunkOutput.java:249)
    at weblogic.servlet.internal.ChunkOutput.checkForFlush(ChunkOutput.java:469)
    at weblogic.servlet.internal.CharsetChunkOutput.implWrite(CharsetChunkOutput.java:396)
    at weblogic.servlet.internal.CharsetChunkOutput.write(CharsetChunkOutput.java:198)
    at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:139)
    at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:169)
    at com.teja.systemi.util.AroundData.copyStream(AroundData.java:311)
    at com.teja.systemi.client.servlet.servant.Newdownloadsingle.producePageData(Newdownloadsingle.java:108)
    at com.teja.systemi.client.servlet.servant.BaseViewController.serve(BaseViewController.java:542)
    at com.teja.systemi.client.servlet.FrontController.doRequest(FrontController.java:226)
    at com.teja.systemi.client.servlet.FrontController.doPost(FrontController.java:128)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Edited by: 910597 on Jan 27, 2012 2:15 AM

    What do you mean by "moo" ?
    Huh? You don't know about the moo? Are you livin' in a barn or sumthin'
    Sorry, corny joke.
    Seriously--if you haven't heard about the moo, then check out the MacBook forums. Nearly every third or fourth post is about the mooing problem.
    My own MacBook moos, but it's not so bad that it makes me upset. I understand, though, that others have it much worse.
    Black Macbook; Mini 1.5GHz (Late 2005); Mini 1.4GHz; PB G4 1GHz; PB Lombard; PB 2400; PMac G3; Blueberry iMac; iPod nano 4GB; and a talking Bill King bobblehead doll--Holy Toledo!

  • SQLException: Io exception: socket closed: Bad file number;

    Hi,
    My server application connects oracle 8i using thin driver.
    My code opens a connection and create a statement object:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection connection = DriverManager.getConnection(url, username, password);
    connection.setAutoCommit(false);
    Statement statement = connection.createStatement();
    After a few hours it runs just fine I get the following error:
    java.sql.SQLException: Io exception: socket closed: Bad file number;
    The code line that couses this exception is:
    statement.executeQuery("my SQL query");
    after this there are more errors:
    ;java.sql.SQLException: Protocol violation;
    (in code line: connection.execCommit())
    and than a repeated exception of :
    java.sql.SQLException: Io exception: Broken pipe;
    Does anyone knows a solution? (is the problem in my code or in the oracle account?)
    Thank!!!

    Which package you are using? if you don't have
    classes12.zip, try again by including that package in
    the classpath. If you are already using classes12.zip
    then try by including nls_charset12.zip in the
    classpath.
    You can get these packages in Oracle (otn) website.
    SudhaThanks!
    I had classes12.zip in my classpath, but my classpath also had: classes111.zip
    so i removed classes111.zip from the classpath and as far as now,
    the problem did not occur again!
    (i also added nls_charset12.zip just to be sure)
    Lilach

  • Socket Closing  in java

    I have a Java program to communicate with the server and when i click the close button in my program i get disconnected from the server .
    But i have to do the same thing when i click the close button in the server......
    I dont have the server code. how do i do that in my client code.....
    With regards,
    Freedom

    this �s the piece of code for closing the socket in my program
    public void CloseConnection()throws SocketException,IOException
              try
         //flush and close both "Instream" and "Outstream"
         bos.close();
         bis.close();
         instream.close();
         outstream.close();
         catch (IOException ex)
              ex.printStackTrace();
              tcpipSocket.close();
    }

  • Socket closing before server can readObject()

    I am trying to create a multi-threaded client server application that transmits objects. At the moment, I am having a hard time getting the sockets to coincide.
    I start my server and wait for a connection:
    ServerSocket ss = new ServerSocket(port_num);
    Socket s = ss.accept();Then I create a new socket in the client to connect to the server:
    Socket cs = new Socket("localhost", 8888);When the server class gets the connection, it creates a thread with the socket:
    new DrawThread(s);The thread constructor creates an Input stream:
    ois = new ObjectInputStream(sock.getInputStream());After the client creates the connection, it creates and ObjectOutputStream and writes my object:
    oos = new ObjectOutputStream(cs.getOutputStream());
    oos.writeObject(objects.get(0).getShape());Meanwhile in the run() method of the thread, we try to read it:
    ois.readObject();However at this point I get an IOException because the client function was done and had exited so the socket was closed.
    Any Idea what I can do to combat this problem? Full code for my client function, server and thread classes are below.
    Client function:
       public void serverSave(){
            Date d = new Date();
            try{
            //initialize class network and IO vars
            Socket cs = new Socket("localhost", 8888);//create server
            oos = new ObjectOutputStream(cs.getOutputStream());
             //write the objects to the server
               // for(int i = 0; i< objects.size(); i++){
                     oos.writeObject(objects.get(0).getShape());
                //}//end for
           catch (UnknownHostException uhe){System.out.println("client uhe");System.out.println(uhe.getMessage());}
         catch(IOException ioe){System.out.println("client ioe");System.out.println(ioe.getMessage());}
         finally{
                    //print out time to see when the function exits
              System.out.println(d.getTime());
       }Server Class:
    import java.io.*;
    import java.net.*;
    class DrawServer{
         static int port_num = 8888;//default port number
         public void DrawServer(){}
         public static void main(String args[])throws IOException{
              //don't forget to close socket
              ServerSocket ss = new ServerSocket(port_num);
              while(true){
                   System.out.println("begin listening");
                   //blocking wait for a connection
                   Socket s = ss.accept();
                   //create new thread for the client
                   new DrawThread(s);
                   System.out.println("end listening");
                   s.close();
              }//end while
         }//end main
    }Thread Class
    import java.net.*;
    import java.net.Socket;
    import java.io.*;
    import java.util.*;
    class DrawThread extends Thread{
         private Socket sock;
         private ObjectInputStream ois = null;
            private ObjectOutputStream oos = null;
            ObjectOutputStream out = null;
            //create a file input stream or buffered stream to accept filename from client???
         public DrawThread(Socket s){
              sock = s;
              try{
              ois = new ObjectInputStream(sock.getInputStream());
                    oos = new ObjectOutputStream(sock.getOutputStream());
              start();
              catch( IOException ioe){}
         public void run(){
              Date d = new Date();
              System.out.println("Thread started");
              try{
              int i = 0;
              while(true){
                   System.out.println("getting item " + ++i);
                   ois.readObject();
              catch(FileNotFoundException fnfe){System.out.println("fnfe");}
              catch(IOException ioe){System.out.println("ioe     " + + d.getTime());System.out.println(ioe.getMessage());}
              catch(ClassNotFoundException cnfe){System.out.println("cnfe");}
              finally{
                   try{out.close();}
                   catch(IOException ioe2){System.out.println("ioe2");}
              System.out.println("Thread ending");
    }Thanks,
    Shannon

    You have one problem with your DrawServer class:               new DrawThread(s); // this starts a thread that uses the socket
                   System.out.println("end listening");
                   s.close(); // this will close the socket while it is used in the DrawThread thread.Instead close the socket in the finally block of the DrawThread run() method (no need to close the ObjectOutputStream in that block).
    Also since you are passing a variable number of objects between the client and the server
    you should create a custom made protocol for both your ends to always be in sync with each other.
    For instance the client could send first the number of objects to be sent,
    then loop for this exact number and send the objects,
    then upon receiving the server response close its socket.
    The server could read for the number of objects to read,
    then loop for the exact number and read the objects,
    then send a response and close its socket.

  • WebLogic Server 6.1 SP 3 DocumentBuilder throws IOException: Stream closed

    Hi,
              I have a question about XML processing and error handling, and how the
              WebLogic container affects things.
              Here's what happens to us. We have a servlet parsing XML using DOM.
              The servlet has an InputStream with the content. It gets the default
              DocumentBuilderFactory
              (weblogic.xml.jaxp.RegistryDocumentBuilderFactory) and makes it
              validating. It asks for a DocumentBuilder. It gives the builder our
              own custom error handler to collect up all the SAX parse errors. It
              then tells the builder to parse the input stream. We would expect
              that any problems with the content would be reported as an error to
              our error handler, so that we can then report the errors to the user
              as part of the servlet response.
              However, certain malformed XML content causes the WebLogic parser to
              issue several error messages to System.out and throw an IOException
              with the message "Stream closed". No errors are recorded in our error
              handler. This happens on a variety of inputs, which all revolve
              around the root element start tag being malformed or entirely missing.
              We get this behavior with a totally empty stream, with a stream that
              has the <?xml> and <!DOCTYPE> headers but nothing else, with a stream
              that has the headers and then a malformed start tag like
              "<Submit_Contracts a="1"b="2"/>". I think the programmer would expect
              any of these inputs to cause the parser to simply report a fatal error
              and stop. Throwing an IOException makes it look like it's an error in
              the underlying stream, and clearly it's not. (Most of the test code I
              used actually pulled the XML from a ByteArrayInputStream.)
              Shouldn't WebLogic's parser handle these inputs differently? Throwing
              an IOException can't be correct, can it? Should the application
              instead be responsible for checking that the input has a well-formed
              start tag? In that case the application is doing the parsing that we
              want to rely on the parser to do! Should the application instead
              catch IOExceptions from the parser and report them to the user as
              input errors? In that case the application can potentially swallow
              and ignore harmful system errors.
              The messages on System.out are all along the lines of:
              "<Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to open XML
              document. Failed to retrieve PUBLIC id or SYSTEM id from the document.
              Decrease the number of char between the beginning of the document and
              its root element.>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to open XML
              document. Failed to retrieve PUBLIC id. Stream closed>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to parse given XML
              document. Failed to retrieve PUBLIC id. The root element is required
              in a well-formed document.>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to parse given XML
              document. Failed to retrieve SYSTEM id. The root element is required
              in a well-formed document.>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to open XML
              document. Failed to retrieve root tag. Stream closed>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Could not instantiate
              factory class specified in the Server console. Invalid parameters: at
              least one of publicId,systemId, rootTag must be non-null>
              The IOException looks like:
              "java.io.IOException: Stream closed
              at java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:118)
              at java.io.BufferedInputStream.read(BufferedInputStream.java:268)
              at weblogic.apache.xerces.utils.ChunkyByteArray.fill(ChunkyByteArray.java:230)
              at weblogic.apache.xerces.utils.ChunkyByteArray.<init>(ChunkyByteArray.java:106)
              at weblogic.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:153)
              at weblogic.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:499)
              at weblogic.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:318)
              at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:974)
              at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:183)
              at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:140)
              at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:86)
              at com.isone.sms.participant.contracts.web.WebLogicParserContainerTest.testWebLogicParserTanksOnEmptyStream(WebLogicParserContainerTest.java:448)
              at java.lang.reflect.Method.invoke(Native Method)
              at junit.framework.TestCase.runTest(TestCase.java:166)
              at junit.framework.TestCase.runBare(TestCase.java:140)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:131)
              at junit.framework.TestSuite.runTest(TestSuite.java:173)
              at junit.framework.TestSuite.run(TestSuite.java:168)
              at com.isone.sms.participant.contracts.web.ContractTestServlet.doPost(ContractTestServlet.java:23)
              at com.isone.sms.participant.contracts.web.ContractTestServlet.doGet(ContractTestServlet.java:16)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2546)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2260)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)"
              Judging from the IOException, it looks as though WebLogic's wrapper
              parser, RegistryDocumentBuilder, successfully picked a real parser to
              do its work and is passing off the input to be parsed there, even
              though the input's already closed. Perhaps the
              RegistryDocumentBuilder silently screwed up the stream while trying to
              figure out what parser to use, but didn't take that into account
              before attempting to pass it off for parsing. Perhaps the error
              messages on System.out account for when RegistryDocumentBuilder is
              screwing up the stream.
              But if RegistryDocumentBuilder discovers that the stream can't be
              parsed, why can't it simply report a fatal error and stop before
              starting the real parser?
              Mainly I wanted to put this experience up here on a newsgroup because
              I was so surprised that nobody else had reported similar problems. It
              makes me doubt whether our applications are handling the XML parsing
              correctly. But I can't see any other way that makes sense. Please
              let me know what you think!
              Thanks,
              Jim
              

    Hi,
    I got this error when i used JRUN as plugin server through
    Ineternet Information Server. but it was working fine when used it
    as standalone server.
    The reason was beacuase, the inputstream was getting closed . when i removed it, it started working.
    (To be frank , the Inputstream was closed by XML DOM PARSER , which is third party component.)
    and believe that your case is also the same ....
    If you have doubt on that then see that configuration for proxies under your webservers config files
    best of luck
    LOkesh T.C

  • Weblogic 8.1 SP 6 throws Read channel closed when sending SOAP message

    Hi,
    I am using Weblogic8.1 SP6 & Axis1 to send SOAP message through RPC call using SSL. This is working intermittently.
    I use WLSSLAdapter to set up the SSL, and some properties I set:
    System.setProperty("javax.xml.soap.MessageFactory", "weblogic.webservice.core.soap.MessageFactoryImpl");
    System.setProperty("javax.xml.rpc.ServiceFactory", "weblogic.webservice.core.rpc.ServiceFactoryImpl");
    System.setProperty("weblogic.webservice.verbose", "true");
    In case of error, the server throws this:
    java.io.IOException: Read channel closed
    at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Sourc
    e)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown S
    ource)
    at com.certicom.tls.record.ReadHandler.read(Unknown Source)
    at com.certicom.tls.record.ReadHandler.read(Unknown Source)
    at com.certicom.tls.record.ReadHandler.read(Unknown Source)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.closeWriteHandler(Unknown S
    ource)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.close(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Sourc
    e)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown S
    ource)
    at com.certicom.tls.record.WriteHandler.write(Unknown Source)
    at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
    at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
    AT java.io.FilterOutputStream.write(FilterOutputStream.java:80)
    at weblogic.webservice.binding.soap.HttpClientBinding.writeToStream(HttpClientB
    inding.java:430)
    at weblogic.webservice.binding.soap.HttpClientBinding.send(HttpClientBinding.ja
    va:219)
    at weblogic.webservice.core.handler.ClientHandler.handleRequest(ClientHandler.j
    ava:37)
    at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.jav
    a:143)
    at weblogic.webservice.core.ClientDispatcher.send(ClientDispatcher.java:231)
    at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:143
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:471)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
    at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:566)
    at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:419)
    Before sending message, application will first retrieve WSDL from the target. This is always success.
    I need to know how to fix this problem.
    Any help is appreciated. Thanks.
    Alvin

    Hi,
    Even I am facing the same issue could any body help me out to solve this issue.

  • Basic stream/file/socket closing question

    If you create a stream, it's generally considered good practice to call close() on that stream once you're done with it. the same for files and sockets. My question is what happens if I don't keep a reference to the object that needs closing. For example:
    BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File("myfile.txt")));Clearly, I can close() bis. But does doing so close the FileInputStream, and the File? OR, will those remain open until the garbage collecter gets around to closing them. If not, is it considered good practice to keep references around for the sole purpose of explicitly closing the resource so you don't have to wait for garbage collection?
    Finally, is it necessary to close() sockets/files/streams prior to calling System.exit()? It would save me a great deal of code in my exception handlers if I could simply exit() without explicitly freeing the resources I've opened prior to hitting the exception.
    Thanks.

    You should only need to call close on bis. That method call should take care of calling close on the underlying stream.

Maybe you are looking for

  • How to create one node for multiple instances of hardware

    I want a single minor device node to act as the interface to all instances of my hardware, in this case a co-processor chip on the     PCI bus. For the number of chips found at boot time, I want requests to be dispatched, one per chip, in a round-rob

  • Document Classes and other Questions

    Basically, i am working on an application that will eventually be deployed to the desktop as an AIR application. I am wanting to create an Analogue clock and Digital clock with a button that toggles the display between either one when pressed. As wel

  • Adobe Reader don't always open instruction pdf files

    I have a 27 inch iMac running the latest osx software 10.8.2. and Adobe Reader 10.1.4. Often when I download instruction manuals, such as the one for iDraw, which I purchased from the App Store;  it says the file is corrupt and can't open it. I have

  • How to move music from ipad to sdcard

    Hi any idea how to move music from ipad to and sdcard without any jailbreaking? Thank you.

  • How can we position the cursor in Java?

    how can we position the cursor in Java? Please help me. and also provide me the list of threading practical question?