FBO Confusion

I’ve just started messing around with frame buffer objects and decided to try and replicate a cube within cube offscreen rendering demo.
Below is the code used to create the FBO, the texture rendered too is simply an empty RGB texture:

 myGL.glGenFramebuffersEXT( 1, fbo);
            myGL.glBindFramebufferEXT( GL.GL_FRAMEBUFFER_EXT, fbo[0] );
	    myGL.glFramebufferTexture2DEXT( GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_TEXTURE_2D, cube[0], 0 );
		
	    myGL.glGenRenderbuffersEXT( 1, dbo );
	    myGL.glBindRenderbufferEXT( GL.GL_RENDERBUFFER_EXT, dbo[0] );
	    myGL.glRenderbufferStorageEXT( GL.GL_RENDERBUFFER_EXT, GL.GL_DEPTH_COMPONENT24, cubeSize, cubeSize );
	    myGL.glFramebufferRenderbufferEXT( GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT,         dbo[0]);
		
		
		 int status = myGL.glCheckFramebufferStatusEXT (GL.GL_FRAMEBUFFER_EXT);
		switch (status)
		{
		case GL.GL_FRAMEBUFFER_COMPLETE_EXT:
			System.out.println("FrameBuffer Created");
		    break;
		case GL.GL_FRAMEBUFFER_UNSUPPORTED_EXT:
		    System.out.println("FBO configuration unsupported");
		    break;
		default:
		    System.out.println( "FBO programmer error" );
		    break;
		}

below is the code used to draw the cubes

	
	  	
	  		myGL.glBindFramebufferEXT (GL.GL_FRAMEBUFFER_EXT, fbo[0]);
	  		myGL.glBindRenderbufferEXT( GL.GL_RENDERBUFFER_EXT, dbo[0] );
	
	  		myGL.glViewport( 0, 0, cubeSize,cubeSize );
			myGL.glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );

			myGL.glClear( GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT );
			
			myGL.glMatrixMode( GL.GL_MODELVIEW );
			myGL.glLoadIdentity();
	  
	  		myGL.glBindTexture(GL.GL_TEXTURE_2D, grassTex[0]);
	  		
	
   			drawCube();
   	
   			
   			myGL.glBindFramebufferEXT (GL.GL_FRAMEBUFFER_EXT, 0);
   			myGL.glBindRenderbufferEXT( GL.GL_RENDERBUFFER_EXT, 0 );
   			
   			myGL.glViewport( 0, 0, windowWidth, windowHeight );
			myGL.glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );

			myGL.glClear( GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT );
   			
   			myGL.glMatrixMode( GL.GL_MODELVIEW );
			myGL.glLoadIdentity();
   		

  			myGLU.gluLookAt (camera[0],
			     camera[1],
			     camera[2],
			     camera_x, camera_y, camera_z,
			     0.0, 0.0, 1.0);
  		

  		myGL.glBindTexture(GL.GL_TEXTURE_2D, cube[0]);
  		
   		drawCube();

This code doesn’t rotate either cube for obvious reasons. The problem i encountered is that when i attempted to push and pop matrices (to rotate the cube to be rendered to texture) the virtual machine crashed. I’m fairly new to the topic and realise this is probably something simple i’m missing. Anyone got any suggestions on the problem and thanks in advance.

Edit: It would appear that pushes and pops are not necessarily the cause, following a compilation, the program will execute once or twice succesfully and the crash the next time with an access violation error. all programs are shut down cleanly so i’m still perplexed.