我正在使用 EJB3、Hibernate、JSF 和 JBOSS 开发一个 webapp,但我无法启动 JBOSS,因为它不断抛出此错误:
16:03:55,888 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
16:03:56,130 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
16:03:56,187 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting
16:03:57,085 INFO [org.xnio] XNIO Version 3.0.3.GA
16:03:57,086 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
16:03:57,097 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
16:03:57,105 INFO [org.jboss.remoting] JBoss Remoting version 3.2.2.GA
16:03:57,131 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
16:03:57,135 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
16:03:57,136 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
16:03:57,148 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
16:03:57,160 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013100: Current PicketBox version=4.0.6.final
16:03:57,165 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
16:03:57,168 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
16:03:57,172 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
16:03:57,220 INFO [org.jboss.as.connector] (MSC service thread 1-10) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
16:03:57,261 INFO [org.jboss.as.naming] (MSC service thread 1-12) JBAS011802: Starting Naming Service
16:03:57,273 INFO [org.jboss.as.mail.extension] (MSC service thread 1-10) JBAS015400: Bound mail session [java:jboss/mail/Default]
16:03:57,286 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
16:03:57,419 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.1.GA
16:03:57,680 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) JBAS015012: Started FileSystemDeploymentService for directory C:\desarrollo\jboss-as-7.1.0.Final\standalone\deployments
16:03:57,682 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found AllYouCanVisit.ear in deployment directory. To trigger deployment create a file called AllYouCanVisit.ear.dodeploy
16:03:57,684 INFO [org.jboss.as.remoting] (MSC service thread 1-7) JBAS017100: Listening on localhost/127.0.0.1:4447
16:03:57,685 INFO [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /127.0.0.1:9999
16:03:57,700 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-11) Starting Coyote HTTP/1.1 on http-localhost-127.0.0.1-8080
16:03:57,836 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-9) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
16:03:58,086 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.data-source.java:jboss/datasources/mysql_ds]
16:03:58,113 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.0.Final "Thunder" started (with errors) in 2515ms - Started 135 of 209 services (2 services failed or missing dependencies, 70 services are passive or on-demand)
我的 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 name="primary">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/mysql_ds</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.use_sql_comments" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
</persistence>
以及来自 JBOSS 中的standalone.xml 文件的数据源:
<datasource jndi-name="java:jboss/datasources/mysql_ds" pool-name="mysql_ds" enabled="true" use-java-context="true" jta="true">
<connection-url>jdbc:mysql://localhost:3306/mydatabase</connection-url>
<driver>mysql</driver>
<security>
<user-name>user</user-name>
<password>password</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
我错过了什么?