Deploy Spring Boot to Tomcat

The chapter Packaging executable jar and war files in the Spring Boot reference documentation states: To build a war file that is both executable and deployable into an external container you need to mark the embedded container dependencies as “provided”, e.g: <?xml version=”1.0″ encoding=”UTF-8″?> <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”> <!– … –> <packaging>war</packaging> <!– … … Read more

IntelliJ and WAR….changed files are not automatically recognized by server

This cannot be done if you deploy a war with IntelliJ IDEA. However, it can be if you deploy an exploded war. In IDEA: open your Tomcat Run/Debug configuration (Run > Edit Configurations) Go to the “Deployment” tab In the “Deploy at Server Startup” section, remove (if present) the artifact my-webapp-name:war Click the add icon, … Read more

Jboss 7 war deployment failed

Well I tried deleting the log file, it helped at the beginning but then I got the error again. The proper solution is as following: Go to Jboss_installation_dir\standalone\configuration and find the file standalone.xml. Change the following line: <subsystem xmlns=”urn:jboss:domain:deployment-scanner:1.0″> <deployment-scanner scan-interval=”5000″ relative-to=”jboss.server.base.dir” path=”deployments” /> </subsystem> into: <subsystem xmlns=”urn:jboss:domain:deployment-scanner:1.0″> <deployment-scanner scan-interval=”5000″ relative-to=”jboss.server.base.dir” path=”deployments” deployment-timeout=”1000″ /> </subsystem> … Read more

UnsupportedClassVersionError unsupported major.minor version 51.0 unable to load class [duplicate]

Well presumably it’s not using the same version of Java when running it externally. Look through the startup scripts carefully to find where it picks up the version of Java to run. You should also check the startup logs to see whether they indicate which version is running. Alternatively, unless you need the Java 7 … Read more

spring-boot without parent pom.xml cannot generate war packaging

You removed the parent, so you lost its declaration of the WAR plugin configuration. Here it is: <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> See here for the source code. N.B. this is not necessary with Spring Boot 2.0 parent pom and above (the war plugin version is different), or if you use the latest war … Read more

Why spring boot generates jar or war file with .original extension?

The answer is that you are using repackage goal in your spring-boot-maven-plugin. So, What it does? Maven first builds your project and packages your classes and resources into a WAR (${artifactId}.war) file. Then, repackaging happens. In this goal, all the dependencies mentioned in the pom.xml are packaged inside a new WAR (${artifactId}.war) and the previously … Read more

In maven – how to rename the output .war file based on the name of the profile in use

You’ve answered yourself correctly: <profiles> <profile> <id>dev</id> <properties> <rp.build.warname>dev</rp.build.warname> </properties> </profile> <profile> <id>qa</id> <properties> <rp.build.warname>qa</rp.build.warname> </properties> </profile> <profile> <id>prod</id> <properties> <rp.build.warname>prod</rp.build.warname> </properties> </profile> </profiles> but there is a simpler way to redefine WAR name: <build> <finalName>${rp.build.warname}-somearbitraryname</finalName> <!– … –> </build> No maven-war-plugin is needed.

How can I store Java EE configuration parameters outside of an EAR or WAR?

See this question for reading properties file outside of the WAR file. See this question for reading variable values from JNDI. I believe that this is the best solution. You can read a String variable with this code: Context initialContext = new InitialContext(); String myvar = (String) initialContext.lookup(“java:comp/env/myvar”); The above code will work on all … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)