You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/04/29 15:55:16 UTC

DO NOT REPLY [Bug 28688] New: - Cant Deserialize the Class PerUserPoolDataSource

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28688>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28688

Cant Deserialize the Class PerUserPoolDataSource

           Summary: Cant Deserialize the Class PerUserPoolDataSource
           Product: Commons
           Version: 1.1 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Dbcp
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: matthias.schulze@gmx.de


Hello,

I want to send a DataSource from a servlet to a client per serialization.
I want to report a bug with deserializing the class
org.apache.commons.dbcp.datasources.PerUserPoolDataSource
with the code:

URL url = null;
try {
    url = new URL("http://ws1157:8080/resources/servlet/ds?datasource=" +
      "jdbc/photo/test");
}
catch (MalformedURLException ex) {
    ex.printStackTrace();
    return false;
}
InputStream in = null;
try {
    in = url.openStream();
}
catch (IOException ex) {
    ex.printStackTrace();
    return false;
}
BufferedInputStream bi = new BufferedInputStream(in);
ObjectInputStream ois = new ObjectInputStream(bi);
DataSource ds = (DataSource)ois.readObject();

The error is in the last line of code. The stacktrace is:

java.lang.NullPointerException
	at org.apache.commons.dbcp.datasources.PerUserPoolDataSource.readObject
(PerUserPoolDataSource.java:540)
	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 java.io.ObjectStreamClass.invokeReadObject
(ObjectStreamClass.java:838)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
	at java.io.ObjectInputStream.readOrdinaryObject
(ObjectInputStream.java:1646)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
	at de.bayern.blva.apps.infogeopoints.DBTest.init(DBTest.java:105)
	at de.bayern.blva.apps.infogeopoints.DBTest.<init>(DBTest.java:22)
	at de.bayern.blva.apps.geotools.MainClass._$614(MainClass.java:41)
	at de.bayern.blva.apps.geotools.MainClass.<init>(MainClass.java:23)
	at de.bayern.blva.apps.geotools.MainClass.main(MainClass.java:81)

this Bug is probably in the class
org.apache.commons.dbcp.datasources.InstanceKeyObjectFactory
in the method getObjectInstance.

In Line 141, the return-value is null. This is causing the error. The HashMap 
instanceMap contains no values. I dont know, where the values should come from. 
The HashMap is static, so it isnt serializised.

Please send an answer, because this feature would be critical for us to use 
this package.

Whith greatings
Matthias Schulze

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org