war

How to expand war in Spring Boot's embedded tomcat?

梦想与她 提交于 2019-12-01 10:42:54
问题 I have a war archive with a web application. I want to start that application within my Spring Boot application. I therefore followed the advice from that question: @Bean public EmbeddedServletContainerFactory servletContainerFactory() { return new TomcatEmbeddedServletContainerFactory() { @Override protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(Tomcat tomcat) { try { tomcat.addWebapp("blog", "/tmp/roller.war"); } catch (ServletException ex) { throw new

Specifying runtime configuration parameters to a Maven built Web Application

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 09:56:01
问题 I am a newcomer to Maven, and I was wondering if there was a reasonable way of specifying configuration information parameters to a web application at buildtime. What I mean by this is the following. With Ant, I usually create a folder (e.g. config-params ) and in that folder I place some property files or whatever other necessary files with the right settings for the environments in which my application will run. For example: - test.jdbc.properties - cert.jdbc.properties - prod.jdbc

Trying to build from the command line, and produce a WAR file

巧了我就是萌 提交于 2019-12-01 09:47:36
My folder layout is: /web-inf/web.xml /web-inf/classes/ HelloWorld.java: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ response.setContentType("text/html"); PrintWriter pw = response.getWriter(); pw.println("<html>"); pw.println("<head><title>Hello World</title></title>"); pw.println("<body>"); pw.println("<h1>Hello World</h1>"); pw.println("</body></html>"); } } I want to do the following: build everything via

How can I locate a non-Java resource in a WAR at runtime?

拟墨画扇 提交于 2019-12-01 09:25:14
I need to run a shell script at runtime from a WAR that I run on Tomcat. Thus, I've placed my script theScript.sh in my src/main/resources directory (because, yes, I use Maven). This directory is in the classpath, I've checked it. In the code, I want to copy my script in a temp directory. So I've tried to get it via my ClassLoader: URL myURL = ClassLoader.getSystemResource("theScript.sh"); if (myURL == null) { LOG.error("Couldn't find the resource"); } And guess what? Yes, the "Couldn't find the resource" keeps appearing all over the place in my logs. Any idea what I'm doing wrong here? My

convert war file to exe file [closed]

家住魔仙堡 提交于 2019-12-01 07:54:35
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I have a file in .war format. Is it possible to convert it to an .exe or .jar file? 回答1: First of all why you need to do such thing? As stated on wiki : A war file is a JAR file used to distribute a collection of

Trying to build from the command line, and produce a WAR file

拟墨画扇 提交于 2019-12-01 07:44:15
问题 My folder layout is: /web-inf/web.xml /web-inf/classes/ HelloWorld.java: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ response.setContentType("text/html"); PrintWriter pw = response.getWriter(); pw.println("<html>"); pw.println("<head><title>Hello World</title></title>"); pw.println("<body>"); pw.println("<h1

AutoDeploy a WAR file found in a subfolder of appBase

十年热恋 提交于 2019-12-01 07:28:42
问题 I have a third party web application which I would like to deploy to a Tomcat 5.0 server via an installer. AutoDeploy is set to true. However, the application consists of more than one WAR file. If I put the WARs under /webapps directly, they work like a charm. However, I would like to expand them under /webapps/myapp/..and here the expanded WAR directory... This way they do not get AutoDeployed. Can somebody suggest what I need to configure for this to work? 回答1: As this page suggests, you

How can I locate a non-Java resource in a WAR at runtime?

自古美人都是妖i 提交于 2019-12-01 07:06:36
问题 I need to run a shell script at runtime from a WAR that I run on Tomcat. Thus, I've placed my script theScript.sh in my src/main/resources directory (because, yes, I use Maven). This directory is in the classpath, I've checked it. In the code, I want to copy my script in a temp directory. So I've tried to get it via my ClassLoader: URL myURL = ClassLoader.getSystemResource("theScript.sh"); if (myURL == null) { LOG.error("Couldn't find the resource"); } And guess what? Yes, the "Couldn't find

使用gradle打war包时,包含中文文件名导致war包无法解压的解决办法

可紊 提交于 2019-12-01 06:30:02
在平时的项目工作中使用的是Gradle+idea+git的工具组合,所以在进行项目打包时使用的gradle来完成。 1.使用gradle clean war 命令将项目打包 2.将生成的war包放置在tomcat的webapps目录下即可 但是有时候tomcat在解压war包时会出现一个错误 这个错误的最常见的原因就是项目中包含中文名称的文件名。 以前的解决办法是直接将中文名称的文件删除或者重命名,但是今天遇到一个项目,因为一些特殊原因导致包含的中文文件名比较多,修改起来很是不方便,那么就必须要把这个问题解决掉。 首先,我尝试使用rar将war包文件打开,发现了其中的中文文件名全部乱码而且文件不全: 觉得应该是gradle打包时的问题,打包过程中文件丢失或者不能识别?在网上查阅了一些博客后发现找到了一个解决办法。 找到本地gradle的安装路径,修改bin/gradle.bat将其中的DEFAULT_JVM_OPTS设置为 DEFAULT_JVM_OPTS="-Dfile.encoding=UTF-8" 修改完成后重新打包,项目中的中文文件名也成功识别,tomcat也能够成功解压。 参考博客: http://www.tuicool.com/articles/Ejm2myR 来源: oschina 链接: https://my.oschina.net/u/2341314/blog

How to allow Tomcat war app to write in folder

浪子不回头ぞ 提交于 2019-12-01 06:29:23
问题 I'd like for my webapp which is deployed as a war ROOT.war to have write access to /var/www/html/static/images so that it can write uploaded and converted images to that folder so nginx can serve it statically. Currently it doesn't work an triggers an java.nio.file.FileSystemException exception together with the Filesystem is read-only message. But the filesystem is not read-only and is in great condition. The folder has already been chmodded 777. Extra info: The tomcat setup is running on an