I tried with your code snippet. It works fine for me. So the problem should be with your "commonPanel". What I did was, I add this "commonPanel" to the content pane by setting GridBagConstaints as well.
frame.getContentPane().setLayout(GridBagLayout());
GridBagConstraints x = new GridBagConstraints();
x.weightx = 1.0;
x.weighty = 1.0;
x.fill = GridBagConstraints.BOTH;
JPanel commonPanel = new JPanel(new GridBagLayout());
frame.getContentPane().add(commonPanel, x);
As I realized, you should change the code related to your commonPanel.