湘潭大学j2ee实验报告(绝对完整)

  • 格式:doc
  • 大小:1.17 MB
  • 文档页数:27

实验一、应用服务器集成 1.整合apache和tomcat 安装apache到c:\j2ee\Apache中

解压tomcat到c:\j2ee\Tomcat中 输入测试http://localhost/ 输入测试http://localhost:8080/ 接着关掉Apache和tomcat 然后 打开C:\j2ee\Apache\conf\httpd.conf 去掉如下图红线框中的#符号

在文件最后添加 接下来启动Apache 和Tomcat,在C:\j2ee\Tomcat\apache-tomcat-6.0.44\webapps\ROOT建一个文件名为host,host里面新建一个test.jsp

接着,在浏览器中输入http://localhost:8080/host/test.jsp得到如下页面 在浏览器中输入http://localhost/host/test.jsp同样得到如下页面 到此,Apache和tomecat整合成功! 2.Tomcat+ActiveMQ实现消息服务 在jsm-test项目中需要在tomcat的lib中导入 一共导入6个包:

commons-logging-1.1.jar

activemq-core-5.5.0.jar activemq-web-5.11.1.jar geronimo-j2ee-management_1.1_spec-1.0.jar geronimo-jms_1.1_spec-1.1.1.jar geronimo-jta_1.0.1B_spec-1.0.1.jar

修改文件: Tomcat conf下的context.xml WEB-INF/web.xml

name="jms/FailoverConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="failover:(tcp://localhost:61616)?initialReconnectDelay=100&maxReconnectAttempts=5" brokerName="localhost" useEmbeddedBroker="false"/> name="jms/NormalConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="tcp://localhost:61616" brokerName="localhost" useEmbeddedBroker="false"/> auth="Container" type="org.apache.activemq.command.ActiveMQTopic" factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="MY.TEST.FOO"/> auth="Container" type="org.apache.activemq.command.ActiveMQQueue" factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="MY.TEST.FOO.QUEUE"/> Activemq conf下的activemq.xml文件 xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

persistent="true" useShutdownHook="false">