我已經使用了Jboss,並且通過放棄部署文件夾來部署戰爭。但是當我將我的戰爭項目設置爲Tomcat服務器時,eclipse聲稱它正在部署戰爭,但我無法在webapps文件夾中看到我的戰爭。我的戰爭有哪些網址?在jboss中,我可以將應用程序url添加到jboss-web.xml,所以當我將應用程序路徑設置爲jboss-web.xml時,我可以從http://localhost:8080/my_app_path_in_jboss_web.xml/中找到我的應用程序。如何在Tomcat中部署戰爭6
4
A
回答
7
我將WAR部署到webapps目錄一直沒有問題,可能每天約25次。你不應該有任何問題。如果你想通過一切手段來更多地控制自己的目錄,但這很可能需要重新啓動。
2
使用ant簡化了任務。這裏是一個我用它來部署到Tomcat 6(注意,我不是這樣的origial作者,但我忘記我來自哪裏得到它)
<project name="provisioning" basedir="." default="usage">
<property file="build.properties"/>
<property name="src.dir" value="src"/>
<property name="web.dir" value="war"/>
<property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
<property name="name" value="provisioning"/>
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<!-- We need the servlet API classes: -->
<!-- * for Tomcat 5/6 use servlet-api.jar -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.lib}">
<include name="servlet*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
</path>
<target name="usage">
<echo message=""/>
<echo message="${name} build file"/>
<echo message="-----------------------------------"/>
<echo message=""/>
<echo message="Available targets are:"/>
<echo message=""/>
<echo message="build --> Build the application"/>
<echo message="deploy --> Deploy application as directory"/>
<echo message="deploywar --> Deploy application as a WAR file"/>
<echo message="install --> Install application in Tomcat"/>
<echo message="reload --> Reload application in Tomcat"/>
<echo message="start --> Start Tomcat application"/>
<echo message="stop --> Stop Tomcat application"/>
<echo message="list --> List Tomcat applications"/>
<echo message=""/>
</target>
<target name="build" description="Compile main source tree java files">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" source="1.6" target="1.6" debug="true"
deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="master-classpath"/>
</javac>
</target>
<target name="deploy" depends="build" description="Deploy application">
<copy todir="${deploy.path}/${name}" preservelastmodified="true">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="deploywar" depends="build" description="Deploy application as a WAR file">
<war destfile="${name}.war"
webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</war>
<copy todir="${deploy.path}" preservelastmodified="true">
<fileset dir=".">
<include name="*.war"/>
</fileset>
</copy>
</target>
一個Ant build.xml文件
<path id="catalina-ant-classpath">
<!-- We need the Catalina jars for Tomcat -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.lib}">
<include name="catalina-ant.jar"/>
</fileset>
</path>
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<target name="install" description="Install application in Tomcat">
<install url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"
war="${name}"/>
</target>
<target name="reload" description="Reload application in Tomcat">
<reload url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>
<target name="start" description="Start Tomcat application">
<start url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>
<target name="stop" description="Stop Tomcat application">
<stop url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>
<target name="list" description="List Tomcat applications">
<list url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"/>
</target>
0
如果我理解正確,您已經通過添加新服務器來配置eclipse以使用Tomcat。在這種情況下,eclipse會在工作區內的文件夾中部署war文件,而不是在$ TOMCAT_HOME/webapps中。我不記得在eclipse的工作區文件夾中從頭開始的路徑 - 它應該包含tmp,server,...
0
您已經在eclipse中添加了Tomcat服務器,eclipse在您的內部運行WAR文件工作區。 Eclipse不使用你的%TOMCAT_HOME%。爲了能夠在webapps文件夾中看到你的WAR,只需將它放在那裏。然後您將會從本地主機運行這場戰爭。
0
看到這個link。
它可以幫助你簡單地通過github和web consul來做到這一點。
相關問題
- 1. 部署戰爭到Tomcat
- 2. JBoss 6 - 戰爭部署
- 3. 如何部署Grails戰爭到tomcat
- 4. 在嵌入式Tomcat中部署戰爭
- 5. Tomcat中的戰爭部署錯誤
- 6. tomcat在webapps之外部署戰爭
- 7. OutOfMemory在tomcat上部署戰爭時
- 8. 無法在Apache Tomcat上部署戰爭6
- 9. Tomcat部署 - Tomcat如何檢測戰爭中的變化?
- 10. 用jenkins將戰爭部署到tomcat
- 11. 部署 「戰爭」 與Tomcat的問題
- 12. 部署戰爭文件的Tomcat錯誤
- 13. 的Tomcat 7的戰爭文件部署
- 14. 使用python向tomcat部署戰爭
- 15. IntelliJ Tomcat延遲戰爭部署
- 16. 如何在maven中使用tomcat插件部署多個戰爭?
- 17. 戰爭部署玩
- 18. JBoss戰爭部署
- 19. 如何在tomcat上部署戰爭時跳過圖像
- 20. 在linux上部署戰爭
- 21. 在Jboss部署戰爭 - MAVEN
- 22. 向Tomcat部署戰爭中的變更部分
- 23. 在Tomcat中部署Grails戰爭時顯示錯誤
- 24. SpingBoot在部署的戰爭中丟失的日誌文件(tomcat)
- 25. 在Tomcat中部署多個戰爭的ClassCastException
- 26. 有沒有James-3的戰爭檔案在glassfish/tomcat中部署?
- 27. JBoss 6 - 在戰爭包裝中部署ejb
- 28. 如何使用maven-tomcat-plugin在遠程Tomcat 7上重新部署戰爭
- 29. 戰爭部署例外
- 30. 碼頭,戰爭部署
在tomcat 6中,您使用的是jboss中的相同過程,您只需刪除war文件,然後服務器自動部署它。 這個問題可能是在你的配置與日食。 – Aito 2010-01-22 19:06:10
你有沒有機會在Windows 7或Vista? – 2011-01-26 14:51:59