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)

Similar Messages

  • 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!

  • SocketException when closing a Socket

    hello all,
    i have written code for printing to a printer on the network using Sockets...
    after printing the data, i do following:
    - close PrintWriter
    - call socket.shutdownOutput
    - call socket.close
    i am getting an exception when i call socket.shutdownOutput, saying
    java.net.SocketException: Socket is closed
         at java.net.Socket.shutdownOutput(Socket.java:1309)
    is the socket trying to close the PrintWriter that has already been closed?
    anyone has any ideas?
    thanx in advance and regards
    marco

    Instead of closing the PrintWriter just flush it. Then do shutdownOutput, then close either the PrintWriter or the socket - you don't need to do both.

  • 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

  • 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)

  • 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

  • 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

  • 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.

  • WLS Performance .. Socket Exception...

    Hi
    Recently we encounter the problem when we press the "Refresh" button(Browser MS IE) so quickly then WLS shows the error message as below: (The scenario is calling an entity bean from JSP.)
    GMT+08:00 2000:<E> <HTTP>
    Connection failure
    java.net.SocketException: ReadFile on fd=916 failed with err=64
    at weblogic.socket.NTSocketMuxer.initiateIO(Native Method)
         at
    weblogic.socket.NTSocketMuxer.read(NTSocketMuxer.java,
    Compiled Code)
         at
    weblogic.socket.MuxableSocketHTTP.requeue(MuxableSocketHTTP.java,
    Compiled Code)
         at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
    Compiled Code)
         at
    weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
    Compiled Code)
    Basicly it's not hurt for our application, but we
    usually need to convert the encoding of the string
    selected from Database in the EJB(it mean I need to
    convert the String because we need chinese). But if we
    press the "Refresh" button so quickly, the chinese is
    incorrect and appeared as "???????". And if we press
    the button later and slowly then the chinese is
    correct.
    Can someone give me some clue about that ? Or is it related with the "Performance Pack" of WLS...?
    BEST & THANKS
    andrew :)
    PS :
    I use Window 2000, WLS 5.1 SP6 and both JDK 1.3 and JDK 1.2.2.
    [weblogic.log]

    Hi Srikant
    Thanks, below the get method of my Entity Bean
    public String getEname() {
    // SBgen: Get variable
    String empName = null;
    try{
    // 'ename' is the filed of the 'emp' table..., it's stored
    // as chinese in Oracle...
    empName = new String(new String(ename).getBytes("iso-8859-
    1"));
    catch (Exception e){
         e.printStackTrace(); }          
    return empName;
    ----------------------------------------------------------------- I use the getByte('iso-8859-1') to convert the string select from database (Oracle 8.1.6, the string in the DB is stored as Chinese) because I need Chinese in web page. The tricky thing is that if I press the 'Refresh' button so quickly then the chinese is displayed as '???' in my web page. If I press the 'Refresh' button slowly then the Chinese is correct in web page(JSP).
    mmmmm...., I do really have no idea about that... Can someone give me some clue about that ? Thanks a lots...
    BEST
    andrew:O
    Srikant Subramaniam <[email protected]> wrote:
    This is a benign error msg ... the client closed the socket without telling the server! We've since turned off this error msg in subsequent service packs.
    Srikant, [email protected], http://weblogic.bea.com/, etc.
    AndrewWang wrote:
    Hi
    Recently we encounter the problem when we press the "Refresh" button(Browser MS IE) so quickly then WLS shows the error message as below: (The scenario is calling an entity bean from JSP.)
    GMT+08:00 2000:<E> <HTTP>
    Connection failure
    java.net.SocketException: ReadFile on fd=916 failed with err=64
    at weblogic.socket.NTSocketMuxer.initiateIO(Native Method)
    at
    weblogic.socket.NTSocketMuxer.read(NTSocketMuxer.java,
    Compiled Code)
    at
    weblogic.socket.MuxableSocketHTTP.requeue(MuxableSocketHTTP.java,
    Compiled Code)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
    Compiled Code)
    at
    weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
    Compiled Code)
    Basicly it's not hurt for our application, but we
    usually need to convert the encoding of the string
    selected from Database in the EJB(it mean I need to
    convert the String because we need chinese). But if we
    press the "Refresh" button so quickly, the chinese is
    incorrect and appeared as "???????". And if we press
    the button later and slowly then the chinese is
    correct.
    Can someone give me some clue about that ? Or is it related with the "Performance Pack" of WLS...?
    BEST & THANKS
    andrew :)
    PS :
    I use Window 2000, WLS 5.1 SP6 and both JDK 1.3 and JDK 1.2.2.
    Name: weblogic.log
    weblogic.log Type: Text Document (application/x-unknown-content-type-txtfile)
    Encoding: base64

  • 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();
    }

  • Simple Webserver SocketException: socket write error

    I'm stuck and need some help solving this problem.
    When I try to get the 404 message with the webserver, I get this in the output console:
    "HttpRequest - java.net.SocketException: Connection reset by peer: socket write error"
    I have found the part that makes the problem, but I can't find a solution.
    I hope someone can help me with this!
                try
                    outputStream.writeBytes(entityBody);
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public final class WebServer
        public static void main(String[] args) throws Exception
            //Port number
            int port = 8080;
            // Establish the listen socket.
            ServerSocket webSocket = new ServerSocket(port);
            // Process HTTP service requests in an infinite loop.
            while(true)
                // Listen for a TCP connection request
                Socket tcpSocket = webSocket.accept();
                HttpRequest httpRequest = new HttpRequest(tcpSocket);
                Thread thread = new Thread(httpRequest);
                thread.start();
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class HttpRequest implements Runnable
        final static String CRLF = "\r\n";
        private Socket socket;
        private String path = "public_html/";
        public HttpRequest(Socket socket)
            this.socket = socket;
        public void run()
            try
                processReguest();
            catch(Exception ex)
                System.err.println(ex);
        private void processReguest() throws Exception
            // Get a reference to the socket's input and output streams.
            InputStreamReader inputReader = new InputStreamReader(socket.getInputStream());
            DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream());
            BufferedReader buffReader = new BufferedReader(inputReader);
            String requestLine = buffReader.readLine();
            System.out.println();
            System.out.println(requestLine);
            String headerLine = null;
            while((headerLine = buffReader.readLine()).length() != 0)
                System.out.println(headerLine);
            // Extract the filename from the request line
            StringTokenizer tokens = new StringTokenizer(requestLine);
            tokens.nextToken();
            String fileName = tokens.nextToken();
            //Prepend a "." so that the file request is within the current directory
            fileName = path + "." + fileName;
            //Open the request file
            FileInputStream fileInputStream = null;
            boolean fileExists = true;
            try
                fileInputStream = new FileInputStream(fileName);
            catch(FileNotFoundException ex)
                fileExists = false;
            //Construct the response message.
            String statusLine = null;
            String connection = null;
            String contentLength = null;
            String contentTypeLine = null;
            String entityBody = null;
            String contentType = contentType(fileName);
            if(!requestLine.startsWith("GET") && !requestLine.startsWith("HEAD"))
                statusLine = "HTTP/1.0 405 Method Not Allowed" + CRLF;
                contentLength = "Content-Length: 0" + CRLF;
                connection = "Connection: close" + CRLF;
                contentTypeLine = "Content-type: " + "text/html" + CRLF;
                entityBody = "<HTML><HEAD><TITLE>405 - Method Not Allowed</TITLE></HEAD><BODY>405 - Method Not Allowed</BODY></HTML>";
                fileInputStream = null;
                fileExists = false;
            else if(fileExists && !contentType.equals("application/octet-stream"))
                statusLine = "HTTP/1.0 200 OK" + CRLF;
                contentTypeLine = "Content-type: " + contentType(fileName) + CRLF;
                connection = "Connection: close" + CRLF;
                contentLength = "Content-Length: " + Integer.toString(fileInputStream.available()) + CRLF;
            else if(fileExists && contentType.equals("application/octet-stream"))
                statusLine = "HTTP/1.0 415 Unsupported Media Type" + CRLF;
                contentLength = "Content-Length: 0" + CRLF;
                connection = "Connection: close" + CRLF;
                contentTypeLine = "Content-type: " + "text/html" + CRLF;
                entityBody = "<HTML><HEAD><TITLE>415 - Unsupported Media Type</TITLE></HEAD><BODY>415 - Unsupported Media Type</BODY></HTML>";
                fileInputStream = null;
                fileExists = false;
            else
                statusLine = "HTTP/1.0 404 Bad Request" + CRLF;
                contentLength = "Content-Length: 0" + CRLF;
                connection = "Connection: close" + CRLF;
                contentTypeLine = "Content-type: " + "text/html" + CRLF;
                entityBody = "<HTML><HEAD><TITLE>404 - Not Found</TITLE></HEAD><BODY>404 - Not Found</BODY></HTML>";
            // Send the status line
            outputStream.writeBytes(statusLine);
            // Send the connection status
            outputStream.writeBytes(connection);
            // Send the Content-Length
            outputStream.writeBytes(contentLength);
            // Send the content type line
            outputStream.writeBytes(contentTypeLine);
            //Send a blank line to indicate the end of the header lines.
            outputStream.writeBytes(CRLF);
            // Send the enity body
            if(fileExists)
                //Den här funkar??
                sendBytes(fileInputStream, outputStream);
                fileInputStream.close();
            else
                try
                    outputStream.writeBytes(entityBody);
                catch(SocketException ex)
                    System.out.println(ex);
            socket.close();
            inputReader.close();
            outputStream.close();
            buffReader.close();
        private void sendBytes(FileInputStream fileInputStream, DataOutputStream outputStream) throws IOException
            //Construct a 1k buffer to hold bytes on their way to the socket
            byte[] buffer = new byte[1024];
            int bytes = 0;
            // Copy request file inte socket's output stream
            while((bytes = fileInputStream.read(buffer)) != -1)
                outputStream.write(buffer,0, bytes);
        private String contentType(String fileName)
            if(fileName.endsWith(".htm") || fileName.endsWith(".html"))
                return "text/html";
            else if(fileName.endsWith(".jpg") || fileName.endsWith(".jpeg"))
                return "image/jpeg";
            else if(fileName.endsWith(".gif"))
                return "image/gif";
            else if(fileName.endsWith(".png"))
                return "image/png";
            else if(fileName.endsWith(".txt"))
                return "text/plain";
            return "application/octet-stream";
    }

    You've told the client that the content length is zero bytes so I presume it closes the connection as soon as it finishes receiving headers. It depends what client you're using of course but that seems reasonable behaviour...

  • 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