![](/img/trans.png)
[英]Hibernate Envers with JBoss, Spring and Maven - Doesn't write audit record
[英]jboss deployment error spring hibernate maven
我想將一個應用程序部署到jBoss 4.2.3我想我已經錯過了jboss配置中的一些東西。 我做了什么。 我下載了jboss 4.2.3,將tuxgrh-ws-1.0.x.war放在“jboss-4.2.3.GA \\ server \\ default \\ deploy”文件夾中,然后在控制台中啟動run.bat。 我有一個帶數據庫的mysql服務器。
我在jboss控制台中遇到了下一個錯誤:
引起:org.springframework.beans.factory.BeanCreationException:在類路徑資源[spring / tuxgrh-applicationContext-jpa.xml]中定義名稱為'entityManagerFactory'的bean創建錯誤:設置bean屬性時無法解析對bean'tuxgrhDataSource'的引用'數據源'; 嵌套異常是org.springframework.beans.factory.BeanCreationException:創建名為'tuxgrhDataSource'的bean時出錯:init方法的調用失敗; 嵌套異常是javax.naming.NameNotFoundException:未綁定TuxGRHDS
引起:org.springframework.beans.factory.BeanCreationException:創建名為'tuxgrhDataSource'的bean時出錯:init方法的調用失敗; 嵌套異常是javax.naming.NameNotFoundException:未綁定TuxGRHDS
引起:javax.naming.NameNotFoundException:未綁定TuxGRHDS
tuxgrhDataSource是指下一個文件
tuxgrh-ds.xml中
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>TuxGRHDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test_tuxgrh</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>newuser</user-name>
<password>newuser</password>
<min-pool-size>0</min-pool-size>
<max-pool-size>3</max-pool-size>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
</local-tx-datasource>
</datasources>
並在tuxgrh-applicationContext-jpa.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:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd"
default-autowire="byName">
<jpa:repositories base-package="com.tritux.tuxgrh.logic.repository" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="tuxgrhDataSource">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:database="MYSQL" p:databasePlatform="org.hibernate.dialect.MySQLDialect" />
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
</props>
</property>
<property name="packagesToScan" value="com.tritux.tuxgrh.logic.model"></property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
p:entityManagerFactory-ref="entityManagerFactory" />
<tx:annotation-driven transaction-manager="transactionManager" />
<jee:jndi-lookup id="tuxgrhDataSource" jndi-name="java:/TuxGRHDS" />
</beans>
您是否在服務器上使用名稱“TuxGRHDS”創建了JNDI JDBC數據源?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.