出于某种原因,我无法再部署我的项目了。
我收到以下错误消息:
23:03:58,847 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
23:03:59,219 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
23:03:59,276 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
23:04:00,736 INFO [org.xnio] XNIO Version 3.0.3.GA
23:04:00,736 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
23:04:00,745 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
23:04:00,751 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
23:04:00,798 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
23:04:00,803 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
23:04:00,808 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
23:04:00,813 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
23:04:00,819 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
23:04:00,828 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
23:04:00,878 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
23:04:00,892 INFO [org.jboss.as.naming] (MSC service thread 1-5) JBAS011802: Starting Naming Service
23:04:00,911 INFO [org.jboss.as.security] (MSC service thread 1-6) JBAS013100: Current PicketBox version=4.0.7.Final
23:04:00,933 INFO [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default]
23:04:00,971 INFO [org.jboss.as.connector] (MSC service thread 1-5) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
23:04:01,095 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
23:04:01,352 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-2) JBoss Web Services - Stack CXF Server 4.0.2.GA
23:04:01,562 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-3) Starting Coyote HTTP/1.1 on http-localhost-127.0.0.1-8080
23:04:01,641 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\Wolf\jboss-as-7.1.1.Final\standalone\deployments
23:04:01,644 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015014: Re-attempting failed deployment h2console.war
23:04:01,650 WARN [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015002: Deployment of 'h2console' requested, but the deployment is not present
23:04:01,682 INFO [org.jboss.as.remoting] (MSC service thread 1-7) JBAS017100: Listening on localhost/127.0.0.1:4447
23:04:01,684 INFO [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /127.0.0.1:9999
23:04:01,684 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
23:04:01,815 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "myprojectname.war"
23:04:01,815 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "h2console.war"
23:04:02,413 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for primary
23:04:02,468 INFO [org.jboss.web] (MSC service thread 1-8) JBAS018210: Registering web context: /h2console
23:04:02,545 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016002: Processing weld deployment myprojectname.war
23:04:02,663 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016005: Starting Services for CDI deployment: myprojectname.war
23:04:02,686 INFO [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900 1.1.5 (AS71)
23:04:02,705 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [jboss/datasources/myprojectnameDS]
23:04:02,706 INFO [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011402: Starting Persistence Unit Service 'myprojectname.war#primary'
23:04:02,791 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-6) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
23:04:02,797 INFO [org.hibernate.Version] (MSC service thread 1-6) HHH000412: Hibernate Core {4.0.1.Final}
23:04:02,800 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-6) HHH000206: hibernate.properties not found
23:04:02,801 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-6) HHH000021: Bytecode provider name : javassist
23:04:02,821 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-6) HHH000204: Processing PersistenceUnitInfo [
name: primary
...]
23:04:03,040 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-6) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
23:04:03,259 INFO [org.hibernate.dialect.Dialect] (MSC service thread 1-6) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
23:04:03,264 WARN [org.hibernate.dialect.H2Dialect] (MSC service thread 1-6) HHH000431: Unable to determine H2 database version, certain features may not work
23:04:03,268 INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC service thread 1-6) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
23:04:03,275 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-6) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
23:04:03,281 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-6) HHH000397: Using ASTQueryTranslatorFactory
23:04:03,311 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-6) Hibernate Validator 4.2.0.Final
23:04:03,322 INFO [org.hibernate.validator.xml.ValidationXmlParser] (MSC service thread 1-6) META-INF/validation.xml found. Parsing XML based configuration.
23:04:03,520 INFO [org.hibernate.validator.xml.ValidationXmlParser] (MSC service thread 1-6) Using org.hibernate.validator.HibernateValidator as validation provider.
23:04:03,520 INFO [org.hibernate.validator.xml.ValidationXmlParser] (MSC service thread 1-6) Using org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator as message interpolator.
23:04:03,521 INFO [org.hibernate.validator.xml.ValidationXmlParser] (MSC service thread 1-6) Using org.hibernate.validator.engine.resolver.DefaultTraversableResolver as traversable resolver.
23:04:03,522 INFO [org.hibernate.validator.xml.ValidationXmlParser] (MSC service thread 1-6) Using org.hibernate.validator.engine.ConstraintValidatorFactoryImpl as constraint factory.
23:04:04,104 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.persistenceunit."myprojectname.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."myprojectname.war#primary": 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_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: primary] 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.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:93)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:118)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:70)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:53)
at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:131)
at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2323)
at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2346)
at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3612)
at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:3598)
at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:1013)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:422)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 9 more
23:04:04,122 INFO [org.jboss.as] (MSC service thread 1-1) JBAS015951: Admin console listening on http://onetwoseven.0.0.1:9990
23:04:04,125 ERROR [org.jboss.as] (MSC service thread 1-1) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 5681ms - Started 211 of 311 services (21 services failed or missing dependencies, 78 services are passive or on-demand)
23:04:04,326 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "myprojectname.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"myprojectname.war#primary\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"myprojectname.war#primary\": Failed to start service"}}
23:04:04,329 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015871: Deploy of deployment "h2console.war" was rolled back with no failure message
23:04:04,389 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010409: Unbound data source [jboss/datasources/myprojectnameDS]
23:04:04,654 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment h2console.war in 325ms
23:04:04,801 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment myprojectname.war in 472ms
23:04:04,804 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.persistenceunit."myprojectname.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."myprojectname.war#primary": Failed to start service
23:04:04,811 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS014654: Composite operation was rolled back
23:04:04,818 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.\"myprojectname.war#primary\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"myprojectname.war#primary\": Failed to start service"}}}}
的persistence.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="primary">
<!-- If you are running in a production environment, add a managed
data source, the example data source is just for development and testing! -->
<jta-data-source>java:jboss/datasources/myprojectnameDS</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
</properties> </persistence-unit> </persistence>
我尝试运行maven clean和maven update项目,但这根本没有效果。导致此错误的原因是什么,我该如何解决?
答案 0 :(得分:2)
我忘了将@OneToMany
添加到其中一个集合中。
编辑:我刚刚注意到我获得了这个问题的金奖(“着名问题”),我觉得我不值得。所以我想完成我的答案。我猜大多数人都在继续寻找Jboss服务异常。异常可能意味着什么 - 您必须识别项目的问题。我没有正确读取Stacktrace。它说:
org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
因此,寻找该异常将有助于确定问题。在我的情况下,我搞砸了hibernate注释。阅读你的例外情况!