Renewable energy and Electric Vehicles (EV) show potential to be promising solutions for energy cost saving and emission reduction. However, the integration of renewable energy generation into the electric grid can be difficult, because of the source intermittency and inconsistency with energy usage. In this paper, we study the problem of allocating energy from renewable sources to EVs in an energy efficient manner. We assume that the renewable energy supply is time variant and possibly unpredictable. EVs' charging requests should be satisfied within a specified time frame, which may incur a cost of drawing extra energy (possibly non-renewable energy) if the renewable energy supply is not sufficent to meet the deadlines and may also reduce energy efficiency. We formulate a stochastic optimization problem based on queueing model to minimize the time average cost of using other energy sources (and hence make most usage of the renewable energy source). The proposed approach fully considers the individual charging rate limit and deadline of each EV. The Lyapunov optimization technique is used to solve the problem. The developed dynamic control algorithm does not require knowledge of the statistics of the time-varying renewable energy generation, EV charging demand process, or extra energy pricing.