Get complete output from java.lang.Process

How do I get the complete output from java.lang.Process?
By the time I've started reading from Process.getInputStream() the process has already terminated...

I solved the problem:
private int exec(String pArguments[], OutputStream pOut, OutputStream pErr) throws IOException {
     class ProcessOutputPrinter implements Runnable {
          private InputStream ivIn;
          private OutputStream ivOut;
          public ProcessOutputPrinter(InputStream pIn, OutputStream pOut) {
               ivIn = pIn;
               ivOut = pOut;
          public void run() {
               try {
                    for(int tByte; (tByte = ivIn.read()) != -1; ) {
                         ivOut.write(tByte);
                    ivOut.flush();
               catch(IOException e) {
                    e.printStackTrace();
     // Start process
     Process tProcess = Runtime.getRuntime().exec(pArguments);
     // Create out printer
     Thread tOutPrinter = new Thread(new ProcessOutputPrinter(tProcess.getInputStream(), pOut), "NamingAdmin out-printer");
     tOutPrinter.start();
     // Create err printer
     Thread tErrPrinter = new Thread(new ProcessOutputPrinter(tProcess.getErrorStream(), pErr), "NamingAdmin err-printer");
     tErrPrinter.start();
     // Wait for process and printers to finish
     try {
          tProcess.waitFor();
          tOutPrinter.join();
          tErrPrinter.join();
     catch(InterruptedException e) {
     // return process exit value
     return tProcess.exitValue();

Similar Messages

  • Getting no output from java.util.logging.FileHandler

    I am new to Java as is the company I work for, but we have just landed a contract that specifies J2EE as the platform, so here we are. :-) Please bear with me.
    I have been charged with determining our logging architecture and it looks like what is available in java.util.logging will do well (though we may use log4j). However, at this point I am just trying to get anything to work and not having much luck.
    We are using JSF on the front end and I have created a very simple JSF page to test logging. The relevant code is below and I hope will be self explanatory: This code is not meant to be efficient or anything. It is just a proof of concept.
        public String button1_action() {
            // User event code here...
            try {
                Logger l = java.util.logging.Logger.getLogger(Page1.class.getName());
                l.entering(Page1.class.getName(), "button1_action");
                l.info(this.textField1.getValue().toString());
                l.exiting(Page1.class.getName(), "button1_action");
                java.util.logging.Handler h = l.getHandlers()[0];
                h.flush();
            catch(Exception ex) {
                //I have tested this and we aren?t catching any errors.
                System.err.println(ex);
            return "";
        }My logger.properties files looks like this:
    handlers= java.util.logging.FileHandler
    .level= FINEST
    java.util.logging.FileHandler.pattern = c:/sun/logs/test-%u.log
    java.util.logging.FileHandler.limit = 50000
    java.util.logging.FileHandler.count = 1
    java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatterI have developed and tested this in Sun Studio Creator 2004Q2 What is happening is that I am getting three log files in c:/sun/logs
    test-0.log, test-1.log and test-2.log. The first two contain output from various sun components. (sun.rmi.transport for example). The third log remains empty. (zero length)
    I have also deployed the test app to a tomcat 5.0.28 server and get similar results. The only difference is I get only one two log files and the second one remains empty.
    Any assistance or suggestions as to what direction I should be taking would be appreciated.
    --Ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Do not use default logger as getLoggers[0] , but use your java.util.Logger.FileHandler and add filehandler object to log your fButtonActions and you do not need to mess with logger.properties too.

  • Java.lang.Process output stream problem

    Hi, I have a program that starts a process (java.lang.Process) using the java.lang.Runtime.exec() and it attemtps to interface with it using the provieded io streams. I have both the output and error streams being handled on their own threads and I have a hashmap of output lines/command pairs that are checked so that when the process outputs certain lines to the console it feed the proper input into the process. My problem is that when I feed the input into the process it dosen't respond to it almost like the user hasn't pressed enter, The process hangs. I have tried using /n /r and permutations thereof but nothing works. The thread does read the lines from the process and does output to the process from what i can gather. Can you help me!
    here is some of the code..
    public void run() {
    try {
         //the process's output
         InputStreamReader isrOutput = new InputStreamReader(inOutput);
         //the process's input(our output)
         PrintWriter pw = new PrintWriter(outInput);
         String line = null;
         while(true){
              if(brOutput.ready()){
                   line = "";
                   while(brOutput.ready())
         line+=(char)brOutput.read();
                   System.out.print(line);
                   if(commands.containsKey(line)){
         pw.println((String)commands.get(line));
         System.out.println((String)commands.get(line));;
    } catch (IOException ioe) {
              ioe.printStackTrace();
    }Thanks

    Oops.. i forgot to flush my PrintWriter /blushing......... Thanks

  • Java.lang.Process input stream waiting until process is complete to print

    I have tried to simplify this problem as much as possible. Basically, I have a java.lang.Process which executes a simple C program.
    test.c
    #include <stdio.h>
    #include <unistd.h>
    int main()
      printf("foo\n");
      sleep(2);
      printf("bar\n");
    ...The process has an input stream and error stream handler each on a separate thread. I have tried both buffered and unbuffered (BufferedReader, BufferedInputStream, InputStreamReader...) stream handlers. Both produce the same problem of waiting until the process has exited to receive anything from the process's streams.
    The only time this does not happen is when I call fflush(stdout); after each printf(). This can't be a solution because the real application calls a massive C application which would require thousands of fflush()'s to be added. What is causing this to happen? This doesn't happen when the C program is executed from the shell. Is there a way the InputStream can be forced to extract from the stream?

    hi.....
    I have closed the output stream of the process as you told me to do...
    The hitch is that, if my program contains only printf() statements,it works fine
    as soon as scanf() statement is encountered within the C code,it is totally neglected,and the output comes as if no scanf() statement existed in the C code.
    Consequently the thread doesnt wait for input which was bound for scanf() from the thread
    the code...
        public void run()
         try
             PrintWriter out = new PrintWriter(socket.getOutputStream(),true);
             BufferedReader in = new BufferedReader(
                            new InputStreamReader(
                            socket.getInputStream()));
             try
                     Process p;
              p=new ProcessBuilder("./a.out").start();
                     PrintWriter exOut=null;
                     BufferedReader exIn=null;
              exOut = new PrintWriter(p.getOutputStream(),true);
              exIn = new BufferedReader(
                           new InputStreamReader(
                           p.getInputStream()));
                  //String inputLine="", outputLine="";        
                  String str="";
                     int c;          
                  while(true)                   
                        //System.out.println("In While");
                  str="";exOut.close();                  
                        while((c=exIn.read())!=-1)
                                 str=str+(char)(c);
                                    System.out.print(str);
                        str=str+(char)(0);
                        System.out.print(str+"outside");
                        out.print(str);
                        sleep(100);
                        try
                            int x=p.exitValue();
                              out.print(str);
                   System.out.print("Bye 1");
                            String str1="Bye"+(char)(0);
                   out.println(str1);              
                   break;
                        catch(IllegalThreadStateException e)
                            //System.out.println("The Process has not ended yet");
                        //str=str+((char)-1);
                        //System.out.print(str+"Control reaches here too");
                        str="";
                        exOut = new PrintWriter(p.getOutputStream(),true);//I have tried to run the program without this also but the effect is the same
                        while((c=in.read())!=-1)
                            str=str+(char)(c);                                    
                        if(str.contentEquals(""))
                                System.out.print("Bye 2");
                                String str1="Bye"+(char)(0);
                                out.println(str1); 
                                p.destroy();
                                exOut.close();
                                exIn.close();
                                out.close();
                                in.close();        
                                socket.close();
                                break;
                        //str=str+(char)(0);
                  exOut.print(str);
                        try
                            int x=p.exitValue();
                            System.out.print("Bye 3");
                            String str1="Bye"+(char)(0);
                   out.println(str1);
                            break;
                        catch(IllegalThreadStateException e)
                            //System.out.println("The Process has not ended yet");
                  /*while ((inputLine = in.readLine()) != null)
                        exOut.println(inputLine);
                        outputLine=exIn.readLine();
                        //outputLine=inputLine;
                        //out.println(outputLine);}*/                   
             exOut.close();
             exIn.close();
             catch(IOException e)
                  System.err.println("Accept failed."+e);
             out.close();
             in.close();        
             socket.close();
         catch (Exception e)
             e.printStackTrace();
    }

  • Getting the output from a Perl script using Runtime.exec

    I cannot get the output from a perl script using Java. Can someone PLEASE help?
    I used the following code:
    Process p = Runtime.getRuntime().exec("C:\\Perl\\bin\\Perl.exe script.pl) ;
    InputSream in = p.getInputStream();
    b...
    do
    System.out.println(b);
    while ((b = in.read()) > 0)
    But there is no way that I get the output in the inputstream. If I use the command "cmd script.pl", the output is displayed in the Dos box, but also not in the inputstream.
    I will appreciate any help.

    Try this
    Process p = Runtime.getRuntime().exec("C:\\Perl\\bin\\Perl.exe script.pl) ;
    BufferedReader rd = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String str;
    while((str=rd.readLine())!=null){
    System.out.println(str);
    Manu

  • Getting the payload from a faulted process

    I'm using the fault framework and I need to know how to get the payload from the faulted process. I have a custom java logger that uses the locator API, but I'm finding out that this will only work if the process has been persisted to the dehydration store. Is there another way to get the payload? I know I can use checkpoint/wait within the bpel process to force dehydration but I'm looking for another alternative

    The problem is the cube instance table has not been populated yet for the instance. So from a faulted instance that has NOT been dehydrated to cube instance, how will I get to the invoke_message table, or how will I get the payload from the faulted instance.
    I'm able to get the document fine when the cube_instance table is populated, my problem is sometimes the instance has not been dehydrated and cube_instance is not available. So from a faulted instance how will I get to the invoke_message table without using the cube_instance table

  • Java.lang.process.execute()

    Java.lang.process.execute() is throwing an exception with string �Cannot allocate memory� ...
    what is the cause of this exception and give me the solution
    plz help
    Nilesh

    882590 wrote:
    Is it possible to use the java.lang.ProcessBuilder to execute a Java process pointing it to jvm.dll instead of java.exe? I'm using the JavaFX self contained application packaging and it creates a runtime/jre/bin directory that contains jvm.dll, but not java.exe.I don't get the line of questioning of this thread. If you're using the JavaFX stuff the answer must lie in the JavaFX documentation. It seems to indicate that it generates an executable of its own which will likely wrap the jvm DLL, so you should be invoking the generated executable in ProcessBuilder.
    http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm

  • My UR12 Steinberg interface is recognized by Yosemite but I can't get any output from the device, does anyone know how to fix this problem? Thanks in advance

    My UR12 Steinberg interface is recognized by Yosemite but I can't get any output from the device, does anyone know how to fix this problem? Thanks in advance

    Apparently it's related to the Firefox plug in.
    This isn't exactly a solution but more of a way to avoid opening PDFs with Firefox's plug in.
    1. Highlight "Tools" from the Menu Bar in the top left of the screen (or click "Options" if using the Firefox Compact Menu)
    2. Select to "Options
    3. Select "Applications"
    4. Look for "Adobe Acrobat Document" under Content Type and to the right under Action select "Use Adobe Reader (default)" instead of the using Adobe Acrobat in Firefox
    5. Open a test PDF. It should open in it's own window now.
    Again, not a complete solution but something that'll at least let you scroll with PDFs open.
    More info here: http://forums.mozillazine.org/viewtopic.php?f=38&t=2171033

  • Unbale to get complete output as some field are missing in z t-code.

    Respected Guru's,
    i am tring to get output from a customized t-code.
    While executing the report in background,  i mention customized format as the exsisting format does not match.
    But i  am the unbale to get complete output as some field are missing.
    Please help me, i have tried change the no of rows and coloums, but no effect.
    Regards,
    Daya

    Hi,
    Please try with printer settings and used different printer formats.
    Actully this problem because of printers configration which is used for backgound reports.
    Regards,
    Ravi

  • Java.lang.Process.exec()

    I have read a article about the "java.lang.Process.exec()" (url:http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html)
    Having some questions with the example in it.
    The example code:
    import java.util.*;
    import java.io.*;
    public class BadExecJavac
        public static void main(String args[])
            try
                Runtime rt = Runtime.getRuntime();
                Process proc = rt.exec("javac");
                //int exitVal = proc.exitValue();
                int exitVal = proc.waitFor();
                System.out.println("Process exitValue: " + exitVal);
            } catch (Throwable t)
                t.printStackTrace();
    }The process can run but never complete.
    Why? Just because when invoke the javac.exe without any argument,it will product a set of usage statements that describe how to run the program and the meaning of all the available program options.So the process is in deadlock.
    The question is, when i change the exec("javac") to exec("javac a.java"), in which the "a.java" is not exist, so the jvm should product error:
    error: cannot read: a.java
    1 error
    But after i changed the code and run the class, at this time the process can run and complete.
    The two codes both product some statements,but why the first one never complete,but the second did. Why?

    import java.util.*;
    import java.io.*;
    public class A
        public static void main(String args[])
            try
                Runtime rt = Runtime.getRuntime();
                Process proc = rt.exec("javac");
                InputStream is = proc.getErrorStream();
                int i=0;
                while ((i = is.read()) != -1)
                    System.out.print((char)i);
                // int exitVal = proc.exitValue();
                // int exitVal = proc.waitFor();
                // System.out.println("Process exitValue: " + exitVal);
            } catch (Throwable t)
                t.printStackTrace();
    }usng this modification, i could see some error messages.
    because exec(cmd) executes the command in a separate process, it will not display the results on the current console. If you want see the results, you should use getInputStream() and getErrorStream().
    good luch ^^

  • Problem with starting a sqlplus-process via java.lang.Process

    Hi,
    I want to start a sqlplus-Process from a java-application via java.lang.Process. Works great with XP. On a W2K-Machine, the process is started (I can see it in the Taskmanager), but it doesn't connect to the db - the OS-process hangs, also the java-application which invoked the process.
    If I start a sqlplusw.exe-Process instead of sqlplus.exe, it works as well.
    Does anybody know what's going wrong ?
    I'm using java 1.5.0_11 and Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
    Thanks in advance
    Jens

    java.lang.Process can be used to perform an OS Shell to launch specific tasks. But why are you interested in specifically launching sqlplus from here?
    ~ Madrid
    http://hrivera99.blogspot.com/

  • Invoke a FTP "Get File" operation throws java.lang.ClassCastException:

    Hi there,
    I am working on a very simple sample project that will pull the file from a ftp site. I create a partner link with FTP adpater with "Get File" operation.
    When I deploy and run the SIMPLE project, it throws the following exception.
    I am wondering if any of you experienced the same problem and how to resolve the issue. Your help will be greatly appreciated.
    Here is the error message:
    <messages><input><Invoke_1_Get_InputVariable><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Root-Element"><Root-Element xmlns="http://TargetNamespace.com/ftp_service"/>
    </part></Invoke_1_Get_InputVariable></input><fault><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>file:/C:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_FTPProcess2_1.0_709914d835a81c407ed668866e080b9e.tmp/ftp_service.wsdl [ Get_ptt::Get(Root-Element) ] - WSIF JCA Execute of operation 'Get' failed due to: Could not instantiate InteractionSpec oracle.tip.adapter.ftp.inbound.FTPActivationSpec due to: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         java.lang.ClassCastException: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         org.collaxa.thirdparty.apache.wsif.WSIFException: Could not instantiate InteractionSpec oracle.tip.adapter.ftp.inbound.FTPActivationSpec due to: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         java.lang.ClassCastException: oracle.tip.adapter.ftp.inbound.FTPActivationSpec</summary>
    </part><part name="detail"><detail>org.collaxa.thirdparty.apache.wsif.WSIFException: Could not instantiate InteractionSpec oracle.tip.adapter.ftp.inbound.FTPActivationSpec due to: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         java.lang.ClassCastException: oracle.tip.adapter.ftp.inbound.FTPActivationSpec</detail>
    </part></bindingFault></fault></messages>

    Take a look at the stack trace, it shows you exactly where the error is coming from:
    java.lang.ClassCastException: org.theclass.candidate.view.SearchForm
    org.theclass.candidate.view.CandidateListAction.execute(CandidateListAction.java:41)Line 41 in your CandidateListAction.
    Probably it is failing on a cast of your action form.
    Taking a closer look at your struts-config, you are "chaining" actions.
    Your AddCandidateAction uses the candidateForm, and forwards to CandidateListAction.do
    Your CandidateListAction uses the searchForm.
    That will be the cause of your class cast exception.
    <action path="/Add"
      name="candidateForm"
      type="org.theclass.candidate.view.AddCandidateAction"
      validate ="true"
      input="/jsp/addcandidate.jsp">
      <forward name="success" path="/CandidateList.do"/>
    </action>
    <action path="/CandidateList"
    type="org.theclass.candidate.view.CandidateListAction"
    name="searchForm"
    scope="request" >
    <forward name="failure" path="/jsp/list.jsp"/>
    <forward name="success" path="/jsp/candidatelist.jsp"/>
    </action>Check out: http://struts.apache.org/1.x/faqs/newbie.html#chaining
    Solutions?
    - don't chain actions ;-)
    - use the same action form for both actions (possible?)
    - make the actionForward a "redirect" one. That means a new request, and losing any request parameters/attributes but should prevent this class cast exception.
    Hope this helps,
    evnafets

  • Problwm with java.lang.Process

    I am using java.lang.Process to read the output of a command, it works fine with one word commands such as "ls", but a command with a pipe and and arguments returns no output, for example "who | grep root".
    Any ideas!

    for example "who | grep root".
    Any ideas! Probably because you really should have nothing returned. Try to give the output of the first command as an input to the second one but not through a pipe; use java.lang.Process twice.

  • Getting a  BEA-000802   java.lang.ClassCastException: in cluster mode only

    Guys ,
              I get a <BEA-000802> java.lang.ClassCastException in cluster mode , but works fine on a local instance. Please take a look at the stack trace below .
              <Error> <Kernel> <BEA-000802> <ExecuteRequest failed
              java.lang.ClassCastException: cannot assign instance of com.ibm.ie.web.presentation.IEPresentationCommandProcessor_814_WLStub to field com.ibm.web.servlet.Environment.presentationCommandProcessor of type com.ibm.web.presentation.PresentationCommandProcessor in instance of com.ibm.ie.web.servlet.IEEnvironment.
              java.lang.ClassCastException: cannot assign instance of com.ibm.ie.web.presentation.IEPresentationCommandProcessor_814_WLStub to field com.ibm.web.servlet.Environment.presentationCommandProcessor of type com.ibm.web.presentation.PresentationCommandProcessor in instance of com.ibm.ie.web.servlet.IEEnvironment
                   at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
                   at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:137)
                   at weblogic.cluster.replication.ReplicationManager_814_WLStub.update(Unknown Source)
                   at weblogic.cluster.replication.ReplicationManager.updateSecondary(ReplicationManager.java:775)
                   at weblogic.servlet.internal.session.ReplicatedSessionData.syncSession(ReplicatedSessionData.java:490)
                   at weblogic.servlet.internal.session.ReplicatedSessionContext.sync(ReplicatedSessionContext.java:183)
                   at weblogic.servlet.internal.ServletRequestImpl.syncSession(ServletRequestImpl.java:2484)
                   at weblogic.servlet.internal.ServletRequestImpl.syncSession(ServletRequestImpl.java:2469)
                   at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3782)
                   at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
              Caused by: java.lang.ClassCastException: cannot assign instance of com.ibm.ie.web.presentation.IEPresentationCommandProcessor_814_WLStub to field com.ibm.web.servlet.Environment.presentationCommandProcessor of type com.ibm.web.presentation.PresentationCommandProcessor in instance of com.ibm.ie.web.servlet.IEEnvironment
                   at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:1885)
                   at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1076)
                   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1851)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1603)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1271)
                   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
                   at java.util.HashMap.readObject(HashMap.java:1006)
                   at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:324)
                   at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
                   at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:120)
                   at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:120)
                   at weblogic.cluster.replication.ReplicationManager_WLSkel.invoke(Unknown Source)
                   at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
                   at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
                   at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
                   at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
                   at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
                   at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
              Please advise , would be of help ..
              thanks a lot for taking a look
              s

    ####<Jan 19, 2007 2:55:00 AM CST> <Error> <Kernel> <bocephus.aus.lab.vignette.com> <Preview2DPMSrv> <ExecuteThread: '14' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-000802> <ExecuteRequest failed
              java.lang.ClassCastException.
              java.lang.Throwable
                   at weblogic.servlet.internal.session.ReplicatedSessionContext.sync(ReplicatedSessionContext.java:175)
                   at weblogic.servlet.internal.ServletRequestImpl.syncSession(ServletRequestImpl.java:2581)
                   at weblogic.servlet.internal.ServletRequestImpl.syncSession(ServletRequestImpl.java:2566)
                   at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3920)
                   at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
              >
              ####<Jan 19, 2007 2:55:12 AM CST> <Error> <Kernel> <bocephus.aus.lab.vignette.com> <Preview2DPMSrv> <ExecuteThread: '14' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-000802> <ExecuteRequest failed
              java.lang.ClassCastException.
              java.lang.Throwable
                   at weblogic.servlet.internal.session.ReplicatedSessionContext.sync(ReplicatedSessionContext.java:175)
                   at weblogic.servlet.internal.ServletRequestImpl.syncSession(ServletRequestImpl.java:2581)
                   at weblogic.servlet.internal.ServletRequestImpl.syncSession(ServletRequestImpl.java:2566)
                   at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3920)
                   at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
              I am getting these logs in domain.
              How to solve this problem.
              Thanks
              Somashekar

  • Help! How to convert an instance from java.lang.Object to a particula class

    * How to convert an instance from java.lang.Object class to a particular class
    witch is known only at the running time?
    Roster EJB component is make up of RosterHome, Roster and RosterBean.
    RosterHome is the home interface of Roster EJB.
    Roster is the remote interface of Roster EJB.
    RosterBean is the implement of Roster EJB.
    The following code segment is to invoke Roster EJB component.
    String jndiName="roster.RosterHome";
    javax.naming.Context initial = getInitialContext();//getInitialContext() returns a instance of Context.
    Object objref = initial.lookup(jndiName);
    RosterHome home =
    (RosterHome)javax.rmi.PortableRemoteObject.narrow(objref,
    RosterHome.class);
    Roster myRoster = home.create();
    String team="T1"
    String player="Tom"
    myRoster.addPlayer(player,team);
    But, now, all the home interface, the remote interface and the JNDI Name of
    Roster EJB component are not been known at the compiling time. However They are
    known at the running time, throught reading from the XML config file.
    Questions:
    1,How to write code for this case ? or
    2,How to convert an instance from Object class to a particular class witch is known
    only at the running time?
    String jndiName="roster.RosterHome";// in fact, reads from XML file.
    String homeClassName="roster.RosterHome";// in fact, reads from XML file.
    String remoteClassName="roster.Roster";// in fact, reads from XML file.
    javax.naming.Context initial = getInitialContext();//getInitialContext() returns a instance of Context.
    Object objref = initial.lookup(jndiName);
    Object objHome= javax.rmi.PortableRemoteObject.narrow(objref,
    Class.forName(homeClassName));
    /* how to do next?
    }

    I am not sure what you are trying to do. But at some point you should know which methods to call on the remote interfaces. Maybe the method names are stored in the XML file as well or you have a set of standard method names (also consider parameters).
    However, this can be solved by reflection. Look at the java.lang.reflect package, especially java.lang.reflect.Method, and also at java.lang.Class.
    If you are doing this on the app server:
    I've seen posts where people say that reflection is not permitted in EJB, but I don't think so. Check the EJB spec.
    If you are doing this in an application: reflection is always permitted. Probably also in applets and JSP.

Maybe you are looking for

  • Exception when loading an image in ImageIcon component

    Hello, I want to load an image whose name or path contains special character such as accents (a french name). So that generates an exception. For exemple for an image named caf�.jpeg I obtain this message : java.io.FileNotFoundException: /media/disk/

  • How to show content in a pdf file on swf

    I have a project Flash, that i want show content in a pdf file on swf file, but i don't know to show it So, who body help me ? Thanks!

  • Firefox Sync can't connect behind Zscaler proxy

    Last week the enterprise I work in changed their proxy to a Zscaler one. With the previous proxy I could use Firefox Sync without any trouble but since that it seems I can't use Sync anymore. The error that shows says "Sync encountered an error while

  • Special Stock types

    Hi, Can any one explain what are all the special stock types and signifcance of them. How are they useful for business purposes. I understand that Project stock is for specific project, and also consignment stock. Pls explain me in detail. Thnx

  • Port definition

    Apologies if this seems a stupid question but I'm left with a system that's a bit wonky and I need to find out how to fix it. 1) In httpd.conf (Apache/Apache/conf) we have a) Port 7777 Listen 7778 as per expected and shown in document 256923.1 b) In