I am muddling thru this and thought I would throw it out to see if anyone
has some experience with it. I am using mysql 5.0.37 I have set the character set type in entityengine.xml to "utf8", dropped the db and ran run-install First I got a "max_allowed_packet" error when trying to upload an image file. I fixed by changing my.cnf. to allow up to 2M. Now I get a "Data too long for column" on a blob field. The file size is 700KB. Right before the error in console.log, there are these warnings: 2008-03-20 14:32:49,741 (http-0.0.0.0-8443-Processor2) [ ObjectType.java:949:INFO ] No type conversion available for java.nio.HeapByteBuffer to java.nio.ByteBuffer, returning original object. 2008-03-20 14:32:49,743 (http-0.0.0.0-8443-Processor2) [ GenericEntity.java:408:WARN ] In entity field [ImageDataResource.imageData] set the value passed in [java.nio.HeapByteBuffer] is not compatible with the Java type of the field [java.sql.Blob] Thanks for any insight. I am going to take a nap now. Please have your answers ready for when I wake up. Thanks, -Al |
Hello Al,
I think you can make some changes to the type of the data of the image file which you are uploding. The type of the image data which is saved in ImageDataResource is "blob". So i think you need to convert the data to ByteBuffter then you can save data in the ImageDataResource Entity, also where you are uploading it in the service the type of attribute can be "java.nio.ByteBuffer". On Fri, Mar 21, 2008 at 2:38 AM, Al Byers <[hidden email]> wrote: > I am muddling thru this and thought I would throw it out to see if anyone > has some experience with it. > > I am using mysql 5.0.37 > I have set the character set type in entityengine.xml to "utf8", dropped > the > db and ran run-install > > First I got a "max_allowed_packet" error when trying to upload an image > file. I fixed by changing my.cnf. to allow up to 2M. > > Now I get a "Data too long for column" on a blob field. The file size is > 700KB. > > Right before the error in console.log, there are these warnings: > > 2008-03-20 14:32:49,741 (http-0.0.0.0-8443-Processor2) [ > ObjectType.java:949:INFO ] No type conversion available for > java.nio.HeapByteBuffer to java.nio.ByteBuffer, returning original object. > 2008-03-20 14:32:49,743 (http-0.0.0.0-8443-Processor2) [ > GenericEntity.java:408:WARN ] In entity field [ImageDataResource.imageData > ] > set the value passed in [java.nio.HeapByteBuffer] is not compatible with > the > Java type of the field [java.sql.Blob] For this i think you should also read the file back from ImageDataResource to check whether the data uploaded. > > > > Thanks for any insight. > I am going to take a nap now. Please have your answers ready for when I > wake > up. > > Thanks, > -Al > -- Thanks & Regards -- Pranay Pandey Inodre, India |
Thanks Pranay,
This was helpful, but I am chasing my tail trying to find out where java.nio.HeapByteBuffer is loaded. That is what is returned in ServiceEventHandler at line 217. I find that HeapBuffer.allocate returns an object of HeapByteBuffer type, but can't find that in Java APIs for ver. 1.42, 1.5 or 6.0. Is that what the current version of Tomcat is using? Any help here would be appreciated. Thanks again, -Al On 3/20/08, Pranay Pandey <[hidden email]> wrote: > > Hello Al, > > I think you can make some changes to the type of the data of the image > file > which you are uploding. > The type of the image data which is saved in ImageDataResource is "blob". > So > i think you need to convert the data to ByteBuffter then you can save data > in the ImageDataResource Entity, also where you are uploading it in the > service the type of attribute can be "java.nio.ByteBuffer". > > On Fri, Mar 21, 2008 at 2:38 AM, Al Byers <[hidden email]> > wrote: > > > > I am muddling thru this and thought I would throw it out to see if > anyone > > has some experience with it. > > > > I am using mysql 5.0.37 > > I have set the character set type in entityengine.xml to "utf8", dropped > > the > > db and ran run-install > > > > First I got a "max_allowed_packet" error when trying to upload an image > > file. I fixed by changing my.cnf. to allow up to 2M. > > > > Now I get a "Data too long for column" on a blob field. The file size is > > 700KB. > > > > Right before the error in console.log, there are these warnings: > > > > 2008-03-20 14:32:49,741 (http-0.0.0.0-8443-Processor2) [ > > ObjectType.java:949:INFO ] No type conversion available for > > java.nio.HeapByteBuffer to java.nio.ByteBuffer, returning original > object. > > 2008-03-20 14:32:49,743 (http-0.0.0.0-8443-Processor2) [ > > GenericEntity.java:408:WARN ] In entity field [ > ImageDataResource.imageData > > ] > > set the value passed in [java.nio.HeapByteBuffer] is not compatible with > > the > > Java type of the field [java.sql.Blob] > > > > For this i think you should also read the file back from ImageDataResource > to check whether the data uploaded. > > > > > > > > > > Thanks for any insight. > > I am going to take a nap now. Please have your answers ready for when I > > wake > > up. > > > > Thanks, > > -Al > > > > > > > -- > Thanks & Regards > > -- > Pranay Pandey > Inodre, India > |
Hello Al,
Yes I also agree to that we are not having the class HeapByteBuffer in java.nio package in Java APIs. I have also gone through ServiceEventHandler and found that we are just wrapping up the byte array into a ByteBuffer. When i applied a search for HeapByteBuffer in *.* got one result which is in SqlJdbcUtil.java. Also tried to find out the documentation for this class and found a relevant link for this, may be this link can be of help. http://dmi.ensica.fr/doc/Java/j2sdk-1_4_2-doc/docs/j2h/java.nio.index.html. -- Thanks & Regards -- Pranay Pandey Inodre, India On Tue, Mar 25, 2008 at 12:55 AM, Al Byers <[hidden email]> wrote: > Thanks Pranay, > > This was helpful, but I am chasing my tail trying to find out where > java.nio.HeapByteBuffer is loaded. That is what is returned in > ServiceEventHandler at line 217. I find that HeapBuffer.allocate returns > an > object of HeapByteBuffer type, but can't find that in Java APIs for ver. > 1.42, 1.5 or 6.0. Is that what the current version of Tomcat is using? > > Any help here would be appreciated. > > Thanks again, > -Al > > On 3/20/08, Pranay Pandey <[hidden email]> wrote: > > > > Hello Al, > > > > I think you can make some changes to the type of the data of the image > > file > > which you are uploding. > > The type of the image data which is saved in ImageDataResource is > "blob". > > So > > i think you need to convert the data to ByteBuffter then you can save > data > > in the ImageDataResource Entity, also where you are uploading it in the > > service the type of attribute can be "java.nio.ByteBuffer". > > > > On Fri, Mar 21, 2008 at 2:38 AM, Al Byers <[hidden email]> > > wrote: > > > > > > > I am muddling thru this and thought I would throw it out to see if > > anyone > > > has some experience with it. > > > > > > I am using mysql 5.0.37 > > > I have set the character set type in entityengine.xml to "utf8", > dropped > > > the > > > db and ran run-install > > > > > > First I got a "max_allowed_packet" error when trying to upload an > image > > > file. I fixed by changing my.cnf. to allow up to 2M. > > > > > > Now I get a "Data too long for column" on a blob field. The file size > is > > > 700KB. > > > > > > Right before the error in console.log, there are these warnings: > > > > > > 2008-03-20 14:32:49,741 (http-0.0.0.0-8443-Processor2) [ > > > ObjectType.java:949:INFO ] No type conversion available for > > > java.nio.HeapByteBuffer to java.nio.ByteBuffer, returning original > > object. > > > 2008-03-20 14:32:49,743 (http-0.0.0.0-8443-Processor2) [ > > > GenericEntity.java:408:WARN ] In entity field [ > > ImageDataResource.imageData > > > ] > > > set the value passed in [java.nio.HeapByteBuffer] is not compatible > with > > > the > > > Java type of the field [java.sql.Blob] > > > > > > > > For this i think you should also read the file back from > ImageDataResource > > to check whether the data uploaded. > > > > > > > > > > > > > > > > Thanks for any insight. > > > I am going to take a nap now. Please have your answers ready for when > I > > > wake > > > up. > > > > > > Thanks, > > > -Al > > > > > > > > > > > > > -- > > Thanks & Regards > > > > -- > > Pranay Pandey > > Inodre, India > > > |
Pranay,
I found that HeapByteBuffer is a private subclass of ByteBuffer, which is why you don't see it in the apis. I don't think it is the problem. When I get around to it, I am going to upgrade my version of MySQL and try Postgres, as well. -Al On Tue, Mar 25, 2008 at 12:18 AM, Pranay Pandey <[hidden email]> wrote: > Hello Al, > > Yes I also agree to that we are not having the class HeapByteBuffer in > java.nio package in Java APIs. I have also gone through > ServiceEventHandler > and found that we are just wrapping up the byte array into a ByteBuffer. > When i applied a search for HeapByteBuffer in *.* got one result which is > in > SqlJdbcUtil.java. > Also tried to find out the documentation for this class and found a > relevant > link for this, may be this link can be of help. > http://dmi.ensica.fr/doc/Java/j2sdk-1_4_2-doc/docs/j2h/java.nio.index.html > . > > -- > Thanks & Regards > -- > Pranay Pandey > Inodre, India > > On Tue, Mar 25, 2008 at 12:55 AM, Al Byers <[hidden email]> > wrote: > > > Thanks Pranay, > > > > This was helpful, but I am chasing my tail trying to find out where > > java.nio.HeapByteBuffer is loaded. That is what is returned in > > ServiceEventHandler at line 217. I find that HeapBuffer.allocate returns > > an > > object of HeapByteBuffer type, but can't find that in Java APIs for ver. > > 1.42, 1.5 or 6.0. Is that what the current version of Tomcat is using? > > > > Any help here would be appreciated. > > > > Thanks again, > > -Al > > > > On 3/20/08, Pranay Pandey <[hidden email]> wrote: > > > > > > Hello Al, > > > > > > I think you can make some changes to the type of the data of the image > > > file > > > which you are uploding. > > > The type of the image data which is saved in ImageDataResource is > > "blob". > > > So > > > i think you need to convert the data to ByteBuffter then you can save > > data > > > in the ImageDataResource Entity, also where you are uploading it in > the > > > service the type of attribute can be "java.nio.ByteBuffer". > > > > > > On Fri, Mar 21, 2008 at 2:38 AM, Al Byers <[hidden email] > > > > > wrote: > > > > > > > > > > I am muddling thru this and thought I would throw it out to see if > > > anyone > > > > has some experience with it. > > > > > > > > I am using mysql 5.0.37 > > > > I have set the character set type in entityengine.xml to "utf8", > > dropped > > > > the > > > > db and ran run-install > > > > > > > > First I got a "max_allowed_packet" error when trying to upload an > > image > > > > file. I fixed by changing my.cnf. to allow up to 2M. > > > > > > > > Now I get a "Data too long for column" on a blob field. The file > size > > is > > > > 700KB. > > > > > > > > Right before the error in console.log, there are these warnings: > > > > > > > > 2008-03-20 14:32:49,741 (http-0.0.0.0-8443-Processor2) [ > > > > ObjectType.java:949:INFO ] No type conversion available for > > > > java.nio.HeapByteBuffer to java.nio.ByteBuffer, returning original > > > object. > > > > 2008-03-20 14:32:49,743 (http-0.0.0.0-8443-Processor2) [ > > > > GenericEntity.java:408:WARN ] In entity field [ > > > ImageDataResource.imageData > > > > ] > > > > set the value passed in [java.nio.HeapByteBuffer] is not compatible > > with > > > > the > > > > Java type of the field [java.sql.Blob] > > > > > > > > > > > > For this i think you should also read the file back from > > ImageDataResource > > > to check whether the data uploaded. > > > > > > > > > > > > > > > > > > > > > > Thanks for any insight. > > > > I am going to take a nap now. Please have your answers ready for > when > > I > > > > wake > > > > up. > > > > > > > > Thanks, > > > > -Al > > > > > > > > > > > > > > > > > > > -- > > > Thanks & Regards > > > > > > -- > > > Pranay Pandey > > > Inodre, India > > > > > > |
Free forum by Nabble | Edit this page |