jboss-5.1.0GA+activemq-5.3.1整合

1、分别解压

2、在jboss-5.1.0.GA/server/default/deploy下建立文件夹activemq-ra-5.3.1.rar

3、将apache-activemq-5.3.1/lib/optional/activemq-rar-5.3.1.rar解压到2中建立的文件夹中

4、修改文件jboss-5.1.0.GA/server/default/deploy/activemq-ra-5.3.1.rar/META-INF/ra.xml

     修改后结果

    <config-property-value>vm://localhost</config-property-value>

     <config-property-value>xbean:broker-config.xml</config-property-value>

5、修改文件jboss-5.1.0.GA/server/default/deploy/activemq-ra-5.3.1.rar/broker-config.xml

     修改结果

     <beans xmlns="http://activemq.apache.org/schema/core">
     <!-- put the following as the first child of the beans element -->
 <bean xmlns="" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>


  <!--  shutdown hook is disabled as RAR classloader may be gone at shutdown -->
  <broker useJmx="true" useShutdownHook="false" brokerName="bruce.broker1">

     <managementContext>
       <!-- use appserver provided context instead of creating one,
            for jboss use: -Djboss.platform.mbeanserver -->
       <managementContext createConnector="false"/>
     </managementContext>

    <persistenceFactory>
      <journalPersistenceAdapterFactory journalLogFiles="5" dataDirectory="${jboss.server.data.dir}/activemq"/>
    </persistenceFactory>

    <transportConnectors>
      <transportConnector name="bruce.broker1" uri="tcp://localhost:61616"/>
    </transportConnectors>
   
  </broker>
</beans>

6、新建文件jboss-5.1.0.GA/server/default/deploy/activemq-ds.xml

    文件内容

    <?xml version="1.0" encoding="UTF-8"?>
 
   <!DOCTYPE connection-factories
       PUBLIC "-//JBoss//DTD JBOSS JCA Config 5.0//EN"
       "http://www.jboss.org/j2ee/dtd/jboss-ds_5_0.dtd">
  
   <connection-factories>
  
      <tx-connection-factory>
         <jndi-name>activemq/QueueConnectionFactory</jndi-name>
         <xa-transaction/>
         <use-java-context>false</use-java-context>
         <track-connection-by-tx/>
         <rar-name>activemq-ra-5.3.1.rar</rar-name>
         <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
         <ServerUrl>vm://localhost</ServerUrl>
         <!--
         <UserName>sa</UserName>
         <Password></Password>
         -->
         <min-pool-size>1</min-pool-size>
         <max-pool-size>200</max-pool-size>
         <blocking-timeout-millis>30000</blocking-timeout-millis>
         <idle-timeout-minutes>3</idle-timeout-minutes>
      </tx-connection-factory>
  
      <tx-connection-factory>
         <jndi-name>activemq/TopicConnectionFactory</jndi-name>
         <xa-transaction/>
         <use-java-context>false</use-java-context>
         <track-connection-by-tx/>
         <rar-name>activemq-ra-5.3.1.rar</rar-name>
         <connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
         <ServerUrl>vm://localhost</ServerUrl>
         <!--
         <UserName>sa</UserName>
         <Password></Password>
         -->
         <min-pool-size>1</min-pool-size>
         <max-pool-size>200</max-pool-size>
         <blocking-timeout-millis>30000</blocking-timeout-millis>
         <idle-timeout-minutes>3</idle-timeout-minutes>
      </tx-connection-factory>
  
      <mbean code="org.jboss.resource.deployment.AdminObject" name="activemq.queue:name=outboundQueue">
         <attribute name="JNDIName">activemq/queue/outbound</attribute>
         <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-5.3.1.rar'</depends>
         <attribute name="Type">javax.jms.Queue</attribute>
         <attribute name="Properties">PhysicalName=queue.outbound</attribute>
      </mbean>
     
      <mbean code="org.jboss.resource.deployment.AdminObject" name="activemq.queue:name=inboundQueue">
         <attribute name="JNDIName">activemq/queue/inbound</attribute>
         <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-5.3.1.rar'</depends>
         <attribute name="Type">javax.jms.Queue</attribute>
         <attribute name="Properties">PhysicalName=queue.inbound</attribute>
      </mbean>
  
      <mbean code="org.jboss.resource.deployment.AdminObject" name="activemq.topic:name=inboundTopic">
         <attribute name="JNDIName">activemq/topic/inbound</attribute>
         <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-5.3.1.rar'</depends>
         <attribute name="Type">javax.jms.Topic</attribute>
         <attribute name="Properties">PhysicalName=topic.inbound</attribute>
      </mbean>
     
      <mbean code="org.jboss.resource.deployment.AdminObject" name="activemq.topic:name=inboundTopic1">
         <attribute name="JNDIName">activemq/topic/inbound1</attribute>
         <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-5.3.1.rar'</depends>
         <attribute name="Type">javax.jms.Topic</attribute>
         <attribute name="Properties">PhysicalName=topic.inbound1</attribute>
      </mbean>
  
   </connection-factories>

7、将文件jboss-5.1.0.GA\server\default\deploy\activemq-ra-5.3.1.rar\xbean-spring-3.6.jar拷贝到

     jboss-5.1.0.GA\server\default\lib中

8、 使用Webservice,报异常,解决办法:

     jboss-5.1.0.GA\common\lib下

     

     jbossws-native-jaxrpc.jar

     jbossws-native-jaxws.jar

     jbossws-native-jaxws-ext.jar

     jbossws-native-saaj.jar

 

     拷贝到jboss-5.1.0.GA\lib\endorsed

9、jboss启动默认绑定的是127.0.0.1回环ip,无法从其他机器访问

     修改文件jboss-5.1.0.GA\server\default\deploy\jbossweb.sar\server.xml

     修改结果

     <Connector protocol="HTTP/1.1" port="8090" address="本机ip地址"
               connectionTimeout="20000" redirectPort="8443" />

     或者启动时加上-b选项指定host或ip 例如:run.bat -b ip地址(推荐使用)

10、修改文件jboss-5.1.0.GA\server\default\deployers\jbossws.deployer\META-INF\jboss-beans.xml

     修改结果

     <property name="webServiceHost">IP地址</property>

    用处:编写webservice,自动生成wsdl时 soap:address location的地址如下:

   

- < service name =" EjbWebserviceBeanService ">
- < port binding =" tns:EjbWebserviceBeanBinding " name =" EjbWebserviceBeanPort ">
  < soap:address location = http://ip地址:8090/ejb_01/EjbWebserviceBean />
  </ port >
  </ service >
    默认的是localhost或者127.0.0.1 无法远程调用
11、远程用ip地址访问activeMQ  tcp://localhost:port 
    修改文件jboss-5.1.0.GA\server\default\deploy\activemq-ra-5.3.1.rar\broker-config.xml
    修改结果
    <transportConnectors>
      <transportConnector name="bruce.broker1" uri="tcp://0.0.0.0:61616"/>
    </transportConnectors>
 

你可能感兴趣的:(xml,jboss,webservice,activemq,jms)