Read serialized objects : cannot read past first object : StreamCorrupted
I have written multiple instances of an object to a file. When I try to read them back, the first one works but the second gets a StreamCorruptedException: Type code out of range, is -84.
Several Forum topics deal with this, but I have found no relevant replies.
Thanks for any help.
Here is the code:
public void abFileWrite(AbRec abRec) throws IOException
FileOutputStream fileStream = new FileOutputStream(abDFileName,true);
ObjectOutputStream writer = new ObjectOutputStream(fileStream);
try
writer.writeObject((AbRec) abRec);
writer.flush();
fileStream.close();
writer.close();
catch (IOException ioe)
System.out.println("abFile cannot write to file "+
directory+abFileName+". "+"ex="+ioe);
public void readAll()
try{ // just TRY to read that second record!
FileInputStream file = new FileInputStream(abDFileName);
ObjectInputStream in = new ObjectInputStream(file);
AbRec ar = (AbRec) in.readObject();
System.out.println("1 ar="+ ar.getAb());
ar = (AbRec) in.readObject(); //StreamCorruptedException: Type code out of range, is -84
System.out.println("2 ar="+ ar.getAb());
in.close();
catch (Throwable th) { System.out.println("readAll th="+th); }
public class AbRec implements java.io.Serializable
String ab;
public AbRec(){}
public void setAb (String a){ab = a;}
public String getAb(){return (ab);}
}
The answer, thanks to Bass345, is:
4 bytes of header info is stored each time.
So, call skip on the FileInputStream.
fileInputStreamName.skip((long)4);
Note it is the FileInputStream, not the ObjectInputStream.
Similar Messages
-
Web Dynpro Callable Object :"Cannot read callable object description "
Hi All,
I'm getting the following error:
"Cannot read callable object description from component"
and also "Cannot read callable object description from component" in two different Web Dynpros.
The code in the Web Dynpros is similar:
try
IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
WebDynproResourceAccessor resourceAccessor = new WebDynproResourceAccessor(textAccessor);
//ITechnicalDescription techDesc = TechnicalDescriptionFactory.newTechnicalDescription("FRESH_PARAMS","Fresh_Parameters To Be Called",resourceAccessor,locale);
ITechnicalDescription techDesc = TechnicalDescriptionFactory.newTechnicalDescription("FRESH_PARAMS","Fresh",resourceAccessor,locale);
//Pre-Existing Structure for Input
IStructureInfo input = techDesc.getInputStructureInfo();
IAttributeInfo firstName = input.addAttribute("firstName",IAttributeInfo.BASE_STRING);
IAttributeInfo lastName = input.addAttribute("lastName",IAttributeInfo.BASE_STRING);
IAttributeInfo phoneNum = input.addAttribute("phoneNum",IAttributeInfo.BASE_STRING);
IAttributeInfo Place = input.addAttribute("Place",IAttributeInfo.BASE_STRING);
IAttributeInfo Email = input.addAttribute("Email",IAttributeInfo.BASE_STRING);
IAttributeInfo Company = input.addAttribute("Company",IAttributeInfo.BASE_STRING);
//Setting multiplicity
firstName.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
lastName.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
phoneNum.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
Place.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
Email.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
Company.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
//Pre-Existing Structure for Output
IStructureInfo output = techDesc.getOutputStructureInfo();
IStructureInfo userStruct1 = output.addStructure("userStruct1");
userStruct1.addAttribute("firstName",IAttributeInfo.BASE_STRING);
userStruct1.addAttribute("lastName",IAttributeInfo.BASE_STRING);
IStructureInfo userStruct2 = output.addStructure("userStruct2");
userStruct2.addAttribute("phoneNum",IAttributeInfo.BASE_STRING);
userStruct2.addAttribute("Place",IAttributeInfo.BASE_STRING);
userStruct2.addAttribute("Email",IAttributeInfo.BASE_STRING);
userStruct2.addAttribute("Company",IAttributeInfo.BASE_STRING);
return techDesc;
catch (InvocationException ex)
ex.printStackTrace();
return null;
Can someone tell me where I'm going wrong.
Thanks
SrikantHi Zornista Yankulova
I'm getting this error:
" Cannot read callable object description from component: Failed to create delegate for custom controller com.infosys.creator.wdpco.COGetDocTypeInterface. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)"
Where the places i can go wrong??
Please let me know.
My code is like this?
public com.sap.caf.eu.gp.co.api.ITechnicalDescription getDescription( java.util.Locale locale )
//@@begin getDescription()
try
IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
WebDynproResourceAccessor resourceAccessor = new WebDynproResourceAccessor(textAccessor);
//ITechnicalDescription techDesc = TechnicalDescriptionFactory.newTechnicalDescription("FRESH_PARAMS","Fresh_Parameters To Be Called",resourceAccessor,locale);
ITechnicalDescription techDesc = TechnicalDescriptionFactory.newTechnicalDescription("FRESH_PARAMS","Fresh",resourceAccessor,locale);
//Pre-Existing Structure for Input
IStructureInfo input = techDesc.getInputStructureInfo();
IAttributeInfo firstName = input.addAttribute("firstName",IAttributeInfo.BASE_STRING);
IAttributeInfo lastName = input.addAttribute("lastName",IAttributeInfo.BASE_STRING);
IAttributeInfo phoneNum = input.addAttribute("phoneNum",IAttributeInfo.BASE_STRING);
IAttributeInfo Place = input.addAttribute("Place",IAttributeInfo.BASE_STRING);
IAttributeInfo Email = input.addAttribute("Email",IAttributeInfo.BASE_STRING);
IAttributeInfo Company = input.addAttribute("Company",IAttributeInfo.BASE_STRING);
//Setting multiplicity
firstName.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
lastName.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
phoneNum.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
Place.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
Email.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
Company.setMultiplicity(IAttributeInfo.MULITIPLICITY_1_1);
//Pre-Existing Structure for Output
IStructureInfo output = techDesc.getOutputStructureInfo();
IStructureInfo userStruct1 = output.addStructure("userStruct1");
userStruct1.addAttribute("firstName",IAttributeInfo.BASE_STRING);
userStruct1.addAttribute("lastName",IAttributeInfo.BASE_STRING);
IStructureInfo userStruct2 = output.addStructure("userStruct2");
userStruct2.addAttribute("phoneNum",IAttributeInfo.BASE_STRING);
userStruct2.addAttribute("Place",IAttributeInfo.BASE_STRING);
userStruct2.addAttribute("Email",IAttributeInfo.BASE_STRING);
userStruct2.addAttribute("Company",IAttributeInfo.BASE_STRING);
return techDesc;
catch (InvocationException ex)
ex.printStackTrace();
return null;
//@@end
//@@begin javadoc:execute()
/** Declared method. */
//@@end
public void execute( com.sap.caf.eu.gp.co.api.IExecutionContext executionContext )
//@@begin execute()
try
IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
WebDynproResourceAccessor resourceAccessor = new WebDynproResourceAccessor(textAccessor);
this.executionContext = executionContext;
//Input
IStructure input = executionContext.getInputStructure();
String firstName = (String)input.getAttribute("firstName");
String lastName = (String)input.getAttribute("lastName");
String phoneNum = (String)input.getAttribute("phoneNum");
String Email= (String)input.getAttribute("Email");
String Place = (String)input.getAttribute("Place");
String Company = (String)input.getAttribute("Company");
wdContext.nodeInput().currentInputElement().setFirstName(firstName);
wdContext.nodeInput().currentInputElement().setLastName(lastName);
wdContext.nodeInput().currentInputElement().setPhoneNum(phoneNum);
wdContext.nodeInput().currentInputElement().setEmail(Email);
wdContext.nodeInput().currentInputElement().setPlace(Place);
wdContext.nodeInput().currentInputElement().setCompany(Company);
//Output
IStructure output = executionContext.getOutputStructure();
String f = wdContext.nodeInput().currentInputElement().getFirstName();
String l = wdContext.nodeInput().currentInputElement().getLastName();
String pn = wdContext.nodeInput().currentInputElement().getPhoneNum();
String e = wdContext.nodeInput().currentInputElement().getEmail();
String p = wdContext.nodeInput().currentInputElement().getPlace();
String c = wdContext.nodeInput().currentInputElement().getCompany();
output.setAttributeValue("firstName",f);
output.setAttributeValue("lastName",l);
output.setAttributeValue("phoneNum",pn);
output.setAttributeValue("Email",e);
output.setAttributeValue("Place",p);
output.setAttributeValue("Company",c);
catch(Exception ex)
ex.printStackTrace();
//@@end
//@@begin javadoc:complete()
/** Declared method. */
//@@end
public void complete( )
//@@begin complete()
try
IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
WebDynproResourceAccessor resourceAccessor = new WebDynproResourceAccessor(textAccessor);
IStructure output = executionContext.getOutputStructure();
IStructure user1 = output.addStructure("userStruct1");
IStructure user2 = output.addStructure("userStruct2");
String f = wdContext.nodeInput().currentInputElement().getFirstName();
String l = wdContext.nodeInput().currentInputElement().getLastName();
String pn = wdContext.nodeInput().currentInputElement().getPhoneNum();
String e = wdContext.nodeInput().currentInputElement().getEmail();
String p = wdContext.nodeInput().currentInputElement().getPlace();
String c = wdContext.nodeInput().currentInputElement().getCompany();
user1.setAttributeValue("firstName",f);
user1.setAttributeValue("lastName",l);
user2.setAttributeValue("phoneNum",pn);
user2.setAttributeValue("Email",e);
user2.setAttributeValue("Place",p);
user2.setAttributeValue("Company",c);
executionContext.addResultState("Success");
executionContext.processingComplete();
catch(InvocationException e)
e.printStackTrace();
catch(EngineException ex)
ex.printStackTrace();
//@@end
* The following code section can be used for any Java code that is
* not to be visible to other controllers/views or that contains constructs
* currently not supported directly by Web Dynpro (such as inner classes or
* member variables etc.). </p>
* Note: The content of this section is in no way managed/controlled
* by the Web Dynpro Designtime or the Web Dynpro Runtime.
//@@begin others
private IExecutionContext executionContext;
//@@end
Thanks
Srikant -
Adobe reader for mac cannot read pdf
I have the latest version of Adobe Reader, the latest OS for Mac, and the latest Safari browser update. but after installing Reader, the ability to access a PDF has become mostly restricted. the full gray screen comes up and a document cannot be accessed. what should I do?
There should be an icon that instructs you to trust the Adobe Reader application for this website. Click on it to approve the action. This is part of a new security practice.
-
After a search I cannot scroll past first page of results.
When using SearchMyWeb I cannot scroll to see all the results.
'''Try the Firefox SafeMode''' to see how it works there. <br />
''A troubleshooting mode, which disables most Add-ons.'' <br />
''(If you're not using it, switch to the Default Theme.)''
* You can open the Firefox 4.0+ SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
* Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
''Don't select anything right now, just use "Continue in SafeMode."''
''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
'''''If it is good in the Firefox SafeMode''''', your problem is probably caused by an extension, and you need to figure out which one. <br />
http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes
My guess is that the issue is caused by either the Yahoo Toolbar or Yontoo Layers add-ons even though they are disabled. <br />
<br/>
''When you do figure out what is causing that, please let us know. It might help other user's who have that problem.'' -
Neo4 Platinum Board, boot issue, cannot get past first screen
I've spent some time looking through the forum to see if anyone had a solution to the problem I am about to describe and did not find one.
Here is the issue:
Whenever any USB device (1.1 or 2.0) is hooked up to any one of the four onboard USB ports all I get is the initial logo screen and the computer never moves on. I have tested hooking up a USB Keyboard, USB Mouse, enclosures, pen drives, etc. As long as there is a usb device in an onboard USB port the computer will not move past the initial logo screen. If there are no USB devices plugged into the onobard USB ports then the system will go all the way through with the boot and get into windows. Once within Windows the four onboard USB ports work fine. You can plug devices in and they are recognized. If there is already a solution to this issue I apologize for posting this and please point me in the right direction.
Thanks to anyone who replies
Specifications:
MB: MSI K8N Neo4 Platinum
CPU: AMD Athlon 64 3500+
Memory: 2 Kingston KVR400X64C3AK2/512
VGA: XFX nVidea GeForce 6600 Ultra DDR3 256MB Dual DVI, S-Video Out
HD: 2 Western Digital WD200JB
FD: 1 Floppy Drive
Optical: DVD Burner and DVD Drive
PS: 500W, 12V, bought 24-pin adapter to hook up to mobtherboard
Audio: Creative Sound Blaster Audgiy 4 PlatinumDid you use the USB ports on the motherboard, or did you use any USB port attached to the motherboards extra connectors? if the latter, it suggests that you have some faulty wiring of the USB cables. Check so that the connectors of the USB ports are correct with their signals according to the pin layout.
Faulty wired USB will cause the problem you describe.
Also check that you have not damaged the USB port. I have seen some computers where the plastic pin in the USB port has been broken of, and the connectors have been grounded. One example was a computer where the 5VSB was bent, grounding it, resulting in that the motherboard did not recognise any PS2 or USB keyboards.
Third, if the devices you attach draw to much amphere through the USB, it may cause these problems. You might need a powered USB hub.
Fourth, make sure your powersupply is powerful enough if you have many USB devices. -
I have adobe acrobat/reader but I cannot read pdf files.
If I need open a pdf file I must used another browser.
https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox
https://support.mozilla.com/en-US/kb/Opening+PDF+files+within+Firefox -
Preview crashing on several files under Lion "object cannot be nil"
Hi,
with several different files - old and new ones -, Preview simply crashes with the following error message after installing Lion on my MacBook Pro:
2011-08-15 09:16:06.255 Preview[435:60b] An uncaught exception was raised
2011-08-15 09:16:06.256 Preview[435:60b] *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
2011-08-15 09:16:06.262 Preview[435:60b] (
0 CoreFoundation 0x00007fff8fe25986 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff95bbed5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8fdcc818 -[__NSArrayM insertObject:atIndex:] + 296
3 Preview 0x0000000104f46cf9 Preview + 23801
4 Preview 0x0000000104f46a17 Preview + 23063
5 Preview 0x0000000104f465d1 Preview + 21969
6 Preview 0x0000000104f46175 Preview + 20853
7 libdispatch.dylib 0x00007fff9144990a _dispatch_call_block_and_release + 18
8 libdispatch.dylib 0x00007fff9144b77a _dispatch_main_queue_callback_4CF + 308
9 CoreFoundation 0x00007fff8fdbac0c __CFRunLoopRun + 1724
10 CoreFoundation 0x00007fff8fdba216 CFRunLoopRunSpecific + 230
11 HIToolbox 0x00007fff91dfb4ff RunCurrentEventLoopInMode + 277
12 HIToolbox 0x00007fff91e02c21 ReceiveNextEventCommon + 355
13 HIToolbox 0x00007fff91e02aae BlockUntilNextEventMatchingListInMode + 62
14 AppKit 0x00007fff92205191 _DPSNextEvent + 659
15 AppKit 0x00007fff92204a95 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
16 AppKit 0x00007fff924baa4d -[NSApplication _realDoModalLoop:peek:] + 610
17 AppKit 0x00007fff924ba681 -[NSApplication runModalForWindow:] + 120
18 AppKit 0x00007fff924adf06 -[NSAlert runModal] + 159
19 AppKit 0x00007fff92233d66 -[NSPersistentUIManager promptToIgnorePersistentState] + 818
20 AppKit 0x00007fff922083dd -[NSApplication _reopenWindowsAsNecessaryIncludingRestorableState:registeringAsReady:completion Handler:] + 173
21 AppKit 0x00007fff92208241 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 227
22 AppKit 0x00007fff92207fb1 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 330
23 CoreFoundation 0x00007fff8fe17f51 -[NSObject performSelector:withObject:withObject:] + 65
24 Foundation 0x00007fff8c3791c7 __-[NSAppleEventManager setEventHandler:andSelector:forEventClass:andEventID:]_block_invoke_1 + 101
25 Foundation 0x00007fff8c37814e -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 283
26 Foundation 0x00007fff8c377fdc _NSAppleEventManagerGenericHandler + 105
27 AE 0x00007fff8cad9a85 _Z20aeDispatchAppleEventPK6AEDescPS_jPh + 200
28 AE 0x00007fff8cad9963 _ZL25dispatchEventAndSendReplyPK6AEDescPS_ + 38
29 AE 0x00007fff8cad9857 aeProcessAppleEvent + 250
30 HIToolbox 0x00007fff91e0a12d AEProcessAppleEvent + 102
31 AppKit 0x00007fff922053dd _DPSNextEvent + 1247
32 AppKit 0x00007fff92204a95 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
33 AppKit 0x00007fff922013d6 -[NSApplication run] + 463
34 AppKit 0x00007fff9247f52a NSApplicationMain + 867
35 Preview 0x0000000104f42c64 Preview + 7268
36 ??? 0x0000000000000002 0x0 + 2
2011-08-15 09:16:06.263 Preview[435:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
0 CoreFoundation 0x00007fff8fe25986 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff95bbed5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8fdcc818 -[__NSArrayM insertObject:atIndex:] + 296
3 Preview 0x0000000104f46cf9 Preview + 23801
4 Preview 0x0000000104f46a17 Preview + 23063
5 Preview 0x0000000104f465d1 Preview + 21969
6 Preview 0x0000000104f46175 Preview + 20853
7 libdispatch.dylib 0x00007fff9144990a _dispatch_call_block_and_release + 18
8 libdispatch.dylib 0x00007fff9144b77a _dispatch_main_queue_callback_4CF + 308
9 CoreFoundation 0x00007fff8fdbac0c __CFRunLoopRun + 1724
10 CoreFoundation 0x00007fff8fdba216 CFRunLoopRunSpecific + 230
11 HIToolbox 0x00007fff91dfb4ff RunCurrentEventLoopInMode + 277
12 HIToolbox 0x00007fff91e02c21 ReceiveNextEventCommon + 355
13 HIToolbox 0x00007fff91e02aae BlockUntilNextEventMatchingListInMode + 62
14 AppKit 0x00007fff92205191 _DPSNextEvent + 659
15 AppKit 0x00007fff92204a95 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
16 AppKit 0x00007fff924baa4d -[NSApplication _realDoModalLoop:peek:] + 610
17 AppKit 0x00007fff924ba681 -[NSApplication runModalForWindow:] + 120
18 AppKit 0x00007fff924adf06 -[NSAlert runModal] + 159
19 AppKit 0x00007fff92233d66 -[NSPersistentUIManager promptToIgnorePersistentState] + 818
20 AppKit 0x00007fff922083dd -[NSApplication _reopenWindowsAsNecessaryIncludingRestorableState:registeringAsReady:completion Handler:] + 173
21 AppKit 0x00007fff92208241 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 227
22 AppKit 0x00007fff92207fb1 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 330
23 CoreFoundation 0x00007fff8fe17f51 -[NSObject performSelector:withObject:withObject:] + 65
24 Foundation 0x00007fff8c3791c7 __-[NSAppleEventManager setEventHandler:andSelector:forEventClass:andEventID:]_block_invoke_1 + 101
25 Foundation 0x00007fff8c37814e -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 283
26 Foundation 0x00007fff8c377fdc _NSAppleEventManagerGenericHandler + 105
27 AE 0x00007fff8cad9a85 _Z20aeDispatchAppleEventPK6AEDescPS_jPh + 200
28 AE 0x00007fff8cad9963 _ZL25dispatchEventAndSendReplyPK6AEDescPS_ + 38
29 AE 0x00007fff8cad9857 aeProcessAppleEvent + 250
30 HIToolbox 0x00007fff91e0a12d AEProcessAppleEvent + 102
31 AppKit 0x00007fff922053dd _DPSNextEvent + 1247
32 AppKit 0x00007fff92204a95 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
33 AppKit 0x00007fff922013d6 -[NSApplication run] + 463
34 AppKit 0x00007fff9247f52a NSApplicationMain + 867
35 Preview 0x0000000104f42c64 Preview + 7268
36 ??? 0x0000000000000002 0x0 + 2
terminate called throwing an exception
I have looked around for tips, but none of them seem to resolve the problem. Any help would be appreciated!I have run some further tests. While I am still not sure what the underlying problem is, here's what happens in an example.
I create a new PDF from LaTeX using MacTeX 2011's pdflatex.
I run "Preview xxx.pdf" from the shell; Preview crashes as stated above.
I run "Preview" from the shell (note: no parameter), click "Don't restore Windows", and then manually open the pdf file inside Preview. The PDF is now shown without problems.
The same happens in many cases if I replace running "Preview xxx.pdf" in the shell by opening the PDF file by double clicking it in Finder.
Strange... -
OWB Issue|| ORA-12838: cannot read/modify an object after modifying it in
Hi
I am not able to enter the data into the staging table .
it is also not throwing any error ,only giving warnings.
so as a next step i just took the intermediate result generation and try to run it
but it is giving me an error in that
ORA-12838: cannot read/modify an object after modifying it in parallel
Can you please help me in tthis case.
ThanksHello,
The error ORA-12838 occurs if you try to issue SELECT/DML immediately after completing parallel DML, within one transaction - it's not permitted.
Start another transaction - issue Commit or Rollback first. -
Writing and Reading serialized Objects
[code=java]
/*hey guys i'm new to java and i have been given an exercise to make a cd collection, write it into a file and read the data back to the program.
the program is suppose to show you a menu to select from where you can add, delete, view sort, CD's when you add a CD it must be written to a file as an Object and when you want to view CDs or search for a CD the program must read the CD objects from the file they have been written to and must return a cd nam, artist and release date. the code looks like it is writing the Cd to a file but when i try to read (view or search for a cd from the file it gives an error null). so i think i'm note reading the right way.
thank you for helping .
import java.io.Serializable;
public class cd implements Serializable {
//creating attributes
private String cdname = null;
private double price = 0.0;
private String artist =null;
private int ratings =0;
private String genre=null;
private String releaseDate =null;
// creating an Empty constructor
public cd(){
public cd (String cdname,double price, int ratings, String genre, String artist, String releaseDate){
this.cdname=cdname;
this.price=price;
this.artist=artist;
this.ratings=ratings;
this.genre=genre;
this.releaseDate=releaseDate;
public String getGenre(){
return genre;
public void setGenre(String genre){
this.genre =genre;
public String getArtist(){
return artist;
public void setArtist(String artist){
this.artist=artist;
public String getName(){
return cdname;
public void setName(String cdname){
this.cdname = cdname;
public Double getPrice(){
return price;
public void setPrice(double price){
this.price = price;
public String getReleaseDate(){
return releaseDate;
public void setReleaseDate(String releaseDate){
this.releaseDate = releaseDate;
public int getRatings(){
return ratings;
public void setRatings( int ratings){
this.ratings = ratings;
import java.util.*;
public class hipHopCollection {
ArrayList<cd> list = new ArrayList <cd> ();
EasyIn ei = new EasyIn();
private cd invoke;
private int b;
public void load()
System.out.println(" You Entered " + b + " To Add A CD ");
invoke = new cd();
System.out.println("Please Enter A CD Name ");
invoke.setName(ei.readString());
System.out.println("Please Enter A CD Price");
invoke.setPrice(ei.readDouble());
System.out.println("Please Give Ratings For The CD");
invoke.setRatings(ei.readInt());
System.out.println("Please Enter A CD release date ");
invoke.setReleaseDate(ei.readString());
System.out.println("Please Enter artist Name ");
invoke.setArtist(ei.readString());
System.out.println("Please Enter A CD Genre ");
invoke.setGenre(ei.readString());
list.add(invoke); // trying to add cd information to invoke.
}// end of load
// The following method should return the Object variable invoke that holds the cd INFO
public Object getInvoke()
return invoke;
public int getB()
return b;
public void setB()
b=ei.readInt();
public void menu(){
System.out.println("......................................................... ");
System.out.println("Hi There Please Enter A Number For Your Choice");
System.out.println(" Pess >>");
System.out.println("1 >> Add A CD");
System.out.println("2 >> View List Of CD's");
System.out.println("3 >> Sort CD's By Price");
System.out.println("4 >> Search CD By Name");
System.out.println("5 >> Remove CD(s) By Name");
System.out.println("0 >> Exit");
System.out.println(".........................................................");
System.out.print("Please Enter Chioce >> ");
}// end of menu
public void GoodBye()
System.out.println(" You Entered " + b + " To exit Good_bye" );
System.exit(0);
}//end of GoodBye
public void PriceSort()
System.out.println(" You Entered " + b + " To Sort CD(s) By price ");
Collections.sort(list, new SortByPrice());
for(cd s : list)
System.out.println(s.getName() + ": " + s.getPrice());
}// end of PriceSort
public void NameSearch()
System.out.println(" You Entered " + b + " To Search CD(s) By Name ");
System.out.println("Please Enter The Name Of The CD You Are Searching For " );
String search = ei.readString();
for(int i=0; i<list.size();i++){
if(search.equalsIgnoreCase(list.get(i).getName() )){
System.out.println(list.get(i).getName() + " " + list.get(i).getPrice() + " " + list.get(i).getRatings() + " " + list.get(i).getGenre() );
}//end of NameSearch
public void ViewList()
System.out.println(" You Entered " + b + " To view CD(s) By Name ");
for(int i=0; i<list.size();i++)
System.out.println(list.get(i).getName() + " " + list.get(i).getPrice() + " " + list.get(i).getRatings() + " " + list.get(i).getGenre() );
}// end of ViewList
public void DeleteCd()
System.out.println(" You Entered " + b + " To Delete CD(s) By Name ");
System.out.println("Please Enter The Name Of The CD You Want to Delete ");
String search = ei.readString();
for(int i=0; i<list.size();i++)
if(search.equalsIgnoreCase(list.get(i).getName() ))
System.out.println(list.get(i).getName());
list.remove(i);
}// end of DeleteCD
public static void main(String[] args) {
//creating an Instance of EasyIn by object ei. Easy in is a Scanner class for reading
EasyIn ei = new EasyIn();
ArrayList<cd> list = new ArrayList <cd> (); // creating an array cd list
hipHopCollection call = new hipHopCollection();
ReadWrite rw = new ReadWrite();
while (true){
call.menu();
call.setB();
//b = ei.readInt();
if(call.getB()==0)
call.GoodBye();
if(call.getB()==1)
call.load();
rw.doWriting();// trying to write the cd object to a file
if(call.getB()==2)
rw.doReading();// trying to read the cd object from a file
//call.ViewList();
if(call.getB()==3)
call.PriceSort();
if(call.getB()==4)
call.NameSearch();
if(call.getB()==5)
call.DeleteCd();
}// end of while
}// end of main
}// end of class
// importing all the packages that we will use
import java.io.ObjectInputStream;
import java.io.FileInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
public class ReadWrite {
// these are all the attributes
private String FileName ="CdCollections.dat";
private OutputStream output;
private ObjectOutputStream oos;
private FileOutputStream fos;
private File file;
private FileInputStream fis;
private ObjectInputStream ois;
//creating an empty constructor
public ReadWrite()
// we could initialise all the attributes inside this empty constructor
//creating a constructor with arguments of a file name.
public ReadWrite(File file)
this.file=file;
try
//Use a FileOutputStream to send data to a file called CdCollections.dat
fos = new FileOutputStream(file,true);
Use an ObjectOutputStream to send object data to the
FileOutputStream for writing to disk.
oos = new ObjectOutputStream (fos);
fis=new FileInputStream(file);
ois = new ObjectInputStream(fis);
catch(FileNotFoundException e)
System.out.println("File Not Found");
catch(IOException a)
System.out.println(a.getMessage());
System.out.println("Please check file permissions of if file is not corrupt");
}// end of the second constructor
//the following lines of code will be the accessors and mutators
* @return the output
public OutputStream getOutput() {
return output;
* @param output the output to set
public void setOutput(OutputStream output) {
this.output = output;
* @return the objStream
public ObjectOutputStream getOos() {
return oos;
* @param objStream the objStream to set
public void setObjStream(ObjectOutputStream objStream) {
this.oos = oos;
public File getFile() {
return file;
public void setFile(File file) {
this.file = file;
public FileInputStream getFis() {
return fis;
public void setFis(FileInputStream fis) {
this.fis = fis;
public ObjectInputStream getOis() {
return ois;
public void setOis(ObjectInputStream ois) {
this.ois = ois;
// the following lines of code will be the methods for reading and writing
the following method doWriting will write data from the hipHopCollections source code.
that will be all the cd information.
Pass our object to the ObjectOutputStream's
writeObject() method to cause it to be written out
to disk.
obj_out.writeObject (myObject);
public void doWriting()
hipHopCollection call = new hipHopCollection();
//creating an Object variable hold that will hold cd data from hipHopCollections invoke
Object hold = call.getInvoke();// THI COULD BE THE PART WHERE I MADE A MISTAKE
ReadWrite stream = new ReadWrite (new File(FileName));
try
Pass our object to the ObjectOutputStream's
writeObject() method to cause it to be written out to disk.
stream.getOos().writeObject(hold);
stream.getOos().writeObject(hold);
stream.getOos().close();
System.out.println("Done writing Object");
catch (IOException e)
System.out.println(e.getMessage());
System.out.println("Program Failed To Write To The File");
finally
System.out.println("The program Has come To An End GoodBye");
}// end of method DoWriting
The following method is for reading data from the file written by the above method named
DoWriting
// PLEASE NOT THIS IS THE METHOD THAT GIVES ME NULL EXCEPTION
public void doReading()
ReadWrite read = new ReadWrite(new File(FileName));
try{
//System.out.println("I AM NOW INSIDE THE TRY TO READ");
Object obj = read.getOis().readObject();
System.out.println("tried reading the object");
cd c = (cd)obj; // trying to cast the object back to cd type
System.out.println("I have typed cast the Object");
System.out.println(c.getName());
System.out.println(c.getGenre());
System.out.println(c.getArtist());
System.out.println(c.getPrice());
System.out.println(c.getRatings());
System.out.println(c.getReleaseDate());
read.getOis().close();
catch(ClassNotFoundException e)
System.out.println(e.getMessage());
System.out.println("THE CLASS COULD NOT BE FOUND");
catch(IOException e)
System.out.println(e.getMessage());// null
System.out.println("WE COULD NOT READ THE DATA INSIDE THE FILE");
}//end of method doReading
}// end of class ReadWriteCross posted
http://www.java-forums.org/new-java/59965-writing-reading-serialized-java-object.html
Moderator advice: Please read the announcement(s) at the top of the forum listings and the FAQ linked from every page. They are there for a purpose.
Then edit your post and format the code correctly.
db -
GP - WD Java: Cannot read callable object description from component
Hi,
i use Guided Procedures and therefore i will generate a WebDynproJ Callable Object inside the GP.
When i try to intergate it into Design-Time i get follwoing error after i picked the WebDynpro Component:
Cannot read callable object description from component: type com.sap.caf.gp.quotcreate.model.bapi_quotation_createfromdata2.types.Vbeln_Va could not be loaded: com.sap.dictionary.runtime.DdException: TypeBroker failed to access SLD: Error while obtaining JCO connection.
Well because i could import the Model into the WD Component in NWDS with the given JCo i have no clue why this error is now popping up.
Does someone have some experience with this phenomenon?!
I also wanted to check the JCo's in Content Admin but even though i am an Admin (i am sure of this) i have no rights to enter this part. Also the SLD is properly configured!
brHi Fritz,
how did you resolve the problem? thanks a lot!
Nicola -
API0259: The object cannot be edited in Read-Only mode!
All,
I'm getting the following error when trying to import an MDL file into my repository:
API0259: The object cannot be edited in Read-Only mode!
Does anyone know what this relates to?Hmmmm, sounds like it is hanging up on a conflict with the configuration name from your source repository and the configuration names in your target. Not sure that I have time to try and replicate that on my own system today.
What I might suggest you try is to, on your source, set the project configuration back to the standard "DEFAULT_CONFIGURATION", get your module configured to use it, and re-export the mapping. Then you can fix your configuration back to where it should be.
Do the same re-configuration on the target prior to import and see if that resolves the problem.
Now, clearly this is not optimal and it would be really nice to find out WHY the conflict is occurring, but it would at least get this mapping imported for now.
Mike
And Vader, it is not that I don't have full faith that Oracle always raises the correct error message for a problem..... but, well, I've USED Oracle for too many years not to consider the possibility.
Case in point in OWB, try putting an invalid value into the OWB-supplied WB_Date_From_Julian function
e.g. select WB_Date_From_Julian(-1) from dual;
10:55:12 Error: ORA-21000: error number argument to raise_application_error of -1854 is out of range
ORA-06512: at "OWB_MGR.WB_DATE_FROM_JULIAN", line 7
because some bright puppy at Oracle decided to try and raise an Oracle Built-in Error via raise_application_error instead of just using "raise", and - of course - the Oracle error code isn't within the allowable range.
Error messages are nice, but you can't always trust 'em - which is why I look to expanded possibilities when neccessary. -
ORA-12838: cannot read/modify an object after modifying it in parallel
I am getting the above error when i hit this part in my load ....
can somebody suggest me why it could be in this case ?
MERGE INTO PART1 H
USING (SELECT PA1, PART1, CON1, GEO1, COUN1, KIT1 FROM W1 ) WH ON
(H.PART1=WH.PART1) --on PK darshan 01-03-2006
WHEN MATCHED THEN
UPDATE SET H.CON1 =WH.CON1, H.GEO1 = FN_GETGEOCODE ( WH.GEO1 ), H.COUN1 =WH.COUN1, H.KIT1 =WH.KIT1, H.DT1 =TO_NUMBER(TO_CHAR(FN_GETGMTDATE(SYSDATE),'YYYYMMDD')), H.DT_LAST1 = FN_GETGMTDATE(SYSDATE)
WHEN NOT MATCHED THEN
INSERT (H.PART1, H.PART2, H.CON1, H.GEO1, H.COUN1, H.KITD1, H.DT1, H.DT_1, H.DT_LAST_1)
VALUES(CASE FN_MERGE_COUNTER(gpi_inserting)
WHEN 0 THEN WH.PART1 END, WH.PARTN1, WH.CON1, FN_GETGEOCODE ( WH.GEO1), WH.COUNT1, WH.KIT1,
TO_NUMBER(TO_CHAR(FN_GETGMTDATE(SYSDATE),'YYYYMMDD')), PKG_COMMONACTIVITIES.FN_GETGMTDATE(SYSDATE), PKG_COMMONACTIVITIES.FN_GETGMTDATE(SYSDATE)
);does this give you a clue?
SQL> CREATE TABLE t AS
2 SELECT owner, object_name FROM all_objects
3 WHERE 1=0;
Table created.
SQL> INSERT /*+ APPEND */ INTO t
2 SELECT owner, object_name
3 FROM all_objects;
8982 rows created.
SQL> SELECT * FROM t;
SELECT * FROM t
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallelI bet that you need a commit after loading w1.
John -
DI API - accessing objects with Read only permissions
Scenario: I have setup a user in B1 with "Read Only permissions" on the Business Partner. When I log into the DI API as this user and try instantiating the BP object, I get a message "Loged on user does not have permissions".
Why am I getting this? Shouldnt I be able to instantiate the object and read the property values. i understand that I cannot Add or Update because of read only permissions.
Is there a way we can retreive values for users using the DI API or should the best option be to write a SQL statement.
Thanks,
GopalRequiring the user to have full authorization to instantiate an object is a serious limitation for the DI API. It makes it virtually useless. After all it is supposed to be OOP and all the trimmings isnt it? It also takes a lot of control away from the user.
+1
Hi,
I have confirmation from B1 product definition, the DI API access for objects with Read only permissions will not be included in the 2007A version. It will be considered for the following version after 2007A.
There is a chapter called "Authorization Checks" in the SDK Help file specifying:
"SAP Business One performs authorization checks for the business objects and the infrastructure and meta data objects. If a user does not have full authorization to access the objects in SAP Business One, the user will not have permission to access the data belonging to the business objects using the DI API."
Regards
Trinidad.
*sigh* -
Hi
We are having trouble storing inventory scans from some workstations.
We have a windows ONLY environment, with middle tier servers. (ZEN65SP1,
W2KSP4).
Some workstations are storing fine. The Storer function is working and we
can see the storer functions for the 'good' workstations in the Inventory
service window.
However some workstations can't store to the inventory db, but DO populate
eDir ZENworks inventory 'minimal information' but show "Scanner(Warning) :
027: Unable to read the sequence number from the Workstation object." in
the Scan Status...
The Inventory service window shows no attempt by these workstations - it's
almost as though the scan file is not arriving (though eDir knows/displays
the scan file name)
How does the workstation access the scandir in Windows only/middle tier
environment? Does the scan xml stream get sent to the MT via http and then
on to the scandir via CIFS?
Any suggestions/explanations welcome!!
Many thanks
DavidDavid,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
- Check all of the other support tools and options available at
http://support.novell.com.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://support.novell.com/forums)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://support.novell.com/forums/faq_general.html
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Product Support Forums Team
http://support.novell.com/forums/ -
027: Unable to read the sequence number from the Workstation object
Environment:
NW 6.5 sp4
Zen 6.5 sp1
We had a problem with our inventory server processing .STR files a couple
months ago - had to turn off inv. policies on workstations while we resolved
it. Now it's resolved and we're running inventory again. We have a large
number of workstations reporting this error:
027: Unable to read the sequence number from the Workstation object
They have no data in the DB, although they do have minimal scan info, and
the last scan status date matches that of the sequence number error.
I've seen this sporadically in the past and have been able to resolve it by
initiating a full scan on the individual workstation. However, that does
not seem to be making a difference this time.
Novell's troubleshooting document basically says see if the server's
running, and see if there's data for the workstation in the db. Then call
tech support.
Any other ideas?
~~~Nicoya...Jared wrote:
> Nicoya Helm,
>
>> 027: Unable to read the sequence number from the Workstation object
>
> I am thinking that this can also mean a previous full scan was not
> found. Or maybe the STR file name is bad.
>
> This information is stored here
> HKEY_LOCAL_MACHINE\Software\Novell\Workstation
> Manager\InvScanner\"STRFileName"
The machines I'm troubleshooting have valid formats for their STR names,
but that doesn't necessarily mean they are valid STR sequence numbers.
Does removing the value in the reg key cause the STR file name to be
recreated?
>
> Because imaging is used, it's possible that this information is matching
> on some machines which could cause problems.
I've verified that none of our images contain the c:\zenworks history
folder, and we run a script that cleans up any zenworks items before
sysprep (i.e. makes sure there's no registration info on the
workstations, etc). Our imaging scripts also clear any ZIS info to
avoid any duplication as well, so I don't think imaging would be causing
this.
> I believe 6x also has a hist.ini file like 3x inventory does, you might
> delete the file also.
Good tip about the hist.ini file, I didn't know about that. It does not
solve the sequence number error, but it does seem to force a full scan
of the system and cause the new scan to be stored in the DB, which was
not happening before.
Thanks!
Maybe you are looking for
-
I have to end it with Task Manager.
-
Some time ago I Inherited my wife's previous iPad along with her Apple ID for ICloud. I have now purchased a new iPad air 2 and transferred the old iPad info however her iCloud email address (gmail) came along with the transfer. I have my own Apple I
-
How to save a raw file in a different format
change file type from raw Message title was edited by: Brett N
-
SQ01 create query - can I do a function call to branch to an object
Hi All, I am fairly familiar with Queries and created one containing Work order number (but it could be any kind of object). Is there a way in SQ01 (not SE38) to program that via double-clicking on the object you can branch to it , i.e. can I call t-
-
Odd and Even Headers in Pages 5
I think this has been asked before, but is it possible to making different odd and even-paged headers in Pages 5? I can't figure it out.