Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within I/O and Streams
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
I/O and Streams
java.io.NotSerializableException:
shawn peter
Ranch Hand
Posts: 1325
1
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
this is my bean class
package my; public class Mybean { private String name; private int age; private String address; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
this is my bean save class
<%@ page import="my.Mybean, java.io.* " %> <% String message=""; try { //Create an instance. Set the properties Mybean address = new Mybean(); address.setAddress(request.getParameter("address")); address.setName(request.getParameter("name")); String name = request.getParameter("name"); String appRelativePath ="/WEB-INF/classes/"+ name+ ".ser"; String realPath = application.getRealPath(appRelativePath); //Serialize the object into the file FileOutputStream fos = new FileOutputStream(realPath); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(address); oos.close(); message = "Successfully saved the bean as " + realPath; } catch(Exception e){ e.printStackTrace(); message = "Error: Could not save the bean"; } %> <html><body> <h3><%= message %></h3> </body></html>
and this is my error
May 2, 2009 8:57:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:expression' did not find a matching property. May 2, 2009 8:57:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:jspFirst' did not find a matching property. May 2, 2009 8:57:45 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.6.0\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.6.0/bin/client;C:/Program Files/Java/jre1.6.0/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0\bin;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.16\lib\servlet-api.jar;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\Program Files\Rational\common;C:\Documents and Settings\aruna\Desktop\mysql-connector-java-5.1.7;C:\MATLAB7\bin\win32;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\apache-ant-1.7.1\bin May 2, 2009 8:57:45 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 May 2, 2009 8:57:45 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 609 ms May 2, 2009 8:57:45 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina May 2, 2009 8:57:45 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.16 May 2, 2009 8:57:45 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 May 2, 2009 8:57:45 PM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 May 2, 2009 8:57:45 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/31 config=null May 2, 2009 8:57:45 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 476 ms java.io.NotSerializableException: my.Mybean at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at org.apache.jsp.beanSaver_jsp._jspService(beanSaver_jsp.java:71) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)
Balu Sadhasivam
Ranch Hand
Posts: 874
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
To serialize the object , it must implement Serializable marker interface.
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Moved to the I/O forum.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
error in Driver
java.lang.NullPointerException
instantiation error
adding a Datasource to tomcat jndi
c:out gives error
More...