war

How to extract .war files in java? ZIP vs JAR

倖福魔咒の 提交于 2019-12-29 03:24:09
问题 I have a web program where I want the user to be able to import a .war file and I can extract certain files out of the .war file. I have found two class libraries: java.util.zip.* and java.util.jar.* . From what I understand, a WAR file is a special JAR file which is a special ZIP file. So would it be better to use java.util.jar ? If ZIP and JAR files are pretty much the same why is there a need for two different libraries? 回答1: If you look at the JarFile API you'll see that it's a subclass

Advantages/Disadvantages to exploded WAR files

旧城冷巷雨未停 提交于 2019-12-29 02:45:10
问题 An answer to a question I read today suggested deploying an application as an exploded (unzipped) WAR. It got me thinking. Every deployment I've ever done to a JBoss/Tomcat has been with a a WAR/EAR file. At least as far as I can remember. Have I been making a mistake all these years? Are there advantages to deploying an app in its expanded form rather than packaged up? 回答1: I think that was my answer mentioning the exploded WAR in the other question. Exploded WARs are easier to navigate and

How do I access a text file from within my war

有些话、适合烂在心里 提交于 2019-12-28 16:13:02
问题 How do I know what file reference to use to get a file from my WAR. The structure of the WAR is: WAR src - model - web build WebContent META-INF WEB-INF LIB The JSPs are under WebContent, I have put the config.txt file under the WebContent folder and tried to get to it with BufferedReader in = new BufferedReader(new FileReader("WebContent/config.txt")); But this doesn't work. Does anyone know what reference I need to pass or how I can figure it out. 回答1: Check out ServletContext

How do I access a text file from within my war

只愿长相守 提交于 2019-12-28 16:12:04
问题 How do I know what file reference to use to get a file from my WAR. The structure of the WAR is: WAR src - model - web build WebContent META-INF WEB-INF LIB The JSPs are under WebContent, I have put the config.txt file under the WebContent folder and tried to get to it with BufferedReader in = new BufferedReader(new FileReader("WebContent/config.txt")); But this doesn't work. Does anyone know what reference I need to pass or how I can figure it out. 回答1: Check out ServletContext

Deploy Spring Boot to Tomcat

故事扮演 提交于 2019-12-28 03:27:04
问题 So I am new to Spring - so I thought I would try Spring Boot I am using a Maven to build - I set up a view requests, when I run it as "App" looks like it starts tomcat up itself and i have a service at default 8080 port, so when I call localhost:8080/service it's all good. However when i try to package it up as a WAR to deploy to a server it doesn't work So i thought i would go back to basics and deploy it onto my tomcat server locally and see what happens So first off nothing happened - 404

How do I update a Tomcat webapp without restarting the entire service?

ε祈祈猫儿з 提交于 2019-12-27 18:20:21
问题 I'm new to Tomcat . We have a dev machine with about 5 apps running. Even though it's dev, it's used by our clients pretty heavily during testing. So say we need to make one small change on one class file. Right now, we have to shutdown Tomcat (affecting the other four apps), delete the WAR file (and web app directory), redeploy the new WAR file and restart Tomcat . Of course, this upsets a few people because it destroys all logged in sessions for all apps. Is there a better way to do this? I

spring boot war without tomcat embedded

五迷三道 提交于 2019-12-27 17:38:13
问题 I want to create a war file without embedded tomcat with maven. Here the relevant part of my pom ... <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.1.6.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> <

Add JAR to WAR's classpath without changing the WAR file

痞子三分冷 提交于 2019-12-25 18:41:24
问题 I deploy a WAR file in Tomcat. In addition I have a JAR file. Is it possible to make the classes in the JAR file available to services in the WAR file without changing the WAR file, or does it have be added to the WAR's WEB-INF/lib? I've tried adding the JAR to lib/ , but it doesn't work. Spring fails with org.springframework.beans.factory.BeanCreationException » java.lang.NoClassDefFoundError upon startup. EDIT I realized that I might have made myself an unsolvable and architectually ugly

gradle how to add only javascript files to a directory in the war file

好久不见. 提交于 2019-12-25 16:49:31
问题 I am trying to create a web application that uses angular2. The part of the build.gradle responsible for compiling the typescript and adding it to the war is as follows: public class TsCompileTask extends DefaultTask { File projectDir; @OutputDirectory File outputDir; @TaskAction void compile() { println "compiling TypeScript files..." project.exec { executable = "tsc" args "-p" args projectDir args "--outDir" args outputDir.toString() } } } public class npmInstallTask extends DefaultTask {

Start java application with jetty without WAR file

佐手、 提交于 2019-12-25 16:26:29
问题 I try start Jersey + Jetty + Nginx via this tutorial and I cannot use war file. How can I start my java application? I start application by right click on BackendServer.java and click "Run" in IDEA or using in terminal java -cp /home/example/backend/build/WEB-INF/lib/backend.jar:/home/example/backend/libs/* com.example.backend.BackendServer . Project structure is described here. /opt/jetty/webapps/backend.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay