John 12:23-28 (DRB)
But Jesus answered them, saying: The hour is come, that the Son of man should be glorified. 24 Amen, amen I say to you, unless the grain of wheat falling into the ground die, 25 Itself remaineth alone. But if it die, it bringeth forth much fruit. He that loveth his life shall lose it; and he that hateth his life in this world, keepeth it unto life eternal. 26 If any man minister to me, let him follow me; and where I am, there also shall my minister be. If any man minister to me, him will my Father honour. 27 Now is my soul troubled. And what shall I say? Father, save me from this hour. But for this cause I came unto this hour. 28 Father, glorify thy name. A voice therefore came from heaven: I have both glorified it, and will glorify it again.
We here see His "hour" being connected with "[glorification]" (cf. 2:11), and the occasion for or means to that glory: here His Passion and death (cf. Revelation 3:10).
So here in John 2:4, Jesus isn't contradicting Himself, but is simply saying that all acts which will bring Him glory ought to be left to His 'hour' to which glorification is proper—'its not yet time for the Son of Man to be glorified, yet you are asking for something which will bring me glory.' He works this miracle for her sake (He clearly shows some kind of reluctance, yet goes on to do this great miracle), and so it is not a contradiction. His words can't be taken to have been a rebuke, or reluctance to the point of a refusal, since Mary goes on to act as if He implicitly said 'yes:'
And the wine failing, the mother of Jesus saith to him: They have no wine. 4 And Jesus saith to her: Woman, what is that to me and to thee? my hour is not yet come. 5 His mother saith to the waiters: Whatsoever he shall say to you, do ye.
And it would be ridiculous to claim that Mary disobeys Jesus so she can tell others to obey Jesus directly after—Jesus only showed reluctance, not an outright refusal, as evidenced by His doing the miracle, and before this, Mary's reaction to His words.