[英]Few general questions about “org.eclipse.wst.server.core” folder of a web application in Java
I have a few questions regarding the org.eclipse.wst.server.core folder in .metadata\\.plugins
folder in a eclipse work space. 关于eclipse工作空间中
.metadata\\.plugins
文件夹中的org.eclipse.wst.server.core文件夹,我有几个问题。 I know that while running an application in local host, this is the folder where we have to replace files for front end, like JSP
, JS
files, CSS
files, HTML
files, Images
etc. 我知道在本地主机中运行应用程序时,这是我们必须替换前端文件的文件夹,如
JSP
, JS
文件, CSS
文件, HTML
文件, Images
等。
There will be some tmp
folders into which I have to replace the files into respective locations. 将有一些
tmp
文件夹,我必须将文件替换到相应的位置。 This folder will be having another folder with structure of a WAR
file which I'll take from my work space and sometimes there will be multiple tmp
folders like tmp0
, tmp1
, tmp2
etc (most of them having all required files). 这个文件夹将有另一个文件夹,其结构为
WAR
文件,我将从我的工作空间中获取,有时会有多个tmp
文件夹,如tmp0
, tmp1
, tmp2
等(其中大部分都有所有必需的文件)。 When there are multiple folders it is really confusing to decide that into which folder I need to replace the file(s). 当有多个文件夹时,确定我需要替换文件到哪个文件夹是很困惑的。
Then I'll have to stop the server, kill all the java
running in background (manually) and have to clear all the tmp
folders (because if the java is not killed properly the jar
files inside tmp
's cannot be deleted saying its currently being used). 然后我将不得不停止服务器,杀死所有在后台运行的
java
(手动)并且必须清除所有tmp
文件夹(因为如果没有正确杀死java, tmp
的jar
文件无法删除说当前正在使用)。 I guess one among these tmp
folders are used by the server to run the application. 我想服务器使用这些
tmp
文件夹中的一个来运行应用程序。
After cleaning all the tmp
folders if I start the server again, the first file created in that folder ( org.eclipse.wst.server.core ) will be one servers.xml
, then one tmp0
will be created may be tmp1
. 如果我再次启动服务器清理所有
tmp
文件夹后,在该文件夹( org.eclipse.wst.server.core )中创建的第一个文件将是一个servers.xml
,那么将创建一个tmp0
可能是tmp1
。 When entire project is published only one tmp
folder will be there, if I publish multiple times, another tmp
folder will be created, may be 2nd time, 3rd time or nth time. 发布整个项目时,只有一个
tmp
文件夹,如果我多次发布,则会创建另一个tmp
文件夹,可能是第二次,第三次或第n次。
So my questions are 所以我的问题是
Why multiple tmp
folders are created when publised multiple times? 为什么多次公布时会创建多个
tmp
文件夹? Can we restrict it into a single tmp
folder? 我们可以将它限制在一个
tmp
文件夹中吗?
After the project is published, is there a possibility that server will use multiple tmp
folders for different request. 项目发布后,服务器是否有可能使用多个
tmp
文件夹来处理不同的请求。 Like for first request I uses tmp0
and when I refresh the page it uses tmp1
folder? 喜欢第一个请求我使用
tmp0
,当我刷新页面时,它使用tmp1
文件夹?
Edited regarding the 3rd question 关于第3个问题编辑
I opened all the xml
files in the folder given in the above image, and in tmp-data.xml
, I found this content 我打开了上图中给出的文件夹中的所有
xml
文件,在tmp-data.xml
,我找到了这个内容
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<temp-directories>
<temp-directory age="0" key="GlassFish v2.1 Java EE 5 at localhost" path="tmp0"/>
</temp-directories>
Where path
attribute is given value as tmp0
. 其中
path
属性的值为tmp0
。 So I'm guessing that will be the answer to my third question. 所以我猜这将是我第三个问题的答案。 I'm guessing this file will be created when there are multiple
tmp
folders, because after deleting all tmp
folders and files in the folder and after publishing the work space the tmp-data.xml
file was not present. 我猜这个文件将在有多个
tmp
文件夹时创建,因为删除文件夹中的所有tmp
文件夹和文件后,在发布工作空间后, tmp-data.xml
文件不存在。
Edited regarding the WTP 编辑了WTP
I don't have much details about WTP, but when I clicked Help
and selected About Eclipse
in my eclipse I got this window 我没有太多关于WTP的细节,但当我点击
Help
并在我的日食中选择About Eclipse
,我得到了这个窗口
Not that I know of. 从来没听说过。 It is created by WTP (Web Tools Platform) using WST (Web Standard Tools).
它由WTP(Web工具平台)使用WST(Web标准工具)创建。 If you find, let me know too.
如果你找到了,也让我知道。
That depends upon different checks that WTP and WST do before publishing the artifacts. 这取决于WTP和WST在发布工件之前所做的不同检查。 It does not happen all the time, but it does a lot more than expected, because of file locks that stop eclipse from publishing a fresh copy of the application.
它不会一直发生,但它比预期的要多得多,因为文件锁可以阻止eclipse发布应用程序的新副本。 And hence, the code must be trying to create new tmp folder just as a workaround.
因此,代码必须尝试创建新的tmp文件夹,就像解决方法一样。 The metadata (publish.xml) is then updated, and everything works as normal, which I feel is much better since the developer does not have to know a lot of stuff about these failures.
然后更新元数据(publish.xml),一切正常,我觉得这样做要好得多,因为开发人员不必知道很多关于这些失败的东西。 We can change this setting in the server properties in your eclipse.
我们可以在eclipse中的服务器属性中更改此设置。 Note that different plugins have different ways of doing this, my STS has default deploy path set to wtpwebapps.
请注意,不同的插件有不同的方法,我的STS默认部署路径设置为wtpwebapps。
This must be available in your publish xml file. 这必须在您的发布xml文件中可用。 And it also depends upon the version of WTP / WST you are using.
它还取决于您使用的WTP / WST版本。 It is hard to see where the folder generation is happening (at least for me at this time), but you can look at PublishUtils.java and PublishDelegate.java in WTP.
很难看到文件夹生成的位置(至少在我这个时候),但你可以在WTP中查看PublishUtils.java和PublishDelegate.java。 Github here .
Github在这里 。
No certainly not, after a project is published the whole server points to the location at which the artifacts reside. 当然,在项目发布后,整个服务器指向工件所在的位置。 Though the context refresh might fail because of overlapping threads or wait time, it is not possible for two different instances to be deployed into the same server with the same application/context name.
虽然由于线程重叠或等待时间而导致上下文刷新失败,但是不可能将两个不同的实例部署到具有相同应用程序/上下文名称的同一服务器中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.