| I need to serialize some objects for use in web services and am getting the following exception for this example code: Error occurs on both Xcode 2.0/WO 5.2.4 and Xcode 2.2/WO 5.3.1... Simply calling this static method from Application class as a test. Doesn't seem to matter where it's called: also tried calling it from an action method on Main page. public static void serialize() { String fileName = "/tmp/example.xml"; BufferedOutputStream os = null; NSXMLOutputStream xmlos = null; try { // File output stream os = new BufferedOutputStream(new FileOutputStream(fileName)); // XML output stream xmlos = new NSXMLOutputStream(os); // Write the data xmlos.writeObject("Hello World!"); xmlos.writeInt(5); } catch (Exception e) { NSLog.err.appendln("Exception encountered: " + e.getMessage()); if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelCritical)) { NSLog.debug.appendln(e); } } finally { try { // close the streams xmlos.flush(); xmlos.close(); os.close(); } catch (Exception e) { NSLog.err.appendln("Exception encountered: " + e.getMessage()); if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelCritical)) { NSLog.debug.appendln(e); } } } } ------------------------ Exception: [2005-12-14 10:56:29 EST] <main> java.lang.NullPointerException at ProcessorService.serialize(ProcessorService.java:70) at Application.<init>(Application.java:52) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at java.lang.Class.newInstance0(Class.java:308) at java.lang.Class.newInstance(Class.java:261) at com.webobjects.appserver.WOApplication.main(WOApplication.java:323) at Application.main(Application.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.webobjects._bootstrap.WOBootstrap.main(WOBootstrap.java:71) |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]
