Я только начал изучать JBOSS. Сделал БД family (ПостгреСКЛ) и связал все через family-ds.xml.
вроде все ок, так при старте JBoss имею:
14:52:51,677 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=FamilyDS' to JNDI name 'java:FamilyDS'
так же создал спринг xml файл:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
<prop key="java.naming.provider.url">jnp://localhost:1099</prop>
<prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
</props>
</property>
</bean>
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="resourceRef">
<value>false</value>
</property>
<property name="jndiName">
<value>java:FamilyDS</value>
</property>
<property name="jndiTemplate">
<ref bean="jndiTemplate"></ref>
</property>
</bean>
<bean id = "sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.connection.driver_class">
org.postgresql.Driver</prop>
<prop key="transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory</prop>
<prop key="hibernate.dialect">
org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider</prop>
</props>
</property>
</bean>
</beans>
Но при открытии сессии говорит:
Initial SessionFactory creation failed.org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'dataSource' defined in class path resource [spring.cfg.xml]: Invocation of init method failed; nested
exception is javax.naming.NameNotFoundException: FamilyDS not bound
пробовал : “
java:/FamilyDS”, “FamilyDS”, “java:FamilyDS” — одно и тоже