アーティファクトのデプロイの最初に、Wildfly は persistence.xml に記述されているすべての永続ユニットを検証します。責任のあるクラスの 1 つはライブラリorg.jboss.as.jpa.processor.PersistenceUnitServiceHandler
からのものです。wildfly-jpa
主な質問: この検証を何らかの形で無効にすることは可能ですか? または、永続化ユニットを無視としてマークするだけですか?
根本原因の詳細:
環境フリーのアーティファクトを構築します。したがって、persistence.xml 内の構成は、最初の Java コードでオーバーライドされます。デフォルト設定はダミーで、次のようになります。
<persistence-unit name="cassandra_unit" transaction-type="RESOURCE_LOCAL">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>sample.model.Manager</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="kundera.nodes" value="localhost"/>
<property name="kundera.port" value="9165"/>
<property name="kundera.username" value="test"/>
<property name="kundera.password" value="test"/>
<property name="kundera.keyspace" value="keyspace"/>
<property name="kundera.dialect" value="cassandra"/>
<property name="kundera.client.lookup.class" value="com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory"/>
</properties>
</persistence-unit>
しかし、wildfly は永続ユニットと呼び出しを検証しますKunderaPersistence.createContainerEntityManagerFactory
。次に、Kundera は localhost:9165 に対して接続をチェックし、失敗します。そのため、展開も失敗します。
任意の回避策が受け入れられます。