jboss部署错误springhibernate maven
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 控制台中收到下一个错误:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'entityManagerFactory' defined in class
path resource [spring/tuxgrh-applicationContext-jpa.xml]: Cannot
resolve reference to bean 'tuxgrhDataSource' while setting bean
property 'dataSource'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'tuxgrhDataSource': Invocation of init method
failed; nested exception is javax.naming.NameNotFoundException:
TuxGRHDS not bound
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'tuxgrhDataSource': Invocation of init
method failed; nested exception is javax.naming.NameNotFoundException:
TuxGRHDS not bound
Caused by: javax.naming.NameNotFoundException: TuxGRHDS not bound
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 数据源?
我正在尝试将应用程序部署到 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 控制台中收到下一个错误:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/tuxgrh-applicationContext-jpa.xml]: Cannot resolve reference to bean 'tuxgrhDataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tuxgrhDataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: TuxGRHDS not bound
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tuxgrhDataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: TuxGRHDS not bound
Caused by: javax.naming.NameNotFoundException: TuxGRHDS not bound
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 数据源?