JSF持久性文件问题

时间:2014-04-01 08:34:15

标签: java jpa jsf-2 jboss7.x

首先让我说我是Java中的总菜鸟。

我正在构建一个Jboss JSF应用程序。我有一个名为DefaultDS-ds.xml的文件,内容为:

<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
 <datasource jndi-name="java:jboss/datasources/DefaultDS" enabled="true" 
     use-java-context="true" pool-name="DefaultDS">
  <connection-url>jdbc:mysql://localhost:3306/CinemaDb</connection-url>
  <driver>mysql-connector-java-5.0.8-bin.jar</driver>
  <pool></pool>
  <security>
   <user-name>root</user-name>
   <password>test123</password>
  </security>
 </datasource>
</datasources>

以及内容为persistence.xml的内容:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="user-unit">
        <class>model.User</class>
        <jta-data-source>java:jboss/datasources/DefaultDS</jta-data-source>
    </persistence-unit>
</persistence>

然而,在部署我的应用程序时,我得到:

JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.naming.context.java.jboss.datasources.DefaultDS (missing) dependents: [service jboss.persistenceunit."dynamic-web.war#user-unit"] 

我似乎无法自己找到这个问题的答案(如果它很简单 - 请接受我的应用),那么任何人都可以帮助我吗?

编辑:在摆弄文件夹结构后,这里是新结构

dynamic-web
+---WEB-INF
¦   faces-config.xml
¦   web.xml
¦   DefaultDS-ds.xml
¦
+---classes
¦   ¦
¦   +---META-INF
¦           MANIFEST.MF
¦           persistence.xml
¦
+---lib
        mysql-connector-java-5.0.8-bin.jar 

和新错误:

16:40:00,475 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015871: Deploy of deployment "mysql-connector-java-5.0.8-bin.jar" was rolled back with no failure message
16:40:00,479 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "dynamic-web.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/DefaultDSjboss.jdbc-driver.mysql-connector-java-5_0_8-bin_jarMissing[jboss.data-source.jboss/datasources/DefaultDSjboss.jdbc-driver.mysql-connector-java-5_0_8-bin_jar]"]}
16:40:00,483 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-11) JBAS010409: Unbound data source [jboss/datasources/DefaultDS]
16:40:00,487 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015877: Stopped deployment dynamic-web.war in 11ms
16:40:00,487 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015877: Stopped deployment mysql-connector-java-5.0.8-bin.jar in 11ms
16:40:00,488 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.jdbc-driver.mysql-connector-java-5_0_8-bin_jar (missing) dependents: [service jboss.data-source.jboss/datasources/DefaultDS]

1 个答案:

答案 0 :(得分:1)

用新文件(this one)切换出jar文件后,部署成功