簡體   English   中英

在jboss中連接mongodb失敗

[英]failed connecting mongodb in jboss

部署將mongodb連接到jboss的war文件時,出現以下錯誤:

Request
{
    "address" => [("deployment" => "moc-public-api-1.0_SNAPSHOT.war")],
    "operation" => "deploy"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => {
        "JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host./public-api/v1" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./public-api/v1: Failed to start service
    Caused by: java.lang.NoClassDefFoundError: org/jboss/resteasy/core/ResourceMethod
    Caused by: java.lang.ClassNotFoundException: org.jboss.resteasy.core.ResourceMethod from [Module \"deployment.moc-public-api-1.0_SNAPSHOT.war:main\" from Service Module Loader]"},
        "JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
            "Services that were unable to start:" => ["jboss.deployment.unit.\"moc-public-api-1.0_SNAPSHOT.war\".deploymentCompleteService"],
            "Services that may be the cause:" => ["jboss.jdbc-driver.mongoDriver"]
        }
    },
    "rolled-back" => true
}

我在standalone.xml中的數據源是這樣的:

<datasource jndi-name="java:/mongoDS" pool-name="mongoDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:mongodb://localhost:27017/test</connection-url>
    <driver>mongoDriver</driver>
    <security>
        <user-name></user-name>
        <password></password>
    </security>
</datasource>

我在standalone.xml中的驅動程序是這樣的:

<driver name="mongoDriver" module="com.mongodb">
    <xa-datasource-class>com.mongodb.jdbc.Driver</xa-datasource-class>
</driver>

錯誤顯示"Services that may be the cause:" => ["jboss.jdbc-driver.mongoDriver"] ,我的mongodb jdbc驅動程序配置正確嗎?

問題是您的部署moc-public-api-1.0_SNAPSHOT.war 您的部署需要resteasy類,但它們不在類加載器范圍內。

您可以通過將條目添加到清單文件或創建jboss-deployment-structure.xml並將其與您的部署一起交付來添加依賴

示例jboss-deployment-structure.xml

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
    <deployment>
        <dependencies>
            <module name="org.jboss.resteasy.resteasy-jaxrs" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM