0

プロジェクトを JBoss EAP 7.1 にデプロイしようとすると、次のエラーが発生します (スタックトレース?):

16:13:07,986 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"test.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"test.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class rest.RestResource for component RestResource has errors: 
WFLYJPA0033: Can't find a persistence unit named primary in deployment \"test.war\""},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"test.war\".beanmanager"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.deployment.unit.\"test.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"test.war\".beanmanager]",
        "jboss.deployment.unit.\"test.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"test.war\".beanmanager]"

だから、DeploymentUnitProcessingException があります。コンソールに、primary という名前の持続性ユニットが見つからないことが示されます。しかし、私の RestResource.java ではユニット名がプライマリであるため、これは嘘だと思います。

package rest;

import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

@Path("/pair")
@Stateful
public class RestResource {
    @PersistenceContext(unitName = "primary")
    private EntityManager em;


    @POST
    public Pair writePair(Pair p) {
        em.persist(p);
        return p;
    }
}

コンソールの次の主張は、beanmanager がインストールされていないことです。私はそれを検索しましたが、beans.xml がない場合にのみ問題になるはずです。しかし、私は src/META-INF/beans.xml を持っており、IDE (Red Hat Developer Studio) のウィザードで作成できます。また、beans.xml は通常は必要なくなったことを読みました。

私が見つけた別のものは https://github.com/javaee-samples/javaee7-samples/issues/371でした

ここで、コマンドを使用してプロジェクトを再構築することをお勧めします

mvn clean install -Pwildfly-managed

私のIDEでは、次のようにします:

Maven コマンドの実行

それは問題なく動作しますが、コンソール出力は変更されません。

以前にその問題がありましたか?ご協力ありがとうございました。

Edit 08.11.18 私のフォルダ構造のスクリーンショットを追加して、人々が私の persistence.xml と beans.xml の場所を確認できるようにしました ここに画像の説明を入力

編集 10.11.18 My beans.xml

<?xml version="1.0"?>
<beans bean-discovery-mode="annotated" version="2.0"
 xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"/>

それが正しいか?

4

0 に答える 0