Eclipse import may not be allowed after Java upgrade

I have a class that uses hibernate, I included all the necessary banks in the classpath and a class that worked before Java was updated itself. But now eclipse shows that it cannot allow hibernation imports. What could be the solution to this?

import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; 
+3
source share
6 answers

If you type (Ctrl + shift + t) or open “Type Browser” and enter “SessionFactory” or “Configuration”, will Eclipse find them? If not, then surely you have some problems in the .jar files. Try to remove and replace them.

By the way, are you using a Mac or PC?

+4
source

Have you tried "Project> Clean ..."? What is the exact error message? After updating Java, you may need to update the path to the JDK: "Window> Settings> Java> Installed JREs"

+5
source

I had a similar problem that was fixed when I used the Grails> Refresh Dependencies tools (Alt + G, R). This was in SpringSource Tool Suite 2.7.1.

I needed to run this time to properly initialize the plugins (after importing from SVN), and then a second time to get links to the work.

+2
source

Delete .m2 / repository / org / hibernate / *, then in eclipse: Maven / update Project. It will load the dependencies again. It worked for me!

+1
source

even i ran into the same problem. everything worked fine, but every suden every jsp page started giving me an error saying org.apache.jasper.JasperException: it is not possible to compile a class for JSP:

An error occurred in the line: 1 in the generated java file Type org.hibernate.SessionFactory cannot be resolved. This is an indirect reference to the required .class files.

An error occurred in line: 9 in the generated java file. Only type can be imported. org.hibernate.Query permits package

An error occurred in line: 11 in the generated java file. Only type can be imported. org.hibernate.Session allows package

An error occurred in the line: 12 in the generated java file. Only type can be imported. org.hibernate.SessionFactory permits package

An error occurred in the line: 13 in the generated java file. Only type can be imported. org.hibernate.cfg.Configuration allows the package

to solve this problem in eclipse, I deleted / deleted the server from eclipse and added my tomcat server and everything started working the same way as before .....

thanks

0
source

Today I ran into this problem. I think the eclipse tells me that he wants to solve something, but does not know what problem and how. And here it is:

 SessionFactory factory; try { factory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { System.err.println("Failed to create sessionFactory object." + ex); throw new ExceptionInInitializerError(ex); } 

Mubby it helps. In my case, it was exception handling.

0
source

Source: https://habr.com/ru/post/1383218/


All Articles