简体   繁体   English

在tomcat上运行Web应用程序

[英]Running a web application on tomcat

I am trying to profile tomcat server. 我正在尝试配置tomcat服务器。 My profiler outputs list of methods which were executed by the tomcat server. 我的探查器输出由tomcat服务器执行的方法列表。 I use Ubuntu 12.04. 我使用Ubuntu 12.04。 What I do is as follow: 我的工作如下:

1) start the tomcat server (./startup.sh) 1)启动tomcat服务器(./startup.sh)

2) open the browser and execute the web application develooped in java (and contains jsp pages)for eg (http://localhost:8080/bodgeit.) I have put bodgeit web application in webapps directory of tomcat 7.0.28 (I run bodgeit web application on tomcat) 2)打开浏览器并执行Java开发的Web应用程序(并包含jsp页面),例如(http:// localhost:8080 / bodgeit。)我已将bodgeit Web应用程序放置在tomcat 7.0.28的webapps目录中(我运行Tomcat上的Bodgeit Web应用程序)

3) I perform some actions in this webapplication like login, adding things to basket, changing password, logout etc. 3)我在此Web应用程序中执行一些操作,例如登录,将内容添加到购物篮,更改密码,注销等。

4) then I stop the server by ./shutdown.sh. 4)然后我通过./shutdown.sh停止服务器。 When I run shudown script, my profiler outputs the file which contains list of methods executed while running the tomcat. 当我运行shudown脚本时,我的探查器输出文件,其中包含在运行tomcat时执行的方法的列表。

Now my question is: I collect profiles two or more times by performing the above steps. 现在我的问题是:通过执行上述步骤,我两次或更多次收集配置文件。 I perform exactly same action in web application( in same sequence) in step 3. But sequence of methods I get in both the outputs are different. 在步骤3 中,我在Web应用程序中执行完全相同的操作(以相同的顺序)。 但是在两个输出中获得的方法顺序是不同的。 Why is it so ? 为什么会这样呢? My profiler is capable of saving method sequence also. 我的探查器也能够保存方法序列。

Do methods executed by apache web serever differ everytime ? apache web serever执行的方法每次是否有所不同? aren't they fixed ? 他们不是固定的吗? like certain methods are executed when you start a server, when you make a request or when you shutdown a server ? 像某些方法在启动服务器,发出请求或关闭服务器时执行? I am new to tomcat, servlet and jsp too. 我也是tomcat,servlet和jsp的新手。 I have basic idea about how it works. 我对它的工作原理有基本的了解。 For eg following sequence does not exist in 1st file and exist in 2nd file. 例如,以下顺序在第一个文件中不存在,而在第二个文件中。 Like this, there are many more differences. 像这样,还有许多不同之处。

<callingContextTree><method declaringClass="Lorg/apache/catalina/startup/HostConfig$DeployWar;" name="run" params="" return="V"><callsite instruction="7"><method declaringClass="Lorg/apache/catalina/startup/HostConfig;" name="deployWAR" params="Lorg/apache/catalina/util/ContextName; Ljava/io/File;" return="V"><callsite instruction="555"><method declaringClass="Lorg/apache/catalina/core/StandardHost;" name="addChild" params="Lorg/apache/catalina/Container;" return="V"><callsite instruction="20"><method declaringClass="Lorg/apache/catalina/core/ContainerBase;" name="addChild" params="Lorg/apache/catalina/Container;" return="V"><callsite instruction="15"><method declaringClass="Lorg/apache/catalina/core/ContainerBase;" name="addChildInternal" params="Lorg/apache/catalina/Container;" return="V"><callsite instruction="75"><method declaringClass="Lorg/apache/catalina/util/LifecycleBase;" name="start" params="" return="V"><callsite instruction="88"><method declaringClass="Lorg/apache/catalina/core/StandardContext;" name="startInternal" params="" return="V"><callsite instruction="517"><method declaringClass="Lorg/apache/catalina/util/LifecycleBase;" name="start" params="" return="V"><callsite instruction="88"><method declaringClass="Lorg/apache/catalina/session/StandardManager;" name="startInternal" params="" return="V"><callsite instruction="4"><method declaringClass="Lorg/apache/catalina/session/StandardManager;" name="load" params="" return="V"><callsite instruction="43"><method declaringClass="Lorg/apache/catalina/session/StandardManager;" name="doLoad" params="" return="V"><callsite instruction="61"><method declaringClass="Lorg/apache/catalina/core/ContainerBase;" name="getLoader" params="" return="Lorg/apache/catalina/Loader;"/></callsite></method></callsite></method></callsite></method></callsite></method></callsite></method></callsite></method></callsite></method></callsite></method></callsite></method></callsite></method></callsite></method></callingContextTree>

Can somebody please help me to find what's happening ? 有人可以帮我看看发生了什么吗? In short say, if I start the server, access home page of tomcat and stop the server. 简而言之,如果我启动服务器,请访问tomcat的主页并停止服务器。 I do exactly this again. 我会再做一次。 Does tomcat execute same methods in same sequence both time ? Tomcat是否两次都以相同的顺序执行相同的方法? As far as I have noticed, it does not. 据我所知,事实并非如此。 why ? 为什么呢?

Thank you. 谢谢。

It looks like Tomcat is auto-reloading web applications while you are using it. 看起来Tomcat在使用时正在自动重新加载Web应用程序。 You might want to check the timestamps on your files relative to the system clock on your machine. 您可能要检查文件上相对于计算机上系统时钟的时间戳。 If you have files modified in the future, you can trigger this kind of behavior. 如果将来有要修改的文件,则可以触发这种行为。 Check your logs/catalina.out to see if there is any auto-deployment activity going on. 检查您的logs/catalina.out以查看是否正在进行任何自动部署活动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM