Works on Windows but timeout on linux

I have a problem with the code below. It perfectly works under Windows, but I am getting a timeout under Linux. I am not sure why. Any ideas?
One more thing: Under Liunx It fails when I am testing it using port 1935. However, if I test it with port 110, it works. On Windows it works with both ports (110 & 1935).
Thanks you!
Gustavo
            try {
                theSocket = new Socket(Address,Port);
                theSocket.setSoTimeout(Timeout);
              try {
                    BufferedReader inFromServer = new BufferedReader(
                            new InputStreamReader(theSocket.getInputStream()));
                    PrintWriter outToServer = new PrintWriter(new BufferedWriter(
                            new OutputStreamWriter(theSocket.getOutputStream())), true);
                    outToServer.println((char)13);
                    messageReceived = inFromServer.readLine();
                    TmpPage = messageReceived;
                catch(IOException e) {
                    if (status == 1){
                        ErrorDescription = ErrorDescription+"ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
                    }else{
                        ErrorDescription = "ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
                    status = 1;
                finally {
                    theSocket.close();
            catch(UnknownHostException e) {
                if (status == 1){
                    ErrorDescription = ErrorDescription+"ERRTEL03 Error in TELNETMonitor Thread (INVALID HOST): "+e.getMessage();
                }else{
                    ErrorDescription = "ERRTEL03 Error in TELNETMonitor Thread (INVALID HOST): "+e.getMessage();
                status = 1;
            catch(ConnectException e) {
                if (status == 1){
                    ErrorDescription = ErrorDescription+"ERRTEL04 Error in TELNETMonitor Thread (THE HOST DOESN'T RUN A SERVER ON THE SPECIFIED PORT): "+e.getMessage();
                }else{
                    ErrorDescription = "ERRTEL04 Error in TELNETMonitor Thread (THE HOST DOESN'T RUN A SERVER ON THE SPECIFIED PORT): "+e.getMessage();
                status = 1;
            catch(IOException e) {
                if (status == 1){
                    ErrorDescription = ErrorDescription+"ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
                }else{
                    ErrorDescription = "ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
                status = 1;
            }

GustavoN wrote:
...Under Liunx It fails..how?
>
Thanks you!
Gustavo
[ Don't use PrintWriter or PrintStream|http://forums.sun.com/thread.jspa?messageID=10642137#10642137]
outToServer.println((char)13);You should flush() the outputstream after writing, before you do a subsequent read on the socket's inputstream.
catch(IOException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
}else{
ErrorDescription = "ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
status = 1;
finally {
theSocket.close();
catch(UnknownHostException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL03 Error in TELNETMonitor Thread (INVALID HOST): "+e.getMessage();
}else{
ErrorDescription = "ERRTEL03 Error in TELNETMonitor Thread (INVALID HOST): "+e.getMessage();
status = 1;
catch(ConnectException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL04 Error in TELNETMonitor Thread (THE HOST DOESN'T RUN A SERVER ON THE SPECIFIED PORT): "+e.getMessage();
}else{
ErrorDescription = "ERRTEL04 Error in TELNETMonitor Thread (THE HOST DOESN'T RUN A SERVER ON THE SPECIFIED PORT): "+e.getMessage();
status = 1;
catch(IOException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
}else{
ErrorDescription = "ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
status = 1;
C'mon, Gustavo, you can have cleaner exception handling than that!
Edited by: ghstark on May 14, 2009 4:40 PM

Similar Messages

  • URL.openStream() works in Windows but not in Linux

    I am having a problem with this line:
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
    in the code sample further below.
    A simple program using this line works when compiled in my Windows XP:
    java version "1.6.0_03"
    Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
    Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
    but not when compiled on my RedHat FC 4 server:
    java version "1.4.2"
    gij (GNU libgcj) version 4.0.2 20051125 (Red Hat 4.0.2-8)
    The program (making using of a previous froum example and pared down to minimize tangent topics):
    The code works for all 3 URLs in Windows. In Linux it only works for the 1st one (bbc.co site)
    Error is listed below the code:
    import java.net.*;
    import java.io.*;
    public class BBC {
    public static void main(String[] args) throws Exception
    //    URL url = new URL("http://news.bbc.co.uk/sport1/hi/football/eng_prem/6205747.stm");
    //    URL url = new URL("http://www.weatherunderground.com/global/stations/71265.html");
        URL url = new URL("http://www.weatherunderground.com");
        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
        int nLineCnt = 0;
        String inputLine;
        while ((inputLine = in.readLine()) != null)
            nLineCnt++;
        System.out.println("nLineCnt=" + nLineCnt);
    //--------------------------------------------------------------------------------------------------------------------------------------------Exception in thread "main" java.lang.StringIndexOutOfBoundsException
    at java.lang.String.substring(int, int) (/usr/lib/libgcj.so.6.0.0)
    at gnu.java.net.protocol.http.Request.readResponse(gnu.java.net.LineInputStream) (/usr/lib/libgcj.so.6.0.0)
    at gnu.java.net.protocol.http.Request.dispatch() (/usr/lib/libgcj.so.6.0.0)
    at gnu.java.net.protocol.http.HTTPURLConnection.connect() (/usr/lib/libgcj.so.6.0.0)
    at gnu.java.net.protocol.http.HTTPURLConnection.getInputStream() (/usr/lib/libgcj.so.6.0.0)
    at java.net.URL.openStream() (/usr/lib/libgcj.so.6.0.0)
    at BBC.main(java.lang.String[]) (Unknown Source)
    at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
    at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
    Can anyone please suggest what I can do to be able to process the weatherunderground URL?
    Claude

    To me it would suggest a bug in the VM that you are using.
    Solutions
    1. Use a different VM
    2. Write your own code to process the http code. Depending on licensing for the VM in use and the VM itself. you might be
    able to find the bug in that code, fix it yourself, and then use your fix (start up command line options for VM.) Otherwise
    you have to duplicate the functionality. You might look to jakarta commons, there might be code there that does that.

  • Coherence test works on Windows but faield on Linux

    Hello there:
    I am running a DefaultCacheServer instance on my Windows XP box, and start a JUnit test to load a bounch of objects which are generated from a csv file source; both server and client use a customized configuration. The object class in question is also defined pof file. The client node is not used as storage.
    All above worked out just fine.
    Now I transfer the code to Linux, and I started DefaultCacheServer w/o a problem. However, when I started the client, it failed to load the objects into the server's cache. The error mesage shows:
    2011-08-31 15:14:21.533/1.653 Oracle Coherence GE 3.7.0.0 <Error> (thread=Cluster, member=2): This cluster node is configured to use serializer com.tangosol.io.pof.ConfigurablePofContext {location=/home/XXXX/config/pof-config.xml}, which appears to be different from the serializer used by Member(Id=1, Timestamp=2011-08-31 15:13:50.292, Address=xx.xx.xx.xx:XXXX, MachineId=XXXXX, Location=site:xxxxx.com,machine:xxxxxx,process:xxxxxx, Role=CoherenceServer).
    java.io.StreamCorruptedException: type=-261969
    at com.tangosol.io.pof.PofHelper.skipUniformValue(PofHelper.java:1226)
    at com.tangosol.io.pof.PofHelper.skipValue(PofHelper.java:1013)
    at com.tangosol.io.pof.PofBufferReader$UserTypeReader.readRemainder(PofBufferReader.java:3660)
    Anyone can tell from these logging info what went wrong?
    Thanks,
    John

    Hi John,
    This has nothing to do with the O/S but Coherence by default using java.io.serialization for serializing the objects and you need to explicitly specify if you want to use POF for serialization. You can sepcify the serializer at the service level in the coherence cache configuration or you specify the system property -Dtangosol.pof.enabled=true as java option in the startup script but this will enable the POF for the entire JVM. Also, you need to specify your pof configuration using -Dtangosol.pof.config="CONFIG_FILE_PATH". This needs to be done for both the cache server and client. A mismatch of the serialization type on the client and server is causing the error.
    You may go through the document http://coherence.oracle.com/display/COH35UG/The+Portable+Object+Format for more options.
    Hope this helps!
    Cheers,
    NJ

  • Works in Windows but exception in Linux

    I am using the following lines of code in Windows for the required encryption
    KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), this.salt, this.iterationCount);
    this.key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);But this same code to get the key does not work in linux when I am using the same version on Java on both Windows and Linux. Do i need something more to get this thing working.
    The Exception I got in Linux is:
    java.security.NoSuchAlgorithmException: PBEWithMD5AndDES not found

    Please don't cross post - http://forum.java.sun.com/thread.jspa?threadID=738842&messageID=4240723#4240723

  • CS6 Plugin works on windows but not mac

    Hi,
    We have been developing a plugin for InDesign since CS3 and have recently ported it to CS6 (it was ported to all previous versions too, as they came out).
    I followed the porting guide etc. and on windows it compiles and runs just ok - the plugin works correctly.
    But when i compiled the same files on our mac machine and put the .indesignPlugin file in th plugins directory i can't see our plugin's context menu.
    I can see that it is in fact loaded on startup (when i remove it ID loads 325 extensions, when i put it back - 326), but still it dosen't seem to work...
    I initially thought that the versioning was off but our PluginVersion resource relies solemnly on SDKDef.h , i also tried putiing the file in CS5's plugin directory and got an error message that CS6 is required - so the version info is fine i guess.
    We are using xCode 3.2.5 (because we have to support Mac OS 10.5 and 10.4) to build on mac and i've never had problems before - it worked on CS4, CS5 and CS5.5.
    The changes i made when porting were minor and only in the code - so what has changed? and how come it works on windows but not on mac?
    Any input is greatly appreciated, i've already spent days trying to understand this.
    Thanks,
    Dan.

    Hi and thank you for replying.
    The resources do get compiled correctly (i assume this because we do get a .indesign file at the end - which means the ODFRC ran ok). they are linked correctly in the mac project (i saw a file that determines the version - it's linked the same way against my win and mac projects and the win version works fine so i guess that's ok too).
    the context menu is just another menu on the "menu bar" (don't know how to call it?) - i.e where the "file" and "edit" etc. menus are.
    I can't seem to understand how come this works fine under windows but not under mac - they are essentially the same projects linked against the same resources (the difference being iCode vs VC10 projects).
    can this be related to the fact we're using xCode 3.2.5?
    Thank you.

  • I have a maginon film scanner bought from ALDI. It works with windows but with OSX Maverick software it keeps crashing as soon as I try and capture an image. I cannot find details of software updates anywhere.

    I have a maginon film scanner bought from ALDI. It works with windows but with OSX Maverick software it keeps crashing as soon as I try and capture an image. I cannot find details of software updates anywhere.

    Same question answered here : https://discussions.apple.com/thread/5762314?tstart=0
    I just popped in with using Mavericks (I got rid of my MBP about a year ago, and just got another one when I got an Air for my wife) and noticed that Mavericks is not working and playing well with a couple of programs I already owned (Paraellels, for example...yes, I spelled it wrong...).  I looked for maginon.com and it didn't exist, nor was my google search directed to another location for them, so I postulate that the device may not be in production anymore, thus: no driver updates from the manufacturer.
    From my mac-noob-layman's perspective: get some vmware, run windows and use the scanner in your virt machine to capture your images.  Put the images in your mac side and work your mac magic on them there.
    Peace

  • RUN_REPORT_OBJECT is working in Windows but not in Solaris

    hi
    I have written the following code. It's working in Windows(when I give windows path). But it's not working in Solaris
    It's not either giving me any error message. Could you please help me?
    declare
    repid REPORT_OBJECT;
         v_rep VARCHAR2(100);
         List_id ParamList;
    BEGIN
         List_id := GET_PARAMETER_LIST('input_params');
         IF NOT ID_NULL(List_id) THEN
         DESTROY_PARAMETER_LIST(List_id);
         END IF;
         List_id := Create_Parameter_List('input_params');
         Add_Parameter(List_id, 'p_1',TEXT_PARAMETER,'100008456');
         Add_Parameter(List_id, 'p_2',TEXT_PARAMETER,'P22');
         Add_Parameter(List_id, 'p_3',TEXT_PARAMETER,'600015');
         repid := FIND_REPORT_OBJECT(RE1');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,ASYNCHRONOUS);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,'/home/oracle/OraHome2/rep/rep3.rdf');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,FILE);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'PDF');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESNAME,'/home/oracle/OraHome2/rep/aa.pdf');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'you_report_server_name');
         v_rep := RUN_REPORT_OBJECT(repid, List_id);
         Destroy_Parameter_List(List_id);
         message('v_rep '||v_rep);
         message(1);
    exception
         when others then
         message(sqlerrm);
         message(1);
    end;

    hi
    it is showing me following. I could not understand it. Is there any error message here
    Reports Server Queue Status
    Security Mode Non-secure
    Queue on server rep_SIT-02_10gAS, on Tue Dec 08 13:13:21 IST 2009 To kill a current (enqueued or scheduled) job, click on the status icon for the specific job. Then click on Cancel Job button in next page.To get a cached output of a successfully finished past job, click on the Job Name hyperlink of that job (if available).
    View
    View Current JobsPast JobsScheduled Jobs
    Result
    Previous Next
    Job ID Job Type Job Name Job Status Job Owner Output Type Output Name Server Name Queued At Started At Finished At
    None
    Help
    Copyright (c) 2002, 2005, Oracle. All rights reserved.
    -------------------------------------------------------------------------------------------------------

  • IPod works with Windows but not iMac

    I have an 80GB iPod Classic that works perfect on my computer running Windows Vista and iTunes 7. I have only ever used it with iTunes.
    My iPod's format is FAT32 (Windows). And it's running software Version 1.1.2 and disk use is enabled.
    When i try and plug it into an iMac (iMac G5) running OS X 10.3.9 it doesn't work. It doesn't come up as an external drive so I can't access it as an external disk and it fails to work in iTunes.
    I have upgraded the Mac to the latest version of iTunes but this still doesn't solve the problem. I tunes gives me the following error "iTunes has detected an iPod that appears to be corrupted...". This is not the case, my iPod is not corrupted.
    How can i get my iPod to work on the Mac?

    I had the same problem. Your ipod is formated i believe for windows so it wont come up on your mac. to format it you need to plug it into the mac go onto itunes and if you click on the summary page of ipod the only options you will be able to edit on the ipod from the mac are restore or (i dont know exactly) but there should be a button explaining that you need to restore your ipod and format it for mac.
    to do this you need to click the button on the summary page on itunes (if you click on your 80G ipod on the left side) but formating for mac deletes everything off the ipod. it wont be able to transfer music etc if you format for mac on your windows but it will now work on the mac.
    i hope u understood because i didnt really make it very clear. but if you dont understand just ask and ill be happy to explain it for you.
    Alex
    Message was edited by: Alexander Richardson

  • ShowDocument works on Windows but not Mac

         public void actionPerformed(ActionEvent ae) {
              String command = ae.getActionCommand();
              if(command.equals("save"))
                   String insertHTML = getDocumentText();
                   showDoc("ProcessPage.asp?BodyCopy='Test'","_blank");
         //Shows a document (htm,asp,..) in a frame
         private void showDoc(String urlstr, String frameName) {
              int pos = getDocumentBase().toString().lastIndexOf("/");          
              String DocBase = getDocumentBase().toString().substring(0, pos+1);
              System.out.println("openURL: "+DocBase + urlstr);
              try
              {     URL url = new URL(DocBase + urlstr);                         
                   AppletContext j = getAppletContext();
                   j.showDocument(url, frameName); }
              catch (MalformedURLException e) // new URL() failed
              {     System.out.println("new URL() failed for: "+ DocBase + urlstr); }
              catch (IOException e) // openConnection() failed
              {     System.out.println("openConnection() failed for: "+ DocBase + urlstr); }
    I am trying to open up a new web page from an applet using showDocument. This works fine on Windows but not on Mac. The applet I am working with extends JApplet. Does anybody have any suggestions?

    This is not working for me either. After issuing the showDocument(url, target) command I never see the request come into my webserver log. Although, it only seems to not work when the Mac is setup as Japanese. I know this doesn't make any sense.
    Does not work on IE or Safari with 1.3.1
    Does work with Safari with 1.4.1
    Please help

  • Servlet works in windows but does not work in solaris?

    hi all,
    can someone tell me why the servlet work in windows platform but doesnt work in solaris?The servlet tries to ping 127.0.0.1 and the output is correct in windows, but when i try it in solaris, it produces the following exception :
    Internal error: Unexpected Java exception thrown ( unknown exception, no description ) , stack:java.lang.NoClassDefFoundError: StreamGobbler
    at java.lang.Class.getDeclaredConstructors()(Native Method) ....
    The code is as follow:
    import java.util.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    class StreamGobbler extends Thread
         InputStream is=null;
         String type=null;
         PrintWriter out=null;
         StreamGobbler(InputStream is,String type,PrintWriter out)
         this.is=is;
         this.type=type;
         this.out=out;
         public void run()
              try
              InputStreamReader isr=new InputStreamReader(is);
              BufferedReader br=new BufferedReader(isr);
              System.out.println("finishing inputstreamReader and BufferedReader");
              String line=null;
              while (     (line=br.readLine())!=null )
                   {     out.println(type+"> "+line);
                        out.println("<br>");          
              catch (IOException ioe)
              {     ioe.printStackTrace();
    public class ping extends HttpServlet
         public void init(ServletConfig config) throws ServletException
         {     super.init();
         public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
              res.setContentType("text/html");
              PrintWriter out=res.getWriter();
         try     {
              Runtime rt=Runtime.getRuntime();
              System.out.println("pinging 127.0.0.1");
              String[] cmd={"ping","127.0.0.1"};
              Process proc=rt.exec(cmd);
              System.out.println("finishing process proc=rt.exec(cmd)");
              StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(),"ERROR",out);
              StreamGobbler outputGobbler= new StreamGobbler(proc.getInputStream(),"OUTPUT",out);
              errorGobbler.start();
              outputGobbler.start();
              int exitVal=proc.waitFor();
              out.println("Process exitValue: "+exitVal);
              out.close();
         catch (Throwable t)
                   t.printStackTrace();
    Thanks for help.

    java.lang.NoClassDefFoundError: StreamGobblerBecause you didn't put that class into the classpath of the servlet you are trying to run on Solaris.

  • Image.source in ItemRenderer works in Windows but not Mac

    I have a Flex (AIR) application that is giving me problems on
    the Mac. In one of the
    Datagrids, I am using an ItemRenderer with an image control.
    Some code in the
    "set data(value:Object)" function assigns a file path as the
    source of the image
    control as follows.
    imgThumb.source =
    File.documentsDirectory.resolvePath("pdqtemp").nativePath +
    "/" + data.strJPGFileName;
    This works correctly in Windows , but not on the Mac.
    In this case, the path resolves to the following on the Mac.
    /Users/brian/Documents/pdqtemp/artist_01t.jpg
    I have verified that the file is in the right place and when
    using the path in
    the command line console, it correctly addresses that
    directory and file. I
    don't normally develop apps for the Mac so I am sure there is
    something I am
    missing.
    Any ideas?
    Thanks for your help.

    Hi Jed,
    Thanks for responding
    That is the exact path assigned to the Source of the Image
    control. However, it isn't exactly a trace of the Image.Source
    property.
    The code in question is attached
    The alert shows the path I originally posted and shows that
    the fileImgThumb.exists returns False.
    As I mentioned, this works perfectly in Windows. There is
    some code elsewhere in the app that creates the thumbnail. That
    does work on the Mac as the thumbnail image is created and saved
    where expected.
    I am not sure what I might be doing wrong.
    Thanks for your help,
    Sid

  • Needs to be reformated to work on windows But Ive always used it in windows

    Ok so I plugged my iPod into my windows xp pc today and a message popped up that says I need to reformat it to work on windows. My problem is that Ive been using it with windows ever since I got it. It has never been connected to a mac and I have never had this problem before. I even tried using xplay 2 to access it but the program just freezes. Does anyone know anything that could help me?!?!? I really dont wanna restore it because I couldnt back it up because i dont have enough hdd space for 80 gigs of music and if I have to restore it I will lose it all. PLEASE HELP ME!
    P.S. After the message comes up saying i need to reformat a window that says autoplay comes up and shows a little progress bar then disappears.

    I don't want to seem like the bearer of bad news, but this demonstrates the need to back up your library. An iPod can be a fickle instrument, and can fail, as evidenced by these forums. A lack of a backup to your library means that if the iPod fails, you wil loose your music. Also, the costs of external USB drives has dropped significantly, to the point that you could almost get a terabyte of storage for the cost of a 160GB iPod. That would give you a place to store and/or backup your music library. This would allow you to restore your iPod and re-sync your library.

  • My codes run in windows but not in Linux what is wrong?

    //I have 4 codes in total but heres is one for example
    import java.util.*;
    // This state accepts numeric input less than 100 and subtracts
    // 1 from each input number before exiting the state.
    // We exit the state if the input is exactly 100.
    public class AState extends State {
    public AState (String n, boolean d ) {
    super(n,d);
    public void RUN () {
    int ch = 0;
    entry();
    Scanner stdin = new Scanner(System.in);
    ch = stdin.nextInt();
    while ( ch != 100 ) {
    ch--;
    System.out.print(" " + ch);
    ch = stdin.nextInt();
    // change state from AState to BState
    Controller.state = Controller.states[Controller.BSTATE];
    // this will be the AState version of exit().
    exit();
    //It runs perfectly in windows but once I compile in a terminal of Linux it doesn't run it show like 8 errors, why is that, can somebody tell me what can I do about it

    public class AState extends State {
    ^
    Astate.java:18: cannot find symbol
    symbol : method entry()
    location: class AState
    entry();
    ^
    ./Controller.java:8: class BState is public, should be declared in a file named BState.java
    public class BState extends State {
    ^
    ./Controller.java:8: cannot find symbol
    symbol: class State
    public class BState extends State {
    ^
    Astate.java:31: cannot access Controller
    bad class file: ./Controller.java
    file does not contain class Controller
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    Controller.state = Controller.states[Controller.BSTATE];
    ^
    6 errors
    //As i said before, this run perfently through windows the same exactly code.

  • Runtime.exec work in windows but not in solaris??

    hi all,
    can someone tell me why the following code work in windows platform but doesnt work in solaris?The program tries to ping 127.0.0.1 and the output is correct in windows, but when i try it in solaris, it produces the following exception :
    Internal error: Unexpected Java exception thrown ( unknown exception, no description ) , stack:java.lang.NoClassDefFoundError: StreamGobbler
    at java.lang.Class.getDeclaredConstructors()(Native Method) ....
    The code is as follow:
    import java.util.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    class StreamGobbler extends Thread
         InputStream is=null;
         String type=null;
         PrintWriter out=null;
         StreamGobbler(InputStream is,String type,PrintWriter out)
         this.is=is;
         this.type=type;
         this.out=out;
         public void run()
              try
              InputStreamReader isr=new InputStreamReader(is);
              BufferedReader br=new BufferedReader(isr);
              System.out.println("finishing inputstreamReader and BufferedReader");
              String line=null;
              while (     (line=br.readLine())!=null )
                   {     out.println(type+"> "+line);
                        out.println("<br>");          
              catch (IOException ioe)
              {     ioe.printStackTrace();
    public class ping extends HttpServlet
         public void init(ServletConfig config) throws ServletException
         {     super.init();
         public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
              res.setContentType("text/html");
              PrintWriter out=res.getWriter();
         try     {
              Runtime rt=Runtime.getRuntime();
              System.out.println("pinging 127.0.0.1");
              String[] cmd={"ping","127.0.0.1"};
              Process proc=rt.exec(cmd);
              System.out.println("finishing process proc=rt.exec(cmd)");
              StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(),"ERROR",out);
              StreamGobbler outputGobbler= new StreamGobbler(proc.getInputStream(),"OUTPUT",out);
              errorGobbler.start();
              outputGobbler.start();
              int exitVal=proc.waitFor();
              out.println("Process exitValue: "+exitVal);
              out.close();
         catch (Throwable t)
                   t.printStackTrace();

    Did you copy all the class files to your solaris machine ? SOunds like you didn't copy all your files correctly.

  • Basic RMI program works in windows but not Linux

    Hello,
    I'm trying to learn RMI for a program at work.
    I have the book "Core Java 2 - Volume 2 - Advanced Features". Chapter 5 of this book is about RMI.
    The most basic example program they use works fine in Windows. However, when I try to run this same program under linux it doesn't work.
    For now, I'm not even trying to run a client (in linux)...just the server.
    Here is the server code.
    public class ProductServer
    public static void main(String args[])
    try
    System.out.println
    ("Constructing server implementations...");
    ProductImpl p1
    = new ProductImpl("Blackwell Toaster");
    ProductImpl p2
    = new ProductImpl("ZapXpress Microwave Oven");
    System.out.println
    ("Binding server implementations to registry...");
    Naming.rebind("rmi://172.20.101.1/toaster", p1);
    Naming.rebind("rmi://172.20.101.1/microwave", p2);
    System.out.println
    ("Waiting for invocations from clients...");
    catch(Exception e)
    e.printStackTrace();
    What is very interesting is that this call works
    Naming.rebind("rmi://172.20.101.1/toaster", p1);
    But the very next line
    Naming.rebind("rmi://172.20.101.1/microwave", p2);
    Throws this error ::
    java.rmi.UnmarshalException: Error unmarshaling return header: java.io.EOFException
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:221)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:366)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(RegistryImpl_Stub.java:133)
    at java.rmi.Naming.rebind(Naming.java:172)
    at ProductServer.main(ProductServer.java:35)
    I would very much appreciate the help. Thank You.

    We solved the problem
    Apparently, on the linux machine we had both gcc and the jdk installed
    the regualar compile command hit the jdk
    the rmic command used the gcc version of rmic
    the rmiregistry used the gcc version of rmiregistry
    the regular run command hit the jdk
    using the rmic and rmiregistry in the jdk made everything work fine
    I knew it had to be a stupid answer.

Maybe you are looking for

  • Getting BPM Deployement Exception

    Hi Experts, can you please help me in resolving the below issue we are getting while deploying the BPM. I have created the split mappings in PI and imported to BPM. While importing no issues occured . But while deploying  we are getting below error.

  • HT204388 can you connect a GATEWAY TOWER to a MAC 23in CINEMA MONITOR?

    can you connect a GATEWAY TOWER to a MAC 23in CINEMA DISPLAY?

  • Invoice with reference to SalesOrder

    Hi, in SQL Table INV1 i can see information like BaseRef=10000, BaseType = 17, BaseEntry = 1 etc. How can I Import invoice via XML structure with a BaseRef? In our scenario we have invoices with reference to order. Thank Kay

  • Can't open old iWeb domain file (yes, I have asked in the other forum!)

    I had to wipe my MacBook hard drive and reinstall my data and OSX. Having tried to restore my iWeb domain file from Time Machine, I find I am unable to open it. (I've asked this question in the iWeb forum but was eventually directed here.) I've tried

  • Performancepoint service application error

    Hi, I am new to SharePoint 2013, I have configured the PerformancePoint Service Application.  When I tried to create the data source from the PerformancePoint Content section.  I am getting the following error. "Cannot connect to the PerformancePoint