EBJ beans.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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<context:component-scan base-package="com.ccl" />
<!-- 总包下浏览 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/jboss" />
<property name="username" value="root" />
<property name="password" value="sa" />
<property name="initialSize" value="0" />
<property name="maxActive" value="8" />
<property name="maxIdle" value="8" />
<property name="minIdle" value="0" />
<property name="maxWait" value="-1" />
<property name="logAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="600" /> <!-- 连接泄漏的超时删除 -->
</bean>
<!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" /> <property name="packagesToScan">
<list> <value>com.ccl.bean</value> </list> </property> <property name="hibernateProperties">
<props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop>
</props> </property> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property> </bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"></property> </bean> -->
<!-- JDNI context -->
<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">127.0.0.1\:1099</prop>
<prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
</props>
</property>
</bean>
<!-- JMS connectionFactory -->
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>UIL2ConnectionFactory</value>
</property>
</bean>
<!-- JMS destinations -->
<bean id="sendDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jdniTemplate">
<ref bean="jdniTemplate" />
</property>
<property name="jndiName">
<value>queue/CreditRequestSendQueue</value>
</property>
</bean>
<bean id="receiveDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>queue/CreditReqeustReceiveQueue</value>
</property>
</bean>
<!-- JMS template -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate102">
<property name="connectionFactory">
<ref bean="jmsQueueConnectionFactory" />
</property>
<property name="defaultDestination">
<ref bean="destination" />
</property>
<property name="receiveTimeout">
<value>30000</value>
</property>
</bean>
<!-- JMS sender -->
<bean id="jmsSender" class="com.ccl.jms.JMSSender">
<property name="jmsTemplate">
<ref bean="jmsTemplate" />
</property>
</bean>
<!-- JMS receiver -->
<bean id="jmsReceiver" class="com.ccl.jms.JMSReceiver">
<property name="jmsTemplate">
<ref bean="jmsTemplate" />
</property>
</bean>
<!-- this is the Message Driven POJO (MDP) -->
<bean id="messageListener" class="com.ccl.jms.SimpleListener"></bean>
<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="jmsQueueConnectionFactory" />
<property name="destination" ref="destination" />
<property name="messageListener" ref="messageListener"></property>
</bean>
</beans>
MATE-INF下面
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="jboosdb" transaction-type="JTA">
<jta-data-source>java:MySqlDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
src:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=jboossQueue">
<attribute name="JNDIName">queue/jboossQueue</attribute>
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=jboossTopic">
<attribute name="JNDIName">topic/jboossTopic</attribute>
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
</depends>
</mbean>
</server>
jndi.properties
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=127.0.0.1\:1099