We propose the stochastic factor model of optimal investment and reinsurance of insurers where the wealth processes are described by a bank account and a risk asset for investment and a Cramér-Lundberg process for reinsurance. The optimization is obtained through maximizing the exponential utility. Owing to the claims driven by a Poisson process, the proposed optimization problem is naturally treated as a jump-diffusion control problem. Applying the dynamic programming, we have the Hamilton-Jacobi-Bellman (HJB) equations and the corresponding explicit solution for the corresponding HJB. Hence, the optimal values and optimal strategies can be obtained. Finally, in numerical analysis, we illustrate the performance of the proposed optimization according to the results of the corresponding value function. In addition, compared to the wealth process without investment, the efficiency of the proposed optimization is discussed in terms of ruin probabilities.