Tag Archives: Error report summary

Error resolving template [index], template might not exist

Problem: error resolving template [index], template may not exist
Solution:
1. Check the project structure first and check whether the location of the static resource file is misplaced

2. Check if the thymeleaf dependency in pom.xml is imported correctly
At first, I only imported the following dependencies, but it reported an error

  <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

3. Change to the following, just download it again

<!--        thymeleaf -->
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring5</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-java8time</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

[Solved] Error creating bean with name ‘accountService‘: Unsatisfied dependency expressed through field

Error creating bean with name ‘accountService’: Unsatisfied dependency expressed through field ‘accountDao’;

Spring integration mybatis error:

Warning: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accountService': Unsatisfied dependency expressed through field 'accountDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountDao' defined in file [D:\myJava\MyProject\springSSM_day06\target\classes\com\itheima\dao\AccountDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [bean.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found
Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accountService': Unsatisfied dependency expressed through field 'accountDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountDao' defined in file [D:\myJava\MyProject\springSSM_day06\target\classes\com\itheima\dao\AccountDao.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [bean.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)

Error code location: value = datasource

<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="${jdbc.driver}"></property>
        <property name="url" value="${jdbc.url}"></property>
        <property name="username" value="${jdbc.username}"></property>
        <property name="password" value="${jdbc.password}"></property>
    </bean>


<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" value="dataSource"></property>
        <property name="typeAliasesPackage" value="com.itheima.domain"></property>
    </bean>

Reason: because we use the factory to create Dao objects, we need to get connections from the data connection pool objects, so we can’t use value binding
value for binding strings
ref for binding objects

The correct is as follows: use ref to get the object

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"></property>
        <property name="typeAliasesPackage" value="com.itheima.domain"></property>
    </bean>

Project startup error: outofmemoryerror [How to Solve]

1. check tomcat settings, whether the start is set at the same time build, if so, to remove
2.  configurate tomcat的vm option
-server -Xms512m -Xmx2048m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=512m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8

3 Set the compile size
Settings -> Build, Execution, Deployment -> Complier -> Build process heap size VM options

4 Check the VMs that come with Idea
Help – >Edit  Custom VM Options

[Solved] ModuleNotFoundError: No module named ‘_polyiou‘

Problem recurrence

//install swig
sudo apt-get install swig
swig -c++ -python polyiou.i
python setup.py build_ext --inplace

//report error
ModuleNotFoundError: No module named '_polyiou'

Solution:

Swig is not installed correctly. Because there are python2 and python3 in the environment, the command to install swig is modified as follows

sudo apt-get install swig
swig -c++ -python polyiou.i
python3 setup.py build_ext --inplace