我在eclipse EE中使用Wildfly 8.2部署我的java项目时出现问题。数据源似乎存在一些问题,但我似乎无法确定数据源的位置和原因。当我在Wildfly的控制台管理器中测试连接时,它成功连接。
来自控制台的错误:
14:18:43,952 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
14:18:44,296 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
14:18:44,389 INFO [org.jboss.as] (MSC service thread 1-5) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
14:18:46,156 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found EventNetzEAR.ear in deployment directory. To trigger deployment create a file called EventNetzEAR.ear.dodeploy
14:18:46,174 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
14:18:46,205 INFO [org.xnio] (MSC service thread 1-2) XNIO version 3.3.0.Final
14:18:46,221 INFO [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.3.0.Final
14:18:46,268 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
14:18:46,284 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
14:18:46,284 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
14:18:46,299 INFO [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
14:18:46,315 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
14:18:46,331 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
14:18:46,377 INFO [org.jboss.as.security] (MSC service thread 1-4) JBAS013170: Current PicketBox version=4.0.21.Final
14:18:46,393 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
14:18:46,487 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
14:18:46,502 INFO [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
14:18:46,518 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) JBAS010417: Started Driver service with driver-name = h2
14:18:46,549 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017502: Undertow 1.1.0.Final starting
14:18:46,627 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
14:18:46,643 INFO [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
14:18:46,674 INFO [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service
14:18:47,112 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path C:\Program Files\JBoss\wildfly-8.2.0.Final/welcome-content
14:18:47,143 INFO [org.jboss.remoting] (MSC service thread 1-5) JBoss Remoting version 4.0.6.Final
14:18:47,237 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 2.0)
14:18:47,241 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = sqlserver
14:18:47,272 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017525: Started server default-server.
14:18:47,319 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017531: Host default-host starting
14:18:47,585 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
14:18:47,585 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/jdbc/MssqlDS]
14:18:47,600 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017519: Undertow HTTP listener default listening on localhost/127.0.0.1:8080
14:18:47,663 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) JBAS015012: Started FileSystemDeploymentService for directory C:\Program Files\JBoss\wildfly-8.2.0.Final\standalone\deployments
14:18:47,663 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "EventNetzEAR.ear" (runtime-name: "EventNetzEAR.ear")
14:18:47,678 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "sqljdbc4.jar" (runtime-name: "sqljdbc4.jar")
14:18:47,928 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015973: Starting subdeployment (runtime-name: "EventNetzEJB.jar")
14:18:47,928 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015973: Starting subdeployment (runtime-name: "EventNetzClient.war")
14:18:48,483 INFO [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for EventNetz
14:18:48,533 INFO [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
14:18:48,642 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010403: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 2.0)
14:18:48,689 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010417: Started Driver service with driver-name = sqljdbc4.jar
14:18:48,705 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment EventNetzEAR.ear
14:18:48,924 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.1.3.Final
14:18:49,174 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment EventNetzClient.war
14:18:49,236 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "EventNetzEAR.ear")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"EventNetzEAR.ear\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"EventNetzEAR.ear\".beanmanager]",
"jboss.persistenceunit.\"EventNetzEAR.ear/EventNetzEJB.jar#EventNetz\".__FIRST_PHASE__ is missing [jboss.naming.context.java.\"\\njava:jboss\".datasources.jdbc.\"MssqlDS\\n\"]"
]}
14:18:49,333 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "sqljdbc4.jar" (runtime-name : "sqljdbc4.jar")
14:18:49,333 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "EventNetzEAR.ear" (runtime-name : "EventNetzEAR.ear")
14:18:49,335 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.deployment.unit."EventNetzEAR.ear".beanmanager (missing) dependents: [service jboss.deployment.unit."EventNetzEAR.ear".weld.weldClassIntrospector]
service jboss.naming.context.java."\njava:jboss".datasources.jdbc."MssqlDS\n" (missing) dependents: [service jboss.persistenceunit."EventNetzEAR.ear/EventNetzEJB.jar#EventNetz".__FIRST_PHASE__]
14:18:49,409 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
14:18:49,409 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
14:18:49,409 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.2.0.Final "Tweek" started (with errors) in 5840ms - Started 280 of 341 services (5 services failed or missing dependencies, 96 services are lazy, passive or on-demand)
14:18:49,612 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015974: Stopped subdeployment (runtime-name: EventNetzEJB.jar) in 15ms
14:18:49,612 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015974: Stopped subdeployment (runtime-name: EventNetzClient.war) in 15ms
14:18:49,624 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment EventNetzEAR.ear (runtime-name: EventNetzEAR.ear) in 18ms
14:18:49,687 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "EventNetzEAR.ear" (runtime-name: "EventNetzEAR.ear")
14:18:49,687 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.module.EventNetzEAR.EventNetzClient (missing) dependents: [service jboss.deployment.subunit."EventNetzEAR.ear"."EventNetzClient.war".INSTALL]
service jboss.persistenceunit."EventNetzEAR.ear/EventNetzEJB.jar#EventNetz".__FIRST_PHASE__ (missing) dependents: [service jboss.deployment.subunit."EventNetzEAR.ear"."EventNetzEJB.jar".POST_MODULE]
14:18:54,422 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found EventNetzEAR.ear in deployment directory. To trigger deployment create a file called EventNetzEAR.ear.dodeploy
standalone.xml的数据源
<datasource jta="true" jndi-name="java:jboss/datasources/jdbc/MssqlDS" pool-name="MssqlDS" enabled="true" use-ccm="false">
<connection-url>jdbc:sqlserver://localhost:1433;databaseName=Testdata;</connection-url>
<driver>sqlserver</driver>
<security>
<user-name>sa</user-name>
<password>hej123</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<background-validation-millis>1</background-validation-millis>
</validation>
<statement>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
standalone.xml中的驱动程序:
<driver name="sqlserver" module="com.microsoft.sqlserver.jdbc">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource
</xa-datasource-class>
</driver>
路径com / microsoft / sqlserver / jdbc / main中的module.xml。另外还有driver.jar所在的位置。
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.microsoft.sqlserver.jdbc">
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
我项目中的persistance.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="EventNetz">
<jta-data-source>
java:jboss/datasources/jdbc/MssqlDS
</jta-data-source>
<non-jta-data-source>
java:jboss/datasources/jdbc/MssqlDS
</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
</properties>
</persistence-unit>
</persistence>
答案 0 :(得分:0)
请检查wildfly和项目中的jndi名称。我想在一个案例中它的名称中有不正确的符号,请注意“新字符串”符号(\ n):
jboss.naming.context.java \ “的 \ n 强>的java:JBoss的\”。datasources.jdbc