无法解析Jboss中的数据源依赖项

时间:2016-11-27 18:34:17

标签: java eclipse jboss datasource

我试图通过eclipse在JBoss服务器上部署JEE Web应用程序,但我无法解决与数据源相关的依赖性错误。奇怪的是,当我开始部署控制台时显示此消息

JBAS014776:    Newly corrected services:
      service jboss.naming.context.java.jboss.datasources.AssetTrackerDS (no longer required)

但部署失败并出现此错误。

ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "AssetTracker.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"AssetTracker.war#AssetTracker\" is missing [jboss.naming.context.java.jboss.datasources.AssetTrackerDS]"]}

JBoss服务器已正确配置数据库,连接测试显示正面结果。

standalone.xml中的数据源配置

              <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <datasource jta="true" jndi-name="java:jboss/datasource/AssetTrackerDS" pool-name="AssetTrackerDS" enabled="true" use-java-context="true" use-ccm="true">
                    <connection-url>jdbc:postgresql://localhost:5432/test</connection-url>
                    <driver-class>org.postgresql.Driver</driver-class>
                    <driver>postgresql-9.4.1212.jre6.jar</driver>
                    <security>
                        <user-name>***</user-name>
                        <password>***</password>
                    </security>
                    <validation>
                        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
                        <background-validation>true</background-validation>
                        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
                    </validation>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>

的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 transaction-type="JTA" name="AssetTracker">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:jboss/datasources/AssetTrackerDS</jta-data-source>
        <properties>
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
            <property name="transaction.flush_before_completion" value="true" />
            <property name="connection.pool_size" value="5" />
            <property name="hibernate.format_sql" value="false"/>
        </properties>
    </persistence-unit>
</persistence>

我正在使用JBoss EAP 6.2和Eclipse Neon。

1 个答案:

答案 0 :(得分:0)

您有拼写错误:

emailValidator

static getEmailValidator() { 
    return function emailValidator(control: FormControl): { [s: string]: boolean } {

        if (control.value && !control.value.match(/^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/)) {
            return {invalidChars: true};
        }
    }