我想将一个应用程序部署到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'的引用property'dataSource';嵌套异常是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>
1 回答
您是否在服务器上使用名称“TuxGRHDS”创建了JNDI JDBC数据源?