在EJB项目中添加JPA实体并在Eclipse juno上使用JBOSS AS 7.1
执行时获取错误。
我收到错误代码404
。
控制台文件如下
10:54:40,085 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"Test14-03.ear/TestEjb14-03.jar#TestEjb14-03\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"Test14-03.ear/TestEjb14-03.jar#TestEjb14-03\": Failed to start service"}}}}
我的persistance.xml如下
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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_2_0.xsd">
<persistence-unit name="TestEjb14-03">
<class>model.Dog</class>
<class>model.User</class>
</persistence-unit>
</persistence>
我的控制台输出如下
14:51:42,858 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011402: Starting Persistence Unit Service 'Test14-03.ear/TestEjb14-03.jar#TestEjb14-03'
14:51:43,038 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-3) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
14:51:43,050 INFO [org.hibernate.Version] (MSC service thread 1-3) HHH000412: Hibernate Core {4.0.1.Final}
14:51:43,052 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH000206: hibernate.properties not found
14:51:43,055 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH000021: Bytecode provider name : javassist
14:51:43,077 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-3) HHH000204: Processing PersistenceUnitInfo [
name: TestEjb14-03
...]
14:51:43,394 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."Test14-03.ear/TestEjb14-03.jar#TestEjb14-03": org.jboss.msc.service.StartException in service jboss.persistenceunit."Test14-03.ear/TestEjb14-03.jar#TestEjb14-03": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_15]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_15]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: TestEjb14-03] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
Caused by: org.hibernate.MappingException: property mapping has wrong number of columns: model.User.email type: object
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468)
at org.hibernate.mapping.RootClass.validate(RootClass.java:268)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1287)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1729)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 9 more
14:51:43,634 INFO [org.apache.catalina.core.StandardContext] (MSC service thread 1-3) The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
14:51:43,636 INFO [org.apache.catalina.core.StandardContext] (MSC service thread 1-3) The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
14:51:43,723 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/TestWeb14-03'
14:51:46,743 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-3) Hibernate Validator 4.2.0.Final
14:51:48,034 INFO [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /TestWeb14-03
14:51:48,036 INFO [org.jboss.as] (MSC service thread 1-4) JBAS015951: Admin console listening on http://127.0.0.1:9990
14:51:48,036 ERROR [org.jboss.as] (MSC service thread 1-4) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 13062ms - Started 315 of 399 services (3 services failed or missing dependencies, 80 services are passive or on-demand)
14:51:48,039 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "Test14-03.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"Test14-03.ear/TestEjb14-03.jar#TestEjb14-03\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"Test14-03.ear/TestEjb14-03.jar#TestEjb14-03\": Failed to start service"}}
14:51:48,196 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment TestWeb14-03.war in 155ms
14:51:48,197 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment TestEjb14-03.jar in 156ms
14:51:48,199 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment Test14-03.ear in 158ms
14:51:48,247 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.persistenceunit."Test14-03.ear/TestEjb14-03.jar#TestEjb14-03": org.jboss.msc.service.StartException in service jboss.persistenceunit."Test14-03.ear/TestEjb14-03.jar#TestEjb14-03": Failed to start service
14:51:48,250 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"Test14-03.ear/TestEjb14-03.jar#TestEjb14-03\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"Test14-03.ear/TestEjb14-03.jar#TestEjb14-03\": Failed to start service"}}}}