1

Hibernateセッションを開こうとすると、新しいHibernate構成を初期化するコードの一部が、「Servicejboss-循環依存関係があるように」例外で中断します。

コンソールアプリケーションから同じコードを呼び出すと、正しく機能します。

JBoss7.1がパックされているHibernate4.1.3と4.0.1の両方を試しましたが、同じエラーが発生しました。

誰かが私を正しい方向に動かすことができれば、私はそれをいただければ幸いです。

Configuration configuration = new Configuration();

JBoss出力:

...
11:30:00,482 INFO  [org.jboss.as] (MSC service thread 1-4) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 3324ms - Started 173 of 250 services (76 services are passive or on-demand)
11:30:00,571 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "JBCXFRS.war"
11:30:10,903 INFO  [org.jboss.resteasy.spi.ResteasyDeployment] (http-localhost-127.0.0.1-8080-2) Deploying javax.ws.rs.core.Application: class hr.spi.rs.MyApplication
11:30:24,081 INFO  [org.hibernate.annotations.common.Version] (http-localhost-127.0.0.1-8080-3) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
11:30:24,144 INFO  [org.hibernate.Version] (http-localhost-127.0.0.1-8080-3) HHH000412: Hibernate Core {4.1.3.Final}
11:30:24,213 INFO  [org.hibernate.cfg.Environment] (http-localhost-127.0.0.1-8080-3) HHH000206: hibernate.properties not found
11:30:24,233 INFO  [org.hibernate.cfg.Environment] (http-localhost-127.0.0.1-8080-3) HHH000021: Bytecode provider name : javassist
11:30:24,432 INFO  [org.hibernate.cfg.Configuration] (http-localhost-127.0.0.1-8080-3) HHH000043: Configuring from resource: /hibernate.cfg.xml
11:30:24,437 INFO  [org.hibernate.cfg.Configuration] (http-localhost-127.0.0.1-8080-3) HHH000040: Configuration resource: /hibernate.cfg.xml
11:30:24,825 INFO  [org.hibernate.cfg.Configuration] (http-localhost-127.0.0.1-8080-3) HHH000041: Configured SessionFactory: 
11:30:25,466 INFO  [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (http-localhost-127.0.0.1-8080-3) HHH000402: Using Hibernate built-in connection pool (not for production use!)
11:30:25,473 INFO  [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (http-localhost-127.0.0.1-8080-3) HHH000115: Hibernate connection pool size: 1
11:30:25,479 INFO  [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (http-localhost-127.0.0.1-8080-3) HHH000006: Autocommit mode: false
11:30:25,488 INFO  [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (http-localhost-127.0.0.1-8080-3) HHH000401: using driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] at URL [jdbc:sqlserver://MyDbServer;databaseName=MyDatabase]
11:30:25,496 INFO  [org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl] (http-localhost-127.0.0.1-8080-3) HHH000046: Connection properties: {user=sa, password=****}
11:30:38,571 INFO  [org.hibernate.dialect.Dialect] (http-localhost-127.0.0.1-8080-3) HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
11:30:38,837 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (http-localhost-127.0.0.1-8080-3) HHH000399: Using default transaction strategy (direct JDBC transactions)
11:30:38,897 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (http-localhost-127.0.0.1-8080-3) HHH000397: Using ASTQueryTranslatorFactory
11:30:39,868 INFO  [org.hibernate.validator.util.Version] (http-localhost-127.0.0.1-8080-3) Hibernate Validator 4.2.0.Final
11:30:40,289 INFO  [org.jboss.as.controller] (MSC service thread 1-2) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.naming (missing) dependents: [service jboss.data-source.java:jboss/datasources/ExampleDS, service jbosgi.xservice."javax.naming.InitialContext", service jbosgi.xservice."javax.naming.spi.InitialContextFactoryBuilder", service jboss.deployment.unit."JBCXFRS.war".CLEANUP] 
      service jboss.naming.context.java (missing) dependents: [service jboss.naming.context.java.TransactionManager] 

11:30:40,303 ERROR [stderr] (http-localhost-127.0.0.1-8080-3) Initial SessionFactory creation failed.org.jboss.msc.service.CircularDependencyException: Service jboss-as has a circular dependency
4

1 に答える 1

2

hibernate.cfg.xml の session-factory 部分の name パラメータを削除すると、「循環依存」エラーなしですべてが機能し始めます。

これを実行する際に問題が発生する理由や、不可解な JBoss 例外からそれを推測する方法がわかりません。

誰かが髪を引っ張るのを1日節約できることを願って、それを答えとして投稿してください。

<hibernate-configuration>
    <session-factory name="">
        ...

変更:

<hibernate-configuration>
    <session-factory>
        ...
于 2012-05-28T22:36:43.273 に答える