Help?

so I'm 17..I've tried to have sex when I was 16 with the boy I thought I'd be with forever, but it was almost as if my body was saying no..it was an insane amount of pain when he tried penetration, my lady parts weren't very..idk wet I guess, and I couldn't go along with it. thankfully he wasn't upset. but now with my new boyfriend, we mess around (as teenagers do) and he tries to finger me, but that hurts as well. I'm not really sure what this means, because this pain is on the inside, rather than the outside stretching like the first time I tried. so two questions. what does this mean, and how do you know you're ready to have sex?