Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMarsoni X
Front End Web Development Techdegree Student 417 PointsType mismatch: cannot convert from StandardServiceRegistry to ServiceRegistry
I'm coding the same as the instructor is doing in this video. But I get a warning as given in the title. In eclipse, it is telling me to cast to ServiceRegistry(and it is working on cast). All I wanted to know is, how come the instructor not getting this error/warning. Is it because he is using IntelliJ? Is there a way that I can do it without casting the object, If so How can I do this?
4 Answers
Marsoni X
Front End Web Development Techdegree Student 417 PointsGot it, There was a wrong Import done. :) I had to import:
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
Marvin Deutz
8,349 PointsJust a quick Headsup for anyone having the same problem. There is also a ServiceRegistry in Java (Javax.io I think). IntelliJ imported this one and the hibernate one for me automatically, but it somehow used the Java one. So I had to delete the Java Service registry import and then type the hibernate one again.
Anthony Amicarelli
5,375 PointsI had the same issue. I had to remove this import which intellij added:
import javax.imageio.spi.ServiceRegistry;
and add this one:
import org.hibernate.service.ServiceRegistry;
Nelson Fleig
25,570 PointsI had the same problem. Thanks for pointing that out :)
Caleb Kleveter
Treehouse Moderator 37,862 PointsCaleb Kleveter
Treehouse Moderator 37,862 PointsI am glad you figured it out! I marked your answer as best because it explains how you solved your problem. If you ever solve your own problem in the future, feel free to mark your own answer as best!