將meta-INF放在src/main/resources和dataal中創建的standalone.xml中,並添加了seat模塊但是當這個錯誤開始時que在最後的段落中低 。錯誤JBoss AS7 Maven + Spring + JSF +休眠
類Atleta
@ManyToOne
@JoinColumn(name = "IDF_CLUBE")
private Clube clube;
類的Clube
@OneToMany(fetch = FetchType.LAZY, mappedBy = "clube")
private List<Atleta> atletas;
數據源standalone.xml
<datasource jta="true" jndi-name="java:jboss/datasource/OnzeVencedorDB" pool-name="OnzeVencedorDB"
enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/OnzeVencedorDB</connection-url>
<driver>com.mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>30</max-pool-size>
<prefill>true</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
</statement>
</datasource>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
的JBoss-web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/OnzeVencedor</context-root>
<resource-ref>
<res-ref-name>datasource/onzeVencedorDB</res-ref-name>
<jndi-name>datasource/OnzeVencedorDB</jndi-name>
</resource-ref>
</jboss-web>
的web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<!-- Configuracao do Spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Configuracao do JSF -->
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
<resource-ref>
<res-ref-name>datasource/onzeVencedorDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
的applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- Seta anotaçoes para serem usadas pelo Spring -->
<context:annotation-config />
<!-- Define o pacote onde o Spring vai procurar por beans anotados -->
<context:component-scan base-package="br.com.senac.onzevencedor.service,br.com.senac.onzevencedor.dao" />
<!-- Define que as transaçoes irao ser anotadas -->
<tx:annotation-driven/>
<!-- Configuraçao do banco de dados -->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="OnzeVencedorDB" value="java:jboss/datasource/OnzeVencedorDB"/>
</bean>
<!-- Configuraçao do Hibernate -->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="onzeVencedorDB" />
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" >
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="org.hibernate.dialect.MySQLDialect" />
<property name="showSql" value="true" />
</bean>
</property>
</bean>
<!-- Configuracao do gerente de transacoes do Spring -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
</beans>
的persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="2.1">
<persistence-unit name="onzeVencedorPu" transaction-type="JTA">
<jta-data-source>java:jboss/datasource/OnzeVencedorDB</jta-data-source>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<properties>
<property name="hibernate.default_schema" value="${schema}" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.cache.region.factory_class" value="org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory" />
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.use_query_cache" value="true" />
<property name="hibernate.cache.use_minimal_puts" value="true" />
<property name="hibernate.cache.infinispan.statistics" value="false" />
<property name="hibernate.cache.infinispan.entity.eviction.strategy" value="LRU" />
<property name="hibernate.cache.infinispan.entity.eviction.wake_up_interval" value="2000" />
<property name="hibernate.cache.infinispan.entity.eviction.max_entries" value="5000" />
<property name="hibernate.cache.infinispan.entity.expiration.lifespan" value="60000" />
<property name="hibernate.cache.infinispan.entity.expiration.max_idle" value="30000" />
</properties>
</persistence-unit>
</persistence>
錯誤
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.module.OnzeVencedor.OnzeVencedor.env.datasource.OnzeVencedorDB (missing) dependents: [service jboss.naming.context.java.module.OnzeVencedor.OnzeVencedor.env.datasource.customerDB]
13:15:00,305 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.OnzeVencedor.OnzeVencedor.env.datasource.customerDBjboss.naming.context.java.module.OnzeVencedor.OnzeVencedor.env.datasource.OnzeVencedorDBMissing[jboss.naming.context.java.module.OnzeVencedor.OnzeVencedor.env.datasource.customerDBjboss.naming.context.java.module.OnzeVencedor.OnzeVencedor.env.datasource.OnzeVencedorDB]"]}}}
你解決這個問題?如果是的話,你是如何解決它的? – Xstian 2014-10-13 13:51:30
謝謝!回答,但仍然有錯誤JBAS014775:新的缺失/不滿意的依賴項:服務jboss.naming.context.java.module.OnzeVencedor.OnzeVencedor.env.datasource.OnzeVe ncedorDB(缺少)依賴項:[service jboss.naming.context。 java.module.OnzeVencedor.OnzeVencedor.env.datasource.custom erDB] – WhoAre 2014-10-14 14:07:54