Problem reading objects

Hi i am trying to read objects from i file i have written them to but cannot seem to get it goint any suggestions here are two errors but i am sure their are more
---------- javac ----------
C:\university_class_work\cosc1309\Assignments\Assignment1\Bin2Text.java:26: incompatible types
found : java.lang.Object
required: java.io.ObjectInputStream
while ((ins = ins.readObject()) != null) {
^
C:\university_class_work\cosc1309\Assignments\Assignment1\Bin2Text.java:32: cannot resolve symbol
symbol : method flush ()
location: class java.io.ObjectInputStream
ins.flush ();
^
2 errors
Normal Termination
Output completed (1 sec consumed).
import java.util.*;
import java.text.*;
import java.io.*;
// Bin2Text.java
// Assignment1
// Created by dragon on Sun Mar 09 2003.
// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
public class Bin2Text implements Serializable {
public static void main(String[] args) throws IOException{
String name;
//PrintWriter out = null;
Text2Bin p2b = new Text2Bin();
StringTokenizer words = null;
String line;
try {
PrintWriter out = new PrintWriter (new BufferedWriter (new FileWriter ("out.txt")));
FileInputStream in = new FileInputStream ("in.bin");
ObjectInputStream ins = new ObjectInputStream (in);
while ((ins = ins.readObject()) != null) {
PizzaEater myPizzaEater = new PizzaEater();
ins.readObject(myPizzaEater);
out.write (myPizzaEater);
ins.reset ();
ins.flush ();
ins.close();
out.close ();
catch (IOException ioe) {
System.out.println(ioe.getMessage());
catch (NegativeNumberException nne) {
System.out.println ("NegativeNumberException message was: " +
nne.getMessage());
class NegativeNumberException extends Exception {
* Default constructor setting NegativeNumberException to the default
* as specified by API reference Exception
public NegativeNumberException () {
super();
* a Constructor passing the number value of the exception and
* returning it with feedback
public NegativeNumberException (int slices) {
super("Number entered: " + slices + " number must be positive.");
}

Hi i am trying to read objects from i file i have
written them to but cannot seem to get it goint any
suggestions here are two errors but i am sure their
are more
---------- javac ----------
C:\university_class_work\cosc1309\Assignments\Assignmen
1\Bin2Text.java:26: incompatible types
found : java.lang.Object
required: java.io.ObjectInputStream
while ((ins = ins.readObject()) != null) {
^I'm not sure what you're trying to do exactly, I think its retrieve the next object from ObjectInputStream, you'd probably want to use another variable of type Object
C:\university_class_work\cosc1309\Assignments\Assignmen
1\Bin2Text.java:32: cannot resolve symbol
symbol : method flush ()
location: class java.io.ObjectInputStream
ins.flush ();
^
2 errors
Normal TerminationNo flush() for InputStream objects.
Output completed (1 sec consumed).
import java.util.*;
import java.text.*;
import java.io.*;
// Bin2Text.java
// Assignment1
// Created by dragon on Sun Mar 09 2003.
// Copyright (c) 2003 __MyCompanyName__. All rights
reserved.
public class Bin2Text implements Serializable {
public static void main(String[] args) throws
ws IOException{
String name;
//PrintWriter out = null;
Text2Bin p2b = new Text2Bin();
StringTokenizer words = null;
String line;
try {
PrintWriter out = new PrintWriter (new
r (new BufferedWriter (new FileWriter ("out.txt")));
FileInputStream in = new FileInputStream
Stream ("in.bin");
ObjectInputStream ins = new ObjectInputStream
Stream (in);
while ((ins = ins.readObject()) != null) {
PizzaEater myPizzaEater = new
Eater = new PizzaEater();
ins.readObject(myPizzaEater);
out.write (myPizzaEater);
ins.reset ();
ins.flush ();
ins.close();
out.close ();
catch (IOException ioe) {
System.out.println(ioe.getMessage());
catch (NegativeNumberException nne) {
System.out.println ("NegativeNumberException
xception message was: " +
nne.getMessage());
class NegativeNumberException extends Exception {
* Default constructor setting
ing NegativeNumberException to the default
* as specified by API reference Exception
public NegativeNumberException () {
super();
* a Constructor passing the number value of the
the exception and
* returning it with feedback
public NegativeNumberException (int slices) {
super("Number entered: " + slices + " number must
st be positive.");

Similar Messages

  • Problem reading object via sockets

    Hi All
    I've the following class which I initialize and sent to differnet clients:
    public class ParameterDisplay  implements Serializable {
         public int current;
         public int[][][] deck = null;
         public int[][][] onTable;
         public String names[];
         public int human = -1;
         public int[] length;   
         public int[] tlength;     
         public int centerImg = -1;
         public ParameterDisplay() {}
    }The problem is that when a client reads this object all information in deck is lost!!!!
    The array names is ok
    Any suggestions what is the problem here???
    Thanks in advance
    Luca

    Hi
    I've rewritten some code and the problem didn't occure this time??!!
    Futhermore there is too much code to show here, also to many places where it might go wrong I think.
    So what I will do now is, rebuild the program an keep an eye on the Socket part during the whole process!!
    Luca
    ps writing games isn't so easy as I expected :)

  • Problem reading RFC values from IRecordSet !!!!

    Hi All,
    I am having some problem reading values from IRecordSet. Can not seem to parse the output structure from RFC. AM using connector gateway service to execute BAPI_EXCHRATE_GETCURRENTRATES.
    Here is the code,
    MappedRecord input = rf.createMappedRecord("input");
    input.put("DATE",new String("01011990"));
    input.put("DATE_TYPE", new String("V"));
    input.put("RATE_TYPE", new String("M"));
    MappedRecord output = (MappedRecord) ix.execute(ixspec, input);
    Object rs = null;
    IRecordSet recSet = null;
    Object result = output.get("EXCH_RATE_LIST");
    if (result == null) {
    response.write("<BR>null");
    rs = new String(" ");
    } else if (result instanceof IRecordSet) {
    IRecordSet irs = (IRecordSet) result;
    response.write("<BR>Got some dataaa");
    IRecordMetaData rsmd = null;
    rsmd = irs.retrieveMetaData();
    irs.beforeFirst();
    while(irs.next()){
    response.write("Row::"+irs.getString("RATE_TYPE")+" "+irs.getString("FROM_CURR")+" "+irs.getString("EXCH_RATE"));
    Am getting the pritn statement, Got Some Data on the PDK component.
    But somehow not able to read the values from IRecordSet
    What is the mistake here?
    Pls help
    Edited by: Aakash Jain on Oct 11, 2008 12:22 AM

    Hi
    Try in this way.
    IRecordSet resultTable = (IRecordSet)outputParams.get("TABLE_NAME");
    for(resultTable.beforeFirst(); resultTable.next(); ) {
    response.write(resultTable.getString(0));
    response.write(resultTable.getString(1));
    Thanks

  • There was a problem reading this document (109) on Japanese PC

    We have an app written with Delphi 2006 and using Rave Reports to generate PDFs.  A Japanese user of our software cannot open the PDFs (with Acrobat reader) our software produces when they run our software on a Japanese version of Windows (probably Win7). I have the same problem if I try to open the same PDF (which they have sent us) with Acrobat reader on an English-language Win XP machine :
    There was an error processing a page. There was a problem reading this document (109)..
    Ctrl-OK produces "object label badly formatted"
    PDF files produced on English installations of our software read fine on our PCs and on the Japanese user's PC
    Does anyone have any idea where this error is coming from?
    Thanks,
    Ross

    Hi Pat,
    Thanks for looking at this.
    Yes, there are almost certainly Japanese characters.  If you look at the second (readable) version I sent you can see where part of the date has been rendered incorrectly - this is because they have their regional settings arranged so that the Japanese year character is used, and the version of Delphi we use doesn't support those multibyte characters.
    It seems unreasonable for Acrobat Reader to choke on this however. 
    Here'a binary dump of the relevant part of the file

  • Error : There was a problem reading this document (15)

    Hi All,
    I created a PDF using a code which I had. But when I open in Adobe reader, I am getting this message "there was a problem reading this document (15)". If I do control+Enter for this message, I get the message "Expected an array object". Can anyone please help me in understanding what in the PDF file has one wrong. I opened the PDF in binary editor and everything seems to be fine for me. I have uploaded the PDF. Link is
    http://dl.dropbox.com/u/35847649/out.pdf
    Thanks,
    Sham

    Can you guys please tell me when reader is expected to give this error message?
    "There was a problem reading this document (15)"
    Thanks,
    Sham

  • After 11.0.10 update Save as gives the error "there was a problem reading this document (21)"

    We have some PDF reports that are generated from Microsoft Dynamcs AX.
    When we try to "Save as" we get an error.
    The client PCs that have Reader 11.0.08 do not have any problems.
    The PCs that have Reader 11.0.10 give the following messages on save as:
    "The document could not be saved. There was a problem reading this document (21)"
    when I click OK to that error I get "Out of memory error"
    I read that holding down CTRL when clicking OK would give additional information, and it told me this: "This direct object already has a container"
    No older versions of Reader have had any problems with these same PDF files.

    Yes, we have it on multiple documents. As mentioned, they are reports that are generated from Microsoft Dynamcs AX. I have found out that not all reports get the error. PDFs from Office or  Autodesk AutoCAD do not get the error.
    These are the errors it displays:

  • Server hangs up when tryin to read object Urgent Help Plz

    Hi,
    I've been working on a client-server model for a while, I've tested my applicaction a thousand of times locally (I mean, server and serveral clients running on the same machine) and it's ok, now I finally run server in a remote host and I find it rarely works fine, most of the times server hangs up when tryin to read objects I dont know why.
    this is the part of the server-code where the problem begins:
    public int EscucharSocket(){
            Socket cliente = null;
            System.out.println("Servidor en escucha...\n");
            while(true){
                try{
                    cliente = SocketS.accept();
                    //I get client's ip and port
                    String ip = cliente.getInetAddress().getHostAddress();
                    int puerto = cliente.getPort();
                    //After the conexion is made, server reads a signature to
                    //identify the client
                   //in function process I check if the signature is valid
                   //SignedData is a class where I wrap the signiture (obviously
                   //it implements Serializable interface
                   process((SignedData)le.LeerObject(cliente));
                   //Other things done here
                catch (Exception e) { }
    }le is a class I use to read,write data to the socket, this is the code of the LeerObject function
    public Object LeerObject(Socket c) throws Exception {
           //Here Is where the server hangs up
            ObjectInputStream b = new ObjectInputStream(c.getInputStream());
            return b.readObject();
    }As I wrote when running locally, there is no problem, but when I have a remote host, that happens
    Any help or idea?

    Hi again, thnx for your help
    I modified my LE class so I just create a couple of Input/Output Streams per client (on server n client program), this is now the complete code of the class:
    import java.net.*;
    import java.io.*;
    public class LE {
        DataOutputStream     dos;
        ObjectOutputStream  oos;
        DataInputStream        dis;
        ObjectInputStream     ois;
        //Streams are created just once in the constructor
        public LE (Socket s) throws Exception {
            dos = new DataOutputStream(s.getOutputStream());
             //I'm not sure if this flush has any sense
            dos.flush();
            oos = new ObjectOutputStream (s.getOutputStream());
            oos.flush();
            dis = new DataInputStream(s.getInputStream());
            ois = new ObjectInputStream (s.getInputStream());
        public void EscribirByte(byte datos[],int len) throws Exception {
            dos.write(datos,0,len);
            dos.flush();
        public void EscribirString(String dato) throws Exception {
            dos.writeUTF(dato);
            dos.flush();
        public void EscribirChar(char dato) throws Exception {
            dos.writeChar(dato);
            dos.flush();       
        public void EscribirInt(int dato) throws Exception {
            dos.writeInt(dato);
            dos.flush();
        public void EscribirLong(long dato) throws Exception {
            dos.writeLong(dato);
            dos.flush();
        public void EscribirObject(Object dato) throws Exception {
            oos.writeObject(dato);
            oos.flush();
        public String LeerString() throws Exception {       
            return dis.readUTF();
        public int LeerInt() throws Exception {       
            return dis.readInt();
        public char LeerChar() throws Exception {       
            return dis.readChar();
        public long LeerLong() throws Exception {       
            return dis.readLong();
        public Object LeerObject() throws Exception {       
            return ois.readObject();
    }part of code of server and client, where the conexion is made and the LE object is created
    Server:
    try{
           cliente = SocketS.accept();               
           //After accepting the conexion the LE object is created
            le = new LE(cliente);
            //I get client's ip and port
            String ip = cliente.getInetAddress().getHostAddress();
            int puerto = cliente.getPort();
            //Object wraping signature is read        
            process((SignedData)le.LeerObject());
            //other control operations doing here
            //A thread is created to receive requests from client
            //(reference to LE object is passed to the thread
           ConexionCliente c = new ConexionCliente (cliente,id_persona,id_grupo,tipo_usuario,backup,le);                               
            //thread is started
            c.start();
    catch (Exception e) {
        try {
            cliente.close();
        catch(Exception e2){}
    }Cliente code:
    try{
       //it connects to the server
       c=new Socket(host,puerto);
       //After accepting the conexion the LE object is created         
       le = new LE(c);
       //other things made here to genarate SignedData Object
      //It sends signed data object
      le.EscribirObject(Data);          
      //A thread is created and started to receive messages from server
      //reference to object LE is sent to the thread to avoid the need of
      //creating another
      new ConexionServidorClient(c,id_persona,ci,le).start();
      return 1;
    catch(Exception e) {
       return -1;
    }after the change, itworks a little better, but still most of the times server hangs up, I can't make server operational yet and I dont have any idea for solving this issue

  • Problems transporting objects from DEV to QAS

    Hi everyone,
    I have a problem trying to transport objects from an environment to another (DEV to QA) in XI. The issue is that the objects that were transported can't be visualized in the namespace; I checked the server log and it shows:
    #2.0 #2011 04 12 14:48:55:730#0-500#Error#com.sap.aii.ibdir.server.abapcache.mapping.CacheMessageMappings#
    #BC-XI#com.sap.xi.util.misc#002264940005022700000004000046FF#109943550000000004#sap.com/com.sap.xi.directory#com.sap.aii.ibdir.server.abapcache.mapping.CacheMessageMappings#PIISUSER#460#SAP J2EE Engine JTA Transaction : [6ffffff8dffffff9afffffffe0021ffffffd4]#0022649400051EE099A790C205DA1100#4DA4A4D6A0904660E1000000AC1D0177#AC1D017746594DA4AC8E000100000000#1#Thread[HTTP Worker [@678875548],5,Dedicated_Application_Thread]#Java##
    error - some message mappings could not be read
    Thrown:
    com.sap.aii.ib.core.roa.RoaMultiObjectAccessException: Attempt to access the 10 requested objects on 10 failed. Detailed information:
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_CreateRequestSPLocalTotalSales | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_CreateRequestSPLocalTotalSales | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_InsertTableVentaTotal_response | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_InsertTableVentaTotal_response | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_SaveFileProcessesTotalSales | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_SaveFileProcessesTotalSales | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_CheckDateProcessesResponse_To_StatementVentaTotal | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_CheckDateProcessesResponse_To_StatementVentaTotal | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_CheckDateProcessesByStore | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_CheckDateProcessesByStore | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_CalculateFileProcesses | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_CalculateFileProcesses | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_ExecuteSPLocalTotalVenta | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_ExecuteSPLocalTotalVenta | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_TiendaPOS_To_InsertUpdateTotalSales | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_TiendaPOS_To_InsertUpdateTotalSales | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_CheckDateByStore_Response | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_CheckDateByStore_Response | http://spsa.com/POS/TotalSales not found
    com.sap.aii.ib.core.roa.RoaObjectAccessException: Attempt to read object Message Mapping mm_SPLocalTotalVenta_response | http://spsa.com/POS/TotalSales, type XI_TRAFO from application REPOSITORY on system REPOSITORY failed. Object does not exist. Detailed informatio n: Object Message Mapping mm_SPLocalTotalVenta_response | http://spsa.com/POS/TotalSales not found
         at com.sap.aii.ib.core.roa.RoaMultiObjectAccessException.newObjectAccessNotCompleted(RoaMultiObjectAccessException.java:98)
         at com.sap.aii.ib.core.roa.RoaServiceImpl.createObjectArrayFromRoaOutput(RoaServiceImpl.java:351)
         at com.sap.aii.ib.core.roa.RoaServiceImpl.readObjectsImpl(RoaServiceImpl.java:256)
         at com.sap.aii.ib.core.roa.RoaServiceImpl.readObjects(RoaServiceImpl.java:367)
         at com.sap.aii.ibdir.server.abapcache.mapping.CacheMessageMappings.addContent(CacheMessageMappings.java:104)
         at com.sap.aii.ibdir.server.abapcache.mapping.CacheMessageMappings.addContent(CacheMessageMappings.java:66)
         at com.sap.aii.ibdir.server.abapcache.CacheRefreshRequest.addContent(CacheRefreshRequest.java:480)
         at com.sap.aii.ibdir.server.abapcache.CacheRefreshRequest.processHTTPRequest(CacheRefreshRequest.java:210)
         at com.sap.aii.ibdir.server.abapcache.CacheRefreshRequest.handleHTTPRequest(CacheRefreshRequest.java:135)
         at com.sap.aii.ibdir.server.abapcache.HmiMethod_CacheRefresh.process(HmiMethod_CacheRefresh.java:70)
         at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:167)
         at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:212)
         at com.sap.aii.utilxi.hmis.sbeans.HmisBeanImpl.process(HmisBeanImpl.java:98)
         at sun.reflect.GeneratedMethodAccessor375.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:46)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
         at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
         at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
         at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
         at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
         at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
         at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
         at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
         at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
         at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
         at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
         at $Proxy1696.process(Unknown Source)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:331)
         at com.sap.aii.utilxi.hmis.web.workers.HmisExternalClient.doWork(HmisExternalClient.java:100)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:532)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doGet(HmisServletImpl.java:676)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:162)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:81)
         at com.sap.engine.services.servlets_jsp.server.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:124)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:73)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:461)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:298)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:396)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:385)
         at com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:48)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:76)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:243)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:78)
         at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
         at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.MemoryStatisticFilter.process(MemoryStatisticFilter.java:43)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.DSRHttpFilter.process(DSRHttpFilter.java:42)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:428)
         at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:247)
         at com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:45)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:115)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:96)
         at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:314)
    I hope anyone can help me with this.
    Regards,
    Julio

    Hi,
    The problem is that I can't transport any object (Datatypes, message types, service interface, message mapping, etc.) in XI from DEV to QAS.
    I did all the steps to transport objects:
    1. Export the objects from XI-DEV
    2. Import them in XI-QAS
    3. A message of successfull import is shown; however the objects can't be visualized. When I check the log it shows the message that I copied in my previous post.
    Hope you can help me.
    Thanks.

  • Write / read objects to/from File

    Hello,
    I have a problem with the writing and reading objects to/from a file.
    So what excatly I'm trying to is:
    I have a class Data. A thread creates constantly (until some limit) objects of this class Data.
    Once an object is created, is placed in a buffer (I wrote my own class DataBuffer extention of LinkedList).
    I have a limit on this buffer, so when the limit is reached, another thread starts getings objects from the buffer, writes them on the disk and removing them from the buffer.
    I'm putting the object always on the "top" and I'm reading them and removing always from the "bottom" of the buffer (FIFO).
    For writing the objects Data to the file, I'm using a FileOutputStream and ObjectOutputStream:
    I have something like that:
    FileOutputStream fos = new FileOutputStrea("file_name");
    ObjectOutputStream oos = new ObjectOutputStream(fos);after that I have this:
    while(size > i ){
                        try {
                             Data d = buff.getData();
                             //write to File
                             oos.writeObject(buff.getData());
                             oos.flush();
                             buff.removeData();
                             System.out.println("written data " + d);
                             i++;
                        } catch (IOException e) {
                             e.printStackTrace();
                   }here size is the limit for the buffer.
    So, when the size is equal to the total number of objects that were created and placed in the buffer, I have no problems with the writing/reading from the file.
    But if size is equal, for example, to the half of the total number of objects that were created, I have a problem.
    A more detailed exmple is:
    10 objects were created, the 10 objects were places to the buffer, a test was made and all the objects were written on the disk -> writing and reading are OK.
    if 10 objects were created, and I want to write 5 objects, and after that more 5, the first thing I remarqued is that the size of the file is different from the size of the file created by the first method. Second thing is when I'm reading from the file I can read only 5 objects and after that I have this exception:
    java.io.StreamCorruptedException : invalid type code : AC
    So ... is anyone has an idea why I have this problem?
    PS. For reading from the file I'm using another thread that executes this code:
    fis = new FileInputStream(readFile);
                        ois = new ObjectInputStream(fis);
                        while(true){
                             try{
                                  Data d = (Data)ois.readObject();
                                  System.out.println("data read " + d); //here I'm displaying the object that was read
                                  buff.putData(d);
                             }catch(EOFException e){
                                  break;
                        ois.close();
                        fis.close();
                   }catch (FileNotFoundException e) {
                        e.printStackTrace();
                   }catch(IOException e){
                        e.printStackTrace();
                   }catch (ClassNotFoundException e) {
                        e.printStackTrace();
                   }Regards,
    Anton
    PS. At present I'm writing first all the Data objects, and after that I'm trying to read from the file.
    Edited by: anton_tonev on Oct 5, 2007 4:14 AM

    Hello again :)
    Finally I found the solution :)
    In fact it is important to not to close the FileOutputStream and ObjectOutputStream until all the data was written on the disk.
    What I mean:
    in the begining of the program you have to open these two streams and write down the data that comes from somewhere.
    But you musn't close these streams before the final writing on the disk.
    It must look like this:
    1 Open file stream & opent object stream
    2 you're writing your all objects: one by one; 10 by 10 or as you wish ... but after each writing down you don't close the streams
    3 you already finished with the writing, (the end of your program), now you can close the streams.
    Unfortunatly I don't know why if I write the data and close the stream every time, after that it is impossible to append new data (with reopen the file)

  • Reading Objects using NIO

    I having problems reading an object using NIO APIs. I am end creating an Object and pass it through a socket. When I retrieve the data from the input stream within the socket I initialize a ByteBuffer by allocating a length. The problem is that there is NO way of knowing what to allocate that ByteBuffer when reading in the object. Below is within a method that allows me to read information from the socket.
    //Allocate the length ByteBuffer.
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    //Read the data from the SocketChannel....PROBLEM IS WHAT IF I NEED TO DO MULTIPLE READS
    socketChannel.read(buffer);
    ///We will create a byte array from the ByteBuffer.
    byte[] b = buffer.array();
    //ByteArrayInputStream that we will create and put the byte array in.
    ByteArrayInputStream bis = new ByteArrayInputStream(b);
    //ObjectInputStream where we will use the ByteArrayInputStream.
    ObjectInputStream input = new ObjectInputStream(bis);
    //Object that we will read in.
    Object obj = input.readObject();
    //Message that we will end up receiving.     
    Message receivingMsg = null;
    //Once we have our Message we will end up closing the connection.
    bis.close();
    input.close();
    //We will clear the buffer.
    buffer.clear();
    //We will cast the object to a message object so
    //that we can end up sending it through the right
    //routine which will allow us to send a response
    //back to the client. *********SPECIAL Class that will cast our generic object into a Message Object.
    Message receivedFromClient = (Message) obj;
    //we will end up taking that message and returning it.
    Message returningMsg = communicate(receivedFromClient);
    //Here we will end up taking the Message and putting it into the ByteBuffer.          
    ByteBuffer bb = objectToOutputStreamByteBuffer(returningMsg);
    socketChannel.write(bb);
    ----The problem is if I have more data within that Object. I need to re-allocate the ByteBuffer object and read everything on that socket. I tried the following code but I really don't feel it will be optimized the best for performance. I guess my question is that should I even be using NIO in this situation or Blocking IO?
    Again, here is the code that will read multiple data from the socket until it is -1.
    //Here we will read the information we received by first allocating
    //a ByteBuffer object.
    ByteBuffer buffer1 = ByteBuffer.allocate(5);
    ByteBuffer buffer2 = ByteBuffer.allocate(0);
    //We will read the data from this object.
    while ((socketChannel.read(buffer1)) != -1) {
    //We will check the Buffers and then try to recreate a new ByteBuffer that will put the remaining
    //stuff within the buffer. NOT SURE IF THIS IS THE MOST EFFICIENT WAY OF DOING THIS
    //AND ACTUALLY DON'T HAVE THE CODE WORKING CORRECTLY. THIS IS WHERE I
    //NEED HELP ON THE CORRECT WAY TO DO THIS.
         if (buffer1.remaining() < buffer2.remaining()) {
              buffer1.flip();
              buffer2 = ByteBuffer.allocate(buffer1.remaining() + buffer2.remaining());
              System.out.println("tmp 2 Remaining : " + buffer2.remaining());
              //tmp.put(buffer2);
              //buffer2 = tmp;
              System.out.println("Buffer 2 Remaining : " + buffer2.remaining());
         buffer2.put(buffer1);
         buffer1.clear();
    //We will create a byte array from the ByteBuffer.                    
    byte[] b = buffer.array();
    //ByteArrayInputStream that we will create and put the byte array in.
    ByteArrayInputStream bis = new ByteArrayInputStream(b);
    //ObjectInputStream where we will use the ByteArrayInputStream.
    ObjectInputStream input = new ObjectInputStream(bis);
    //Object that we will read in.
    Object obj = input.readObject();
    //Message that we will end up receiving.     
    Message receivingMsg = null;
    //Once we have our Message we will end up closing the connection.
    bis.close();
    input.close();
    //We will clear the buffer.
    buffer2.clear();
    buffer1.clear();
    //We will cast the object to a message object so
    //that we can end up sending it through the right
    //routine which will allow us to send a response
    //back to the client.
    Message receivedFromClient = (Message) obj;
    //we will end up taking that message and returning it.
    Message returningMsg = communicate(receivedFromClient);
    //Here we will end up taking the Message and putting it into the ByteBuffer.          
    ByteBuffer bb = objectToOutputStreamByteBuffer(returningMsg);
    socketChannel.write(bb);
    Any help would be greatly appreciated.

    I use my own InputStream class overriding the two standard read functions read( byte[], index, length ) and read(). When you construct it pass in the channel you are reading from and read from the channel on demand. ie when a call to read comes in you read say 100 bytes from the channel. The call required only 80 so these are consumed and the other 20 are buffered. Another read call is made, this time for 50 bytes but we only have 20 buffered so another read of the channel is needed. It is up to you whether you break the contract of read( byte[], index, length ) to keep reading the channel until the full "length" is available, or handle this in your application code.
    Then because this class is InputStream you can wrap it up inside any stream you like such as the ObjectInputStream and the data will be serialized correctly.

  • I'm having problems Sorting Objects

    Hello everyone!
    I'm having problems sorting objects. Here is what I got at moment... I'm trying using "Collections.sort" with objects, and I think my problem is there but I don't know how to do in other way the sorting.
    Some help will be appreciated! Thank you!
    Movie.java
    import java.util.ArrayList;
    public class Movie
             public int itemNum;
             private String title;
             public String director;
             public Movie()
                 itemNum = -1;
                 title = "";
                 director = "";
             public Movie(int itemNum, String title, String director)
                this.itemNum = itemNum;
                this.title = title;
                this.director = director;
             public int getItemNum()
                 return itemNum;
             public String getTitle()
                 return title;
             public String getDirector()
                 return director;
               public void setItemNum(int a)
                  itemNum = a;
             public void setTitle(String b)
                 title = b;
             public void setDirector(String c)
                 director = c;
             public String toString()
                   String MovieInfo = title + "\t" + itemNum + "\t" + director ;
                   return MovieInfo;
    }MovieCollection.java
    import java.util.*;
    public class MovieCollection
        private ArrayList Movies;
         public MovieCollection()
                Movies = new ArrayList();
         public ArrayList getMovies()
                return Movies;
         public void add(Movie aMovie)
                Movies.add(aMovie);
    }MovieCollectionMenu.java
    import java.io.*;
    import java.util.*;
    public class MovieCollectionMenu
              private MovieCollection model;
              public MovieCollectionMenu ()
                   model = new MovieCollection();
            public MovieCollection getModel()
                return model;
             private static Scanner Insert = new Scanner(System.in);
              public static void main (String[] args)
                  MovieCollectionMenu menu = new MovieCollectionMenu();
                   while(true)
                 System.out.println("Movies Menu");
                 System.out.println("");     
                 System.out.println("1 - Add Movie");
                 System.out.println("2 - List Movies");
                 System.out.println("3 - Sort Movies");
                 System.out.println("0 - Exit");
                    System.out.print("\nSelect your option: ");
                 int option = Insert.nextInt();
                      switch(option)
                           case 0:   System.exit(0);break;
                         case 1:   menu.addMovie(); break;
                         case 2:   menu.listMovies(); break;
                         case 3:   menu.sortMovie(); break;
                         default:  System.out.println("Invalid Selection!");
                      System.out.println("\n");
              private void addMovie()
                   Movie aMovie = new Movie();
                System.out.print("\nEnter movie name: ");
                   aMovie.setTitle(Insert.next());
                 System.out.print("Enter number of copies: ");
                aMovie.setItemNum(Insert.nextInt());
                System.out.print("Enter director name: ");
                aMovie.setDirector(Insert.next());
                model.add(aMovie);
            private void listMovies()
                   ArrayList Movies = model.getMovies();
                   for (int i=0; i<Movies.size(); i++)
                        System.out.println(Movies.get(i).toString());
              private void sortMovie()
                 ArrayList Movies = model.getMovies();
                 Collections.sort(Movies);
    }

    JBStonehenge, Melanie_Green, paulcw thank u so much for ur support!!!!
    I did many changes in my code, and I think in a simple way... I can sort the strings, but I'm having problems to sort the integers from the array I created..
    I read a lot of sorting and this was the best I could do, please can you change my code to sort the integers?
    Thank u people!
    Here it is my code:
    import java.io.*;
    import java.util.*;
    public class MyMovies {
         public static void main(String[] args) {
              MyMovies Movies = new MyMovies();
              Movies.runEverything();
         private static final int MAX_SIZE = 100;
         private static int numberOfMovies = 0;
         private static Movie[] array = new Movie[MAX_SIZE];
         public void runEverything(){
              Scanner input = new Scanner(System.in);
              while (true) {
                   Menu();
                   int option;
                   try {
                        option = Integer.parseInt(input.nextLine());
                   } catch (NumberFormatException e) {
                        System.out.println("You must enter a number!");
                        continue;
    switch (option) {
                   case 1:
                        addMovie(input);
                        System.out.println("\nThis movie was added:");
                        printMovie(numberOfMovies - 1);
                        break;               
                   case 2:
                        sortMoviesByTitle();
                        break;
                   case 3:
                        sortMoviesByYear();
                        break;
                   case 4:
                        sortMoviesByDirector();
                        break;
                   case 5:
                        printAllMovies();
                        break;
                   case 6:
                        System.out.println("You logout with success!");
                        input.close();
                        System.exit(0);
                        break;
              default:
                        System.out.println("You entered a wrong option! Please try again.");
                        break;
         private static void Menu() {
              System.out.println("\n1 - Add a movie");
              System.out.println("2 - Sort movies by name");
              System.out.println("3 - Sort movies by year");
              System.out.println("4 - Sort movies by director");
              System.out.println("5 - Display movies");
              System.out.println("6 - Quit");
              System.out.print("\nPlease enter an option:");
              private static void printMovie(int i) {
              if (i < numberOfMovies) {
                   System.out.println("\"" + array.getTitle() + "\", " + array[i].getYear() + ", \"" + array[i].getDirector() + "\"");
         private void printAllMovies() {
              for (int i = 0; i < numberOfMovies; i++) {
                   System.out.print(String.valueOf(i+1) + "-");
                   printMovie(i);
         private static void addMovie(Scanner input) {
              System.out.print("Enter movie:");
              String title = input.nextLine();
              int year = 0;
              while (true) {
                   try {
                        System.out.print("Enter the year of movie:");
                        year = Integer.parseInt(input.nextLine());
                        break;
                   } catch (NumberFormatException e) {
                        System.out.println("You must enter an integer!");
                        continue;
              System.out.print("Please enter the director:");
              String director = input.nextLine();
              array[numberOfMovies] = new Movie(title, year, director);
              numberOfMovies++;
         private void sortMoviesByTitle(){
         boolean swapped = true;
              int i = 0;
              String tempTitle, tempDirector;
              int tempYear;
              while (swapped) {
                   swapped = false;
                   i++;
                   for (int j = 0; j < numberOfMovies - i; j++) {
                        if ( array[j].getTitle().compareToIgnoreCase(array[j + 1].getTitle()) > 0) {   
                             tempTitle = array[j].getTitle();
                             tempYear = array[j].getYear();
                             tempDirector = array[j].getDirector();
                             array[j].setTitle(array[j + 1].getTitle());
                             array[j].setYear(array[j + 1].getYear());
                             array[j].setDirector(array[j + 1].getDirector());
                             array[j + 1].setTitle(tempTitle);
                             array[j + 1].setYear(tempYear);
                             array[j + 1].setDirector(tempDirector);
                             swapped = true;
              System.out.println("The movies are sorted by title.");
         private void sortMoviesByYear(){
         boolean swapped = true;
              int i = 0;
              String tempTitle, tempDirector;
              int tempYear;
              while (swapped) {
                   swapped = false;
                   i++;
                   for (int j = 0; j < numberOfMovies - i; j++) {
                        if ( array[j].getYear().compareToIgnoreCase(array[j + 1].getYear()) > 0) {   
                             tempTitle = array[j].getTitle();
                             tempYear = array[j].getYear();
                             tempDirector = array[j].getDirector();
                             array[j].setTitle(array[j + 1].getTitle());
                             array[j].setYear(array[j + 1].getYear());
                             array[j].setDirector(array[j + 1].getDirector());
                             array[j + 1].setTitle(tempTitle);
                             array[j + 1].setYear(tempYear);
                             array[j + 1].setDirector(tempDirector);
                             swapped = true;
              System.out.println("The movies are sorted by year.");
         private void sortMoviesByDirector(){
         boolean swapped = true;
              int i = 0;
              String tempTitle, tempDirector;
              int tempYear;
              while (swapped) {
                   swapped = false;
                   i++;
                   for (int j = 0; j < numberOfMovies - i; j++) {
                        if ( array[j].getDirector().compareToIgnoreCase(array[j + 1].getDirector()) > 0) {   
                             tempTitle = array[j].getTitle();
                             tempYear = array[j].getYear();
                             tempDirector = array[j].getDirector();
                             array[j].setTitle(array[j + 1].getTitle());
                             array[j].setYear(array[j + 1].getYear());
                             array[j].setDirector(array[j + 1].getDirector());
                             array[j + 1].setTitle(tempTitle);
                             array[j + 1].setYear(tempYear);
                             array[j + 1].setDirector(tempDirector);
                             swapped = true;
              System.out.println("The movies are sorted by director.");
    /* ----- My Movie Class ----- */
    class Movie {
         private String title;
         private int year;
         private String director;
         public Movie(String title, int year, String director) {
              setTitle(title);
              setYear(year);
              setDirector(director);
         public String getTitle() {
              return title;
         public void setTitle(String title) {
              this.title = title;
         public int getYear() {
              return year;
         public void setYear(int year) {
              this.year = year;
         public String getDirector() {
              return director;
         public void setDirector(String director) {
              this.director = director;
    }Edited by: AntiSignIn on Mar 24, 2010 7:30 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Visa read object difference parity setting for PC and TPC2012 device

    Hello,
     we found some difference between application running in PC and runing in TPC2012 device.
    We tested modbus communication via RS485 (9600b/s, 8bits, parity even) between PLC(master) and TPC2012 (slave). We used Visa read object and set parity to Even via property node. From the PLC we sent request to device and in our application we only read the data from PLC and displayed it (8bytes) on sreen.
    If we tested the application on PC everything worked fine. But if we compiled application and ran it in TPC2012 device  the data was different (for example if I sent request from PLC to slave 05 03 00 01 00 01 crc crc on the TCP I saw 00 03 00 01 00 01 crc crc. The  crc on TPC wasn't equal to crc on PLC.
    We found that problem was in VISA read setiing for read data in TPC device. If we set parity to SPACE (instead of EVEN)  then we read data correctly.
    Modbus - Parity set for VISA read object:
    Master PLC (even) - PC (even) -> visa read - data are equal
    Master PLC (even) - TPC (even) -> visa read - data aren't equal
    Master PLC (even) - TPC (space)-> visa read - data are equal 
    PC: Win XP SP2, LabView 8.5 with LabView TP module 8.5.
    TPC2012: WinCE 5.0, NI visa 4.2, NI TPC Service 1.0.
    Best regards,
    Pavel Rucka.

    I just found out that the VI for the currentmeasurement with the keithley 6517a has the same error but still works fine. Now I also tried to adjust the serial data bit and parity settings via the VISA configure serial port function but still no improvements.

  • Problem reading data from oracle database 11g using OleDbDataReader

    Hi everyone I work with Visual Studio 2010 and C# programming language. I have a problem reading data from the oracle database. I created a WPF application with my main Window Xaml and class files and 1 more class called DataFiles. The thing I want is to read some data from the database on my grid in my WPF window. Problem is even though it connects to the database the grid is always empty. It isn't the connection string as I tested it and it connects to the database the problem seems to be in showing the LASTNAME (PREZIME in my native tongue) on the grid which is what it's supposed to do.
    Here is the code:
    Data Files Code
    using System;
    using System.Collections.ObjectModel;
    using System.Data.SqlClient;
    using System.Data.OleDb;
    namespace SQLKonekcija
        public class clsEmployee
            public string Prezime { get; set; }
        public class DataAccess
            OleDbConnection oleCon;
            OleDbCommand oleComd;
            public DataAccess()
                string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****;";
                oleCon = new OleDbConnection(connectionString);
            public ObservableCollection<clsEmployee> GetAllEmployee()
                ObservableCollection<clsEmployee> EmpCol = new ObservableCollection<clsEmployee>();
                oleComd = new OleDbCommand();
                oleComd.Connection = oleCon;
                oleComd.CommandText = "Select PREZIME from UPOSLENICI";
                oleCon.Open();
                OleDbDataReader Reader = oleComd.ExecuteReader();
                Reader.Read();
                while (Reader.Read())
                    EmpCol.Add(new clsEmployee()
                        Prezime = Reader["PREZIME"].ToString()
                oleCon.Close();
                return EmpCol;
            }And here is my main window.cs code
    public partial class MainWindow : Window
            clsEmployee objEmpToAdd;
            DataAccess objDs;
            public MainWindow()
                InitializeComponent();
            private void Window_Loaded(object sender, RoutedEventArgs e)
                objDs = new DataAccess();
                dgEmp.ItemsSource = objDs.GetAllEmployee();And the XAML
    <Window x:Class="SQLKonekcija.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
        <Grid>
            <DataGrid AutoGenerateColumns="False" Height="237"
                      HorizontalAlignment="Left" Margin="18,66,0,0" Name="dgEmp"
                      VerticalAlignment="Top" Width="466" ColumnWidth="*"
                       >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding PREZIME}" Header="Prezime"></DataGridTextColumn>
                </DataGrid.Columns>
            </DataGrid>
            <TextBlock Height="42" HorizontalAlignment="Left" Margin="18,15,0,0" Name="textBlock1" Text="TEST CONNECTION" VerticalAlignment="Top" Width="462" TextAlignment="Center" FontSize="28" FontWeight="ExtraBold" />
        </Grid>
    </Window>
    The guys on the MSDN forums told me I should ask the question here so sorry if it's not your field.
    Hope u guys can help, thanks.

    I tried it, commented out the reader.read and have the following connection string
    string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****; OLEDB.NET=True"
    Unfortunately the result is the same.
    Edited by: Dino2dy on Nov 24, 2011 12:53 AM

  • Blocking reading object from stream

    I have a thread that continually reads objects from the input stream, so I use the readObject() method. My problem is that it doesn't block when there is no input. it just throws exceptions and I cant find a way to check first if there's anything output from the other side of the stream so do a check. thank you!

    Sorry! My mistake! I was confused!

  • Cannot send and read objects through sockets

    I have these 4 classes to send objects through sockets. Message and Respond classes are just for
    trials. I use their objects to send &#305;ver the network. I do not get any compile time error or runtime error but
    the code just does not send the objects. I used object input and output streams to send and read objects
    in server (SOTServer) and in the client (SOTC) classes. When I execevute the server and client I can see
    that the clients can connect to the server but they cannot send any objects allthough I wrote them inside the main method of client class. This code stops in the run() method but I could not find out why it
    does do that. Run the program by creating 4 four classes.
    Message.java
    Respond.java
    SOTC.java
    SOTServer.java
    Then execute server and then one or more clients to see what is going on.
    Any ideas will be appreciated
    thanks.
    ASAP pls
    //***********************************Message class**********************
    import java.io.Serializable;
    public class Message implements Serializable
    private String chat;
    private int client;
    public Message(String s,int c)
    client=c;
    chat=s;
    public Message()
    client=0;
    chat="aaaaa";
    public int getClient()
    return client;
    public String getChat()
    return chat;
    //*******************************respond class*****************************
    import java.io.Serializable;
    public class Respond implements Serializable
    private int toClient;
    private String s;
    public Respond()
    public Respond(String s)
    this.s=s;
    public int gettoClient()
    return toClient;
    public String getMessage()
    return s;
    //***********************************SOTServer*********************
    import java.io.*;
    import java.net.*;
    import java.util.Vector;
    //private class
    class ClientWorker extends Thread
    private Socket client;
    private ObjectInputStream objectinputstream;
    private ObjectOutputStream objectoutputstream;
    private SOTServer server;
    ClientWorker(Socket socket, SOTServer ser)
    client = socket;
    server = ser;
    System.out.println ("new client connected");
    try
    objectinputstream=new ObjectInputStream(client.getInputStream());
    objectoutputstream=new ObjectOutputStream(client.getOutputStream());
    catch(Exception e){}
    public void sendToClient(Respond s)
    try
    objectoutputstream.writeObject(s);
    objectoutputstream.flush();
    catch(IOException e)
    e.printStackTrace();
    public void run()
    do
    Message fromClient;
    try
    fromClient =(Message) objectinputstream.readObject();
    System.out.println (fromClient.getChat());
    Respond r=new Respond();
    server.sendMessageToAllClients(r);
    System.out.println ("send all completed");
    catch(ClassNotFoundException e){e.printStackTrace();}
    catch(IOException ioexception1)
    ioexception1.printStackTrace();
    break;
    Respond k=new Respond();
    sendToClient(k);
    }while(true);
    public class SOTServer
    ServerSocket server;
    Vector clients;
    public static void main(String args[]) throws IOException
    SOTServer sotserver = new SOTServer();
    sotserver.listenSocket();
    SOTServer()
    clients = new Vector();
    System.out.println ("Server created");
    public void sendMessageToAllClients(Respond str)
    System.out.println ("sendToallclient");
    ClientWorker client;
    for (int i = 0; i < clients.size(); i++)
    client = (ClientWorker) (clients.elementAt(i));
    client.sendToClient(str);
    public void listenSocket()
    try
    System.out.println ("listening socket");
    server = new ServerSocket(4444, 6);
    catch(IOException ioexception)
    ioexception.printStackTrace();
    do
    try
    ClientWorker clientworker=new ClientWorker(server.accept(), this);
    clients.add(clientworker);
    clientworker.start();
    catch(IOException ioexception1)
    ioexception1.printStackTrace();
    while(true);
    protected void finalize()
    try
    server.close();
    catch(IOException ioexception)
    ioexception.printStackTrace();
    //*************************SOTC***(client class)*********************
    import java.io.*;
    import java.net.Socket;
    import java.net.UnknownHostException;
    class SOTC implements Runnable
    private Socket socket;
    private ObjectOutputStream output;
    private ObjectInputStream input;
    public void start()
    try
    socket= new Socket("127.0.0.1",4444);
    input= new ObjectInputStream(socket.getInputStream());
    output= new ObjectOutputStream(socket.getOutputStream());
    catch(IOException e){e.printStackTrace();}
    Thread outputThread= new Thread(this);
    outputThread.start();
    public void run()
    try
    do
    Message m=new Message("sadfsa",0);
    output.writeObject(m);
    Respond fromServer=null;
    fromServer=(Respond)input.readObject();
    }while(true);
    catch(NullPointerException e){run();}
    catch(Exception e){e.printStackTrace();}
    public SOTC()
    start();
    public void sendMessage(Message re)
    try
    Message k=new Message("sdasd",0);
    output.writeObject(k);
    output.flush();
    catch(Exception ioexception)
    ioexception.printStackTrace();
    System.exit(-1);
    public static void main(String args[])
    SOTC sotclient = new SOTC();
    try
    System.out.println("client obje sonrasi main");
    Message re=new Message("client &#305;m ben mesaj bu da iste",0);
    sotclient.sendMessage(re);
    System.out.println ("client gonderdi mesaji");
    catch(Exception e) {e.printStackTrace();}

    ObjectStreams send a few bytes at construct time. The OutputStream writes a header and the InputStram reads them. The InputStream constrcutor will not return until oit reads that header. Your code is probably hanging in the InputStream constrcutor. (try and verify that by getting a thread dump)
    If that is your problem, tolution is easy, construct the OutputStreams first.

Maybe you are looking for