3
Class to test bank connection with Hibernate.
package br.drogaria.main;
public class HibernatUtilTeste {
public static void main(String[] args) {
//abre sessão
HibernateUtil.getFabricaDeSessao().openSession();
//fecha sessão
HibernateUtil.getFabricaDeSessao().close();
}
}
You’re making the mistakes:
- Configuration cannot be resolved Hibernatutil.java /Drogaria/src/main/java/br/drogaria/util line 17 Java Problem Description Resource Path Location Type
The line is:
ServiceRegistry registro = new StandardServiceRegistryBuilder()
.applySettings(configuration.getProperties()).build();
- Configuration cannot be resolved Hibernatutil.java /Drogaria/src/main/java/br/drogaria/util line 18 Java Problem Description Resource Path Location Type
The line is:
SessionFactory fabricaDeSessao = configuration.buildSessionFactory(registro);
- Hibernateutil cannot be resolved Hibernatutilteste.java /Drogaria/src/main/java/br/drogaria/main line 7 Java Problem Description Resource Path Location Type
The line is:
HibernateUtil.getFabricaDeSessao().openSession();
- The method buildFabricaDessao() is Undefined for the type Hibernatutil Hibernatutil.java /Drogaria/src/main/java/br/drogaria/util line 9 Java Problem Description Resource Path Location Type
The line is:
private static final SessionFactory fabricaDeSessao = buildFabricaDeSessao();
Obs, I don’t understand why the project didn’t create the web-in folder. I will create by hand and put the web.xml there, since it is also giving error by missing this file.
The webapp folder is empty. It has neither web-inf nor meta-inf. The complete path is:
C: For exampleSpring Drogaria src main webapp >
Follows the structure of web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<!-- Nome da Aplicação -->
<display-name>Drogaria</display-name>
</web-app>
I got the video description link.
Anything put the structure of hibernat.cfg.xml and pom.xml
@Techies If you can help me, I’m grateful, beauty? I changed some things, mainly in the name of objects
– André Nascimento
Read the last error, it says it did not find the file
web.xml
. You didn’t accidentally cut him out?– Jéf Bueno
As @jbueno said, the file is missing
web.xml
– DiegoAugusto
@jbueno the web.xml file is here at the root of the project. Actually, I saw this error, but it should not be missing in this detail.
– André Nascimento
At the root of the project Voce says would be in the folder
WEB-INF
?– DiegoAugusto
@jbueno I’ve already edited.
– André Nascimento
@Techies No. It’s in the Drugstore folder, which is the name of the artifact. It should be in web-inf?
– André Nascimento
Yeah, you should be in
Webapp > WEB-INF
– DiegoAugusto
Let’s go continue this discussion in chat.
– André Nascimento