实验一、应用服务器集成1.整合apache和tomcat安装apache到c:\j2ee\Apache中解压tomcat到c:\j2ee\Tomcat中输入测试输入测试接着关掉Apache和tomcat然后打开C:\j2ee\Apache\conf\httpd.conf去掉如下图红线框中的#符号在文件最后添加接下来启动Apache和Tomcat,在C:\j2ee\Tomcat\apache-tomcat-6.0.44\webapps\ROOT建一个文件名为host,host里面新建一个test.jsp接着,在浏览器中输入得到如下页面在浏览器中输入同样得到如下页面到此,Apache和tomecat整合成功!2.Tomcat+ActiveMQ实现消息服务在jsm-test项目中需要在tomcat的lib中导入一共导入6个包:commons-logging-1.1.jaractivemq-core-5.5.0.jaractivemq-web-5.11.1.jargeronimo-j2ee-management_1.1_spec-1.0.jargeronimo-jms_1.1_spec-1.1.1.jargeronimo-jta_1.0.1B_spec-1.0.1.jar修改文件:Tomcatconf下的context.xml!--Thecontentsofthisfilewillbeloadedforeachwebapplication--Context!--Defaultsetofmonitoredresources--WatchedResourceWEB-INF/web.xml/WatchedResource!--UncommentthistodisablesessionpersistenceacrossTomcatrestarts--!--Managerpathname=/--!--UncommentthistoenableCometconnectiontacking(provideseventsonsessionexpirationaswellaswebapplifecycle)--!--ValveclassName=org.apache.catalina.valves.CometConnectionManagerValve/--Resourcename=jms/FailoverConnectionFactoryauth=Containertype=org.apache.activemq.ActiveMQConnectionFactorydescription=JMSConnectionFactoryfactory=org.apache.activemq.jndi.JNDIReferenceFactorybrokerURL=failover:(tcp://localhost:61616)?initialReconnectDelay=100&maxReconnectAttempts=5brokerName=localhostuseEmbeddedBroker=false/Resourcename=jms/NormalConnectionFactoryauth=Containertype=org.apache.activemq.ActiveMQConnectionFactorydescription=JMSConnectionFactoryfactory=org.apache.activemq.jndi.JNDIReferenceFactorybrokerURL=tcp://localhost:61616brokerName=localhostuseEmbeddedBroker=false/Resourcename=jms/topic/MyTopicauth=Containertype=org.apache.activemq.command.ActiveMQTopicfactory=org.apache.activemq.jndi.JNDIReferenceFactoryphysicalName=MY.TEST.FOO/Resourcename=jms/queue/MyQueueauth=Containertype=org.apache.activemq.command.ActiveMQQueuefactory=org.apache.activemq.jndi.JNDIReferenceFactoryphysicalName=MY.TEST.FOO.QUEUE//ContextActivemqconf下的activemq.xml文件!--LicensedtotheApacheSoftwareFoundation(ASF)underoneormorecontributorlicenseagreements.SeetheNOTICEfiledistributedwiththisworkforadditionalinformationregardingcopyrightownership.TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0(theLicense);youmaynotusethisfileexceptincompliancewiththeLicense.YoumayobtainacopyoftheLicenseat!--STARTSNIPPET:example--beansxmlns=:amq=:xsi=:schemaLocation=://://activemq.apache.org/schema/core://activemq.apache.org/camel/schema/spring!--Allowsustousesystempropertiesasvariablesinthisconfigurationfile--beanclass=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer/brokerxmlns==localhostpersistent=trueuseShutdownHook=false!--Destinationspecificpoliciesusingdestinationnamesorwildcards--destinationPolicypolicyMappolicyEntriespolicyEntryqueue=memoryLimit=5mb/policyEntrytopic=memoryLimit=5mbdispatchPolicystrictOrderDispatchPolicy//dispatchPolicysubscriptionRecoveryPolicylastImageSubscriptionRecoveryPolicy//subscriptionRecoveryPolicy/policyEntry/policyEntries/policyMap/destinationPolicy!--UsethefollowingtoconfigurehowActiveMQisexposedinJMX--managementContextmanagementContextcreateConnector=false//managementContext!--ThestoreandforwardbrokernetworksActiveMQwilllistento--networkConnectors!--bydefaultjustautodiscovertheotherbrokers--networkConnectorname=default-ncuri=multicast://default/!--Exampleofastaticconfiguration:networkConnectorname=host1andhost2uri=static://(tcp://host1:61616,tcp://host2:61616)/--/networkConnectorspersistenceAdapteramqPersistenceAdapterdirectory=activemq-datamaxFileLength=32mb//persistenceAdapter!--UsethefollowingifyouwishtoconfigurethejournalwithJDBC--!--persistenceAdapterjournaledJDBCdataDirectory=${activemq.base}/datadataSource=#postgres-ds//persistenceAdapter--!--OrifyouwanttousepureJDBCwithoutajournal--!--persistenceAdapterjdbcPersistenceAdapterdataSource=#postgres-ds//persistenceAdapter--!--Themaximumaboutofspacethebrokerwillusebeforeslowingdownproducers--systemUsagesystemUsagememoryUsagememoryUsagelimit=20mb//memoryUsagestoreUsagestoreUsagelimit=1gbname=foo//storeUsaget