0

The problem is, before maven building, it was working very well in dev environment:

enter image description here

But when I tried to execute the jar file in cmd, with maven packaging it works well until the server runs. But there's a problem approaching it:

enter image description here

A few moments later: enter image description here

I thought when I tried jar file running the path something must be ready for build, so I modified the /login/inc/layout ---> login/inc/layout
it's working but there's a lot of path problem remained..

  1. What should I do to be able to use jar file?
  2. What cause the problems?

as a reqeust

my project name is Onuel

 C:\Users\hyuno\git\Oneul\OneulPrj directory

2021-07-20  오후 05:11    <DIR>          .
2021-07-20  오후 05:11    <DIR>          ..
2021-07-20  오후 05:11             2,017 .classpath
2021-07-20  오후 05:11             1,889 .gitignore
2021-07-20  오후 05:11    <DIR>          .mvn
2021-07-20  오후 05:11               713 .project
2021-07-20  오후 05:11    <DIR>          .settings
2021-07-20  오후 05:11             1,581 HELP.md
2021-07-20  오후 05:11            10,380 mvnw
2021-07-20  오후 05:11             6,790 mvnw.cmd
2021-07-20  오후 05:12             3,609 pom.xml
2021-07-20  오후 05:11    <DIR>          src
2021-07-20  오후 05:23    <DIR>          target


 C:\Users\hyuno\git\Oneul\OneulPrj\target directory

2021-07-20  오후 05:23    <DIR>          .
2021-07-20  오후 05:23    <DIR>          ..
2021-07-20  오후 05:11    <DIR>          classes
2021-07-20  오후 05:23    <DIR>          generated-sources
2021-07-20  오후 05:23    <DIR>          generated-test-sources
2021-07-20  오후 05:23    <DIR>          maven-archiver
2021-07-20  오후 05:23    <DIR>          maven-status
2021-07-20  오후 05:23        45,444,058 oneul-1.0.jar
2021-07-20  오후 05:23         2,387,346 oneul-1.0.jar.original
2021-07-20  오후 05:23    <DIR>          surefire-reports
2021-07-20  오후 05:11    <DIR>          test-classes


<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.oneul.web</groupId>
    <artifactId>oneul</artifactId>
    <version>1.0</version>
    <name>bootPrj</name>
    <description>Spring Boot Project</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter-test</artifactId>
            <version>2.2.0</version>
            <scope>test</scope>
        </dependency>
        
        <!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-jasper -->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>            
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.tiles/tiles-jsp -->
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>3.0.8</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-el</artifactId>
            <version>3.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <!-- 메일 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>2.3.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>nz.net.ultraq.thymeleaf</groupId>
            <artifactId>thymeleaf-layout-dialect</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

++ request

Template files loaction
It's in jar
C:\Users\hyuno\git\Oneul\OneulPrj\target\bootPrj-1.0.jar\BOOT-INF\classes\templates

ohhyeon
  • 1
  • 1
  • Does this answer your question? [Spring Boot gives "TemplateInputException: Error resolving template" when running from jar](https://stackoverflow.com/questions/27249078/spring-boot-gives-templateinputexception-error-resolving-template-when-runnin) – deadshot Jul 20 '21 at 09:05
  • @ohhyeon: wellcome to stackoverflow: next time you post an question, please include the console output as text, but not as an image. "not working" is an inadequate description of a problem. Therefore, it is only guesswork when trying to answer the question. You need to post more information about your project, if it is a maven problem then post the `pom.xml` (or at least the relevant parts). I also think that the problem is related to paths and folders, therefore add information about locations of the files. – Ralph Jul 20 '21 at 09:10
  • just want to know what cause the path problem ... i think that build path is changed on before and after...? – ohhyeon Jul 20 '21 at 09:40
  • where is the template file located? – Ralph Jul 20 '21 at 18:40
  • Template files loaction It's in jar > C:\Users\hyuno\git\Oneul\OneulPrj\target\bootPrj-1.0.jar\BOOT-INF\classes\templates. I saw some writes that mention "You must only use relative paths to return the template location". I used first "/" starting path. I think, in dev environment, they resolved well , but in jar environment, It didn't. Am I right? kk – ohhyeon Jul 22 '21 at 06:32

0 Answers0