Я новичок в мире java-ee. Я пытаюсь реализовать приложение java-ee. У меня возникли проблемы с настройкой persistence.xml. Я хочу, чтобы java h2: mem был моей единицей сохранения. Hier мой persistence.xmlИспользовать H2-mem как постоянный блок
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="customerDatabase">
<description>My Customer-DB</description>
</persistence-unit>
<datasource jndi-name="java:jboss/datasources/ExampleDS"
pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</persistence>
Это то, что случилось с ним, потому что я получаю сообщение об ошибке:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'datasource'. One of '{"http://java.sun.com/xml/ns/persistence":persistence-unit}'
is expected.
, что делает persistence.xml мисс?
Я изменил своего провайдера, и теперь я использую спящий режим ... Теперь я получаю ошибки из другого порядка. Может ли кто-нибудь помочь?
11:21:46,092 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 59) MSC000001: Failed to start service jboss.persistenceunit."javaee7-master.war#customerDatabase": org.jboss.msc.service.StartException in service jboss.persistenceunit."javaee7-master.war#customerDatabase": javax.persistence.PersistenceException: [PersistenceUnit: customerDatabase] Unable to build Hibernate SessionFactory
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:665)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: customerDatabase] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1249)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:860)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)
... 7 more
Caused by: org.hibernate.AnnotationException: No identifier specified for entity: de.ostfalia.entity.Customer
at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:277)
at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:224)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:775)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
... 12 more
11:21:46,098 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "javaee7-master.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"javaee7-master.war#customerDatabase\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"javaee7-master.war#customerDatabase\": javax.persistence.PersistenceException: [PersistenceUnit: customerDatabase] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: customerDatabase] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.AnnotationException: No identifier specified for entity: de.ostfalia.entity.Customer"}}
11:21:46,197 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "postgresql-9.4-1203.jdbc42.jar" (runtime-name : "postgresql-9.4-1203.jdbc42.jar")
11:21:46,198 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "javaee7-master.war" (runtime-name : "javaee7-master.war")
11:21:46,200 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.persistenceunit."javaee7-master.war#customerDatabase": org.jboss.msc.service.StartException in service jboss.persistenceunit."javaee7-master.war#customerDatabase": javax.persistence.PersistenceException: [PersistenceUnit: customerDatabase] Unable to build Hibernate SessionFactory
persistence.xml не пропускает ничего. Вы пропустите чтение того, что он должен содержать. Что XSD в верхней части вашего файла сообщает вам, что вы можете поместить там http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd –
Вызвано: javax.persistence.PersistenceException: WFLYJPA0057: PersistenceProvider ' \t org.eclipse.persistence.jpa.PersistenceProvider – Lycone
и что это имеет отношение к чему-либо в «вопросе»? –