glTexImage2D complains about empty buffer

hello, i try to create a texture using this jogl function:

public void glTexImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, Buffer pixels);

unfortunately it always complains with this error:
Required 65536 remaining bytes in buffer, only had 0

the buffer i am providing is a ByteBuffer and it definitely has the right amount of bytes in in and is not empty.

YOu have to rewind your buffer.

thanks!