php non object,Laravel 避免 Trying to get property of non-object 错误的六种方法 [新增第六种 data_get]...

本文介绍了在PHP中处理可能为null的对象属性时,如何避免触发错误。包括使用isset进行常规判断、PHP7的NULL合并操作符、Laravel的optional辅助函数、object_get和data_get辅助函数的使用方法。此外,还提到了空对象模式,并提供了相关辅助函数的实现代码。文章适合关注PHP和Laravel开发的读者。

在使用链式操作的时候,例如:

return $user->avatar->url;

如果 $user->avatar 为 null,就会引起 (E_ERROR) Trying to get property 'url' of non-object 错误。

1. 常规方法是使用 isset 加以判断:

if(isset($user->avatar->url))

return $user->avatar->url;

else

return 'defaultUrl';

如果在 blade 模板的 echo 中,可以使用:

{{ $user->avatar->url or 'defaultUrl' }}

上述代码会被 Blade 引擎解析为:

echo e(isset($user->avatar->url) ? $user->avatar->url : 'defaultUrl');

2. PHP7 可以使用 ?? (NULL 合并操作符) :

// 如果 $user->avatar->url 为 null, 返回 'defaultUrl'

return $user->avatar->url ?? 'defaultUrl';

3. Laravel 5.5 及以上可以使用 optional 辅助函数:

/**

* 如果给定的对象是 null , 那么属性和方法会简单地返回 null 而不是产生一个错误:

*/

return optional($user->avatar)->url;

Laravel 5.7 中,optional 函数还可以接受 匿名函数 作为第二个参数:

/**

* 如果第一个参数不为 null, 则调用闭包

* 详见 https://laravel\com/docs/5.7/helpers#method-optional

*/

return optional(User::find($id), function ($user) {

return new DummyUser;

});

4. 使用 object_get 辅助函数

return object_get($user->avatar, 'url', 'default');

这个函数原意是用来已 . 语法来获取对象中的属性,例如:

return object_get($user, 'avatar.url', 'default');

也可以达到避免 non-object 错误的效果。

if (! function_exists('object_get')) {

/**

* Get an item from an object using "dot" notation.

*

* @param object $object

* @param string $key

* @param mixed $default

* @return mixed

*/

function object_get($object, $key, $default = null)

{

if (is_null($key) || trim($key) == '') {

return $object;

}

foreach (explode('.', $key) as $segment) {

if (! is_object($object) || ! isset($object->{$segment})) {

return value($default);

}

$object = $object->{$segment};

}

return $object;

}

}

5. 使用 data_get 辅助函数

return data_get($user, 'avatar.url', 'default');

return data_get($user, ['avatar', 'url'], 'default');

以 . 语法来获取对象属性或数组元素。

if (! function_exists('data_get')) {

/**

* Get an item from an array or object using "dot" notation.

*

* @param mixed $target

* @param string|array $key

* @param mixed $default

* @return mixed

*/

function data_get($target, $key, $default = null)

{

if (is_null($key)) {

return $target;

}

$key = is_array($key) ? $key : explode('.', $key);

while (! is_null($segment = array_shift($key))) {

if ($segment === '*') {

if ($target instanceof Collection) {

$target = $target->all();

} elseif (! is_array($target)) {

return value($default);

}

$result = [];

foreach ($target as $item) {

$result[] = data_get($item, $key);

}

return in_array('*', $key) ? Arr::collapse($result) : $result;

}

if (Arr::accessible($target) && Arr::exists($target, $segment)) {

$target = $target[$segment];

} elseif (is_object($target) && isset($target->{$segment})) {

$target = $target->{$segment};

} else {

return value($default);

}

}

return $target;

}

}

6.除此之外,还可以使用 Null Object Pattern(空对象模式):

感谢群里大佬 @盒子 和 @Outshine 提供的姿势。:kissing: :kissing: :kissing:

本作品采用《CC 协议》,转载必须注明作者和本文链接

原创。 所有 Laravel 文章均已收录至 Github laravel-tips 项目。

明明数据库,jsp页面编码格式,web.xml文件加过滤器都设置为UTF-8,为什么我在页面上输入的中文储存到sql表里却变成乱码,数据表也识别不了C:\apache-tomcat-9.0.93\bin\catalina.bat run [2025-05-30 09:35:16,385] 工件 shixun2:war: 正在等待服务器连接以启动工件部署… Using CATALINA_BASE: "C:\Users\31286\AppData\Local\JetBrains\IntelliJIdea2024.2\tomcat\a23a32d0-52f1-4bee-9b24-8fd1a98ef19b" Using CATALINA_HOME: "C:\apache-tomcat-9.0.93" Using CATALINA_TMPDIR: "C:\apache-tomcat-9.0.93\temp" Using JRE_HOME: "C:\Program Files\Java\jdk1.8" Using CLASSPATH: "C:\apache-tomcat-9.0.93\bin\bootstrap.jar;C:\apache-tomcat-9.0.93\bin\tomcat-juli.jar" Using CATALINA_OPTS: "" 30-May-2025 09:35:16.994 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.服务器版本: Apache Tomcat/9.0.93 30-May-2025 09:35:16.995 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器构建: Aug 2 2024 21:24:59 UTC 30-May-2025 09:35:16.995 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器版本号: 9.0.93.0 30-May-2025 09:35:16.995 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 操作系统名称: Windows 10 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS.版本: 10.0 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 架构: amd64 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java 环境变量: C:\Program Files\Java\jdk1.8\jre 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java虚拟机版本: 1.8.0_202-b08 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.供应商: Oracle Corporation 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\31286\AppData\Local\JetBrains\IntelliJIdea2024.2\tomcat\a23a32d0-52f1-4bee-9b24-8fd1a98ef19b 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\apache-tomcat-9.0.93 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.util.logging.config.file=C:\Users\31286\AppData\Local\JetBrains\IntelliJIdea2024.2\tomcat\a23a32d0-52f1-4bee-9b24-8fd1a98ef19b\conf\logging.properties 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcom.sun.management.jmxremote= 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcom.sun.management.jmxremote.port=1099 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcom.sun.management.jmxremote.ssl=false 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcom.sun.management.jmxremote.password.file=C:\Users\31286\AppData\Local\JetBrains\IntelliJIdea2024.2\tomcat\a23a32d0-52f1-4bee-9b24-8fd1a98ef19b\jmxremote.password 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcom.sun.management.jmxremote.access.file=C:\Users\31286\AppData\Local\JetBrains\IntelliJIdea2024.2\tomcat\a23a32d0-52f1-4bee-9b24-8fd1a98ef19b\jmxremote.access 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.rmi.server.hostname=127.0.0.1 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djdk.tls.ephemeralDHKeySize=2048 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dignore.endorsed.dirs= 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcatalina.base=C:\Users\31286\AppData\Local\JetBrains\IntelliJIdea2024.2\tomcat\a23a32d0-52f1-4bee-9b24-8fd1a98ef19b 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcatalina.home=C:\apache-tomcat-9.0.93 30-May-2025 09:35:16.996 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.io.tmpdir=C:\apache-tomcat-9.0.93\temp 30-May-2025 09:35:16.998 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent 使用APR版本[1.7.4]加载了基于APR的Apache Tomcat本机库[1.3.1]。 30-May-2025 09:35:16.998 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR功能:IPv6[true]、sendfile[true]、accept filters[false]、random[true]、UDS [true]。 30-May-2025 09:35:16.998 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL配置:useAprConnector[false],useOpenSSL[true] 30-May-2025 09:35:17.001 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL成功初始化 [OpenSSL 3.0.14 4 Jun 2024] 30-May-2025 09:35:17.104 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["http-nio-8080"] 30-May-2025 09:35:17.112 信息 [main] org.apache.catalina.startup.Catalina.load 服务器在[218]毫秒内初始化 30-May-2025 09:35:17.125 信息 [main] org.apache.catalina.core.StandardService.startInternal 正在启动服务[Catalina] 30-May-2025 09:35:17.125 信息 [main] org.apache.catalina.core.StandardEngine.startInternal 正在启动 Servlet 引擎:[Apache Tomcat/9.0.93] 30-May-2025 09:35:17.131 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"] 30-May-2025 09:35:17.139 信息 [main] org.apache.catalina.startup.Catalina.start [26]毫秒后服务器启动 已连接到服务器 [2025-05-30 09:35:17,419] 工件 shixun2:war: 正在部署工件,请稍候… 30-May-2025 09:35:19.320 信息 [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 09:35:19.528 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.web.filter.CharacterEncodingFilter - Filter 'encodingFilter' configured for use 09:35:19.552 [RMI TCP Connection(2)-127.0.0.1] INFO org.springframework.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet' 09:35:19.569 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'dispatcherServlet-servlet' 09:35:19.727 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\controller\ProductController.class] 09:35:19.728 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\controller\UserController.class] 09:35:19.804 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loaded 22 bean definitions from class path resource [spring-mvc.xml] 09:35:19.816 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\controller\ProductController.class] 09:35:19.816 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\controller\UserController.class] 09:35:19.820 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\service\impl\CategoryServiceImpl.class] 09:35:19.820 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\service\impl\ProductServiceImpl.class] 09:35:19.821 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\service\impl\UserServiceImpl.class] 09:35:19.825 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\config\SecurityConfig.class] 09:35:19.825 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loaded 8 bean definitions from class path resource [spring-mybatis.xml] 09:35:19.870 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 09:35:19.933 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' 09:35:19.950 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.apache.ibatis.logging.LogFactory - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter. 09:35:19.952 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\mapper\CategoryMapper.class] 09:35:19.952 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\mapper\ProductMapper.class] 09:35:19.952 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Identified candidate component class: file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\com\itheima\mapper\UserMapper.class] 09:35:19.953 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Creating MapperFactoryBean with name 'categoryMapper' and 'com.itheima.mapper.CategoryMapper' mapperInterface 09:35:19.953 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Enabling autowire by type for MapperFactoryBean with name 'categoryMapper'. 09:35:19.953 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Creating MapperFactoryBean with name 'productMapper' and 'com.itheima.mapper.ProductMapper' mapperInterface 09:35:19.953 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Enabling autowire by type for MapperFactoryBean with name 'productMapper'. 09:35:19.953 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Creating MapperFactoryBean with name 'userMapper' and 'com.itheima.mapper.UserMapper' mapperInterface 09:35:19.953 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Enabling autowire by type for MapperFactoryBean with name 'userMapper'. 09:35:20.032 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0' 09:35:20.053 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.datasource.driverClassName] 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.datasource.driverClassName] not found - trying original name [spring.datasource.driverClassName]. javax.naming.NameNotFoundException: ����[spring.datasource.driverClassName]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.driverClassName]�� 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.datasource.driverClassName] 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [spring.datasource.driverClassName] threw NamingException with message: ����[spring.datasource.driverClassName]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.driverClassName]��. Returning null. 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Found key 'spring.datasource.driverClassName' in PropertySource 'localProperties' with value of type String 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.datasource.url] 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.datasource.url] not found - trying original name [spring.datasource.url]. javax.naming.NameNotFoundException: ����[spring.datasource.url]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.url]�� 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.datasource.url] 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [spring.datasource.url] threw NamingException with message: ����[spring.datasource.url]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.url]��. Returning null. 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Found key 'spring.datasource.url' in PropertySource 'localProperties' with value of type String 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.datasource.username] 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.datasource.username] not found - trying original name [spring.datasource.username]. javax.naming.NameNotFoundException: ����[spring.datasource.username]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.username]�� 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.datasource.username] 09:35:20.054 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [spring.datasource.username] threw NamingException with message: ����[spring.datasource.username]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.username]��. Returning null. 09:35:20.055 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Found key 'spring.datasource.username' in PropertySource 'localProperties' with value of type String 09:35:20.055 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.datasource.password] 09:35:20.055 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.datasource.password] not found - trying original name [spring.datasource.password]. javax.naming.NameNotFoundException: ����[spring.datasource.password]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.password]�� 09:35:20.055 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.datasource.password] 09:35:20.055 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [spring.datasource.password] threw NamingException with message: ����[spring.datasource.password]δ�ڴ��������а󶨡��Ҳ���[spring.datasource.password]��. Returning null. 09:35:20.055 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Found key 'spring.datasource.password' in PropertySource 'localProperties' with value of type String 09:35:20.055 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor' 09:35:20.057 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory' 09:35:20.060 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 09:35:20.061 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 09:35:20.069 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.ui.context.support.UiApplicationContextUtils - Unable to locate ThemeSource with name 'themeSource': using default [org.springframework.ui.context.support.ResourceBundleThemeSource@2f830e68] 09:35:20.071 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'productController' 09:35:20.097 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'productServiceImpl' 09:35:20.098 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'productMapper' 09:35:20.105 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'sqlSessionFactory' 09:35:20.106 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'dataSource' 09:35:20.165 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration 09:35:20.300 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed mapper file: 'file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\mapper\CategoryMapper.xml]' 09:35:20.321 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed mapper file: 'file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\mapper\ProductMapper.xml]' 09:35:20.330 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed mapper file: 'file [C:\apache-tomcat-9.0.93\webapps\shixun2_war\WEB-INF\classes\mapper\UserMapper.xml]' 09:35:20.339 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userServiceImpl' 09:35:20.341 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userMapper' 09:35:20.343 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'passwordEncoder' 09:35:20.343 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'securityConfig' 09:35:20.359 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'categoryServiceImpl' 09:35:20.359 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'categoryMapper' 09:35:20.360 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userController' 09:35:20.360 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'mvcContentNegotiationManager' 09:35:20.371 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping' 09:35:20.395 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'mvcCorsConfigurations' 09:35:20.395 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.handler.MappedInterceptor#0' 09:35:20.396 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.format.support.FormattingConversionServiceFactoryBean#0' 09:35:20.470 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - 20 mappings in 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping' 09:35:20.471 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter' 09:35:20.728 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice 09:35:20.758 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'mvcUriComponentsContributor' 09:35:20.764 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice 09:35:20.766 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0' 09:35:20.780 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver - ControllerAdvice beans: 0 @ExceptionHandler, 1 ResponseBodyAdvice 09:35:20.780 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0' 09:35:20.783 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0' 09:35:20.785 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping' 09:35:20.791 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter' 09:35:20.791 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter' 09:35:20.791 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.web.servlet.view.InternalResourceViewResolver#0' 09:35:20.818 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.liveBeansView.mbeanDomain] 09:35:20.818 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.liveBeansView.mbeanDomain] not found - trying original name [spring.liveBeansView.mbeanDomain]. javax.naming.NameNotFoundException: ����[spring.liveBeansView.mbeanDomain]δ�ڴ��������а󶨡��Ҳ���[spring.liveBeansView.mbeanDomain]�� 09:35:20.818 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.liveBeansView.mbeanDomain] 09:35:20.818 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [spring.liveBeansView.mbeanDomain] threw NamingException with message: ����[spring.liveBeansView.mbeanDomain]δ�ڴ��������а󶨡��Ҳ���[spring.liveBeansView.mbeanDomain]��. Returning null. 09:35:20.820 [RMI TCP Connection(2)-127.0.0.1] DEBUG org.springframework.web.servlet.DispatcherServlet - enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data 09:35:20.820 [RMI TCP Connection(2)-127.0.0.1] INFO org.springframework.web.servlet.DispatcherServlet - Completed initialization in 1268 ms [2025-05-30 09:35:20,829] 工件 shixun2:war: 工件已成功部署 [2025-05-30 09:35:20,829] 工件 shixun2:war: 部署已花费 3,410 毫秒 09:35:20.978 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet - GET "/shixun2_war/", parameters={} 09:35:20.982 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.itheima.controller.UserController#index() 09:35:20.997 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.view.JstlView - View name 'index', model {} 09:35:21.006 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.view.JstlView - Forwarding to [/WEB-INF/views/index.jsp] 09:35:21.499 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet - Completed 200 OK 09:35:21.683 [http-nio-8080-exec-10] DEBUG org.springframework.web.servlet.DispatcherServlet - GET "/shixun2_war/", parameters={} 09:35:21.683 [http-nio-8080-exec-10] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.itheima.controller.UserController#index() 09:35:21.685 [http-nio-8080-exec-10] DEBUG org.springframework.web.servlet.view.JstlView - View name 'index', model {} 09:35:21.685 [http-nio-8080-exec-10] DEBUG org.springframework.web.servlet.view.JstlView - Forwarding to [/WEB-INF/views/index.jsp] 09:35:21.686 [http-nio-8080-exec-10] DEBUG org.springframework.web.servlet.DispatcherServlet - Completed 200 OK 09:35:23.834 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.DispatcherServlet - GET "/shixun2_war/login", parameters={} 09:35:23.834 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.itheima.controller.UserController#toLoginPage() 09:35:23.834 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.view.JstlView - View name '/login', model {} 09:35:23.834 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.view.JstlView - Forwarding to [/WEB-INF/views//login.jsp] 09:35:23.895 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.DispatcherServlet - Completed 200 OK 30-May-2025 09:35:27.150 信息 [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [C:\apache-tomcat-9.0.93\webapps\manager] 30-May-2025 09:35:27.273 信息 [Catalina-utility-2] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 30-May-2025 09:35:27.327 信息 [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[C:\apache-tomcat-9.0.93\webapps\manager]的部署已在[175]毫秒内完成 09:35:27.756 [http-nio-8080-exec-5] DEBUG org.springframework.web.servlet.DispatcherServlet - POST "/shixun2_war/login", parameters={masked} 09:35:27.756 [http-nio-8080-exec-5] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.itheima.controller.UserController#login(String, String, Model, HttpSession) 09:35:27.840 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 09:35:27.850 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@87364d0] was not registered for synchronization because synchronization is not active 09:35:27.873 [http-nio-8080-exec-5] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 09:35:27.989 [http-nio-8080-exec-5] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited Fri May 30 09:35:28 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 09:35:29.209 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@59befa6] will not be managed by Spring 09:35:29.225 [http-nio-8080-exec-5] DEBUG com.itheima.mapper.UserMapper.findByUsername - ==> Preparing: SELECT * FROM user WHERE username = ? 09:35:29.272 [http-nio-8080-exec-5] DEBUG com.itheima.mapper.UserMapper.findByUsername - ==> Parameters: ����(String) 09:35:29.326 [http-nio-8080-exec-5] DEBUG com.itheima.mapper.UserMapper.findByUsername - <== Total: 1 09:35:29.338 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@87364d0] 09:35:29.431 [http-nio-8080-exec-5] DEBUG org.springframework.web.servlet.view.JstlView - View name 'products', model {msg=��¼�ɹ�} 09:35:29.431 [http-nio-8080-exec-5] DEBUG org.springframework.web.servlet.view.JstlView - Forwarding to [/WEB-INF/views/products.jsp] 09:35:29.685 [http-nio-8080-exec-5] DEBUG org.springframework.web.servlet.DispatcherServlet - Completed 200 OK 09:35:30.947 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.DispatcherServlet - GET "/shixun2_war/addProduct", parameters={} 09:35:30.948 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.itheima.controller.ProductController#showAddProductPage(Model) 09:35:30.950 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 09:35:30.950 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1111c6ec] was not registered for synchronization because synchronization is not active 09:35:30.950 [http-nio-8080-exec-6] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 09:35:30.950 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@59befa6] will not be managed by Spring 09:35:30.950 [http-nio-8080-exec-6] DEBUG com.itheima.mapper.CategoryMapper.selectAllEnabledCategories - ==> Preparing: SELECT category_id, category_name, parent_id, status FROM category WHERE status = 1 ORDER BY parent_id ASC, category_id ASC 09:35:30.950 [http-nio-8080-exec-6] DEBUG com.itheima.mapper.CategoryMapper.selectAllEnabledCategories - ==> Parameters: 09:35:30.953 [http-nio-8080-exec-6] DEBUG com.itheima.mapper.CategoryMapper.selectAllEnabledCategories - <== Total: 7 09:35:30.953 [http-nio-8080-exec-6] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1111c6ec] ��ѯ���ķ�������: 7 ����ID: 1, ����: �������� ����ID: 2, ����: �鼮�̲� ����ID: 3, ����: ��װ���� ����ID: 4, ����: �˶����� ����ID: 5, ����: �Ҿ߼Ҿ� ����ID: 6, ����: ��ʳС�� ����ID: 7, ����: ���� 09:35:30.954 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.view.JstlView - View name 'addProduct', model {categories=[com.itheima.entity.Category@7ab4e603, com.itheima.entity.Category@343cb5e5, com.itheima.entity.Category@32bde4db, com.itheima.entity.Category@3ce9025e, com.itheima.entity.Category@61b06f3e, com.itheima.entity.Category@30726d70, com.itheima.entity.Category@6d34cc99]} 09:35:30.954 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.view.JstlView - Forwarding to [/WEB-INF/views/addProduct.jsp] 09:35:31.316 [http-nio-8080-exec-6] DEBUG org.springframework.web.servlet.DispatcherServlet - Completed 200 OK 09:35:45.316 [http-nio-8080-exec-8] DEBUG org.springframework.web.servlet.DispatcherServlet - POST "/shixun2_war/addProduct", parameters={masked} 09:35:45.316 [http-nio-8080-exec-8] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.itheima.controller.ProductController#addProduct(Product, HttpSession) ���յ��ı���: ���� Service����յ���Product�����user_id: 2 09:35:45.355 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 09:35:45.355 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6a5bb5e0] was not registered for synchronization because synchronization is not active 09:35:45.355 [http-nio-8080-exec-8] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 09:35:45.355 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@59befa6] will not be managed by Spring 09:35:45.355 [http-nio-8080-exec-8] DEBUG com.itheima.mapper.ProductMapper.insertProduct - ==> Preparing: INSERT INTO product ( product_id, user_id, category_id, title, description, original_price, current_price, negotiable, status, views, location ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 09:35:45.357 [http-nio-8080-exec-8] DEBUG com.itheima.mapper.ProductMapper.insertProduct - ==> Parameters: null, 2(Integer), 4(String), ����(String), 99��(String), 0.0(Double), 0.0(Double), true(Boolean), null, 0(Integer), ��ɽ��A1(String) 09:35:45.362 [http-nio-8080-exec-8] DEBUG com.itheima.mapper.ProductMapper.insertProduct - <== Updates: 1 09:35:45.362 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6a5bb5e0] 09:35:45.382 [http-nio-8080-exec-8] DEBUG org.springframework.web.servlet.view.RedirectView - View name 'redirect:', model {product=com.itheima.entity.Product@1cd9bc21, org.springframework.validation.BindingResult.product=org.springframework.validation.BeanPropertyBindingResult: 0 errors} 09:35:45.382 [http-nio-8080-exec-8] DEBUG org.springframework.web.servlet.DispatcherServlet - Completed 302 FOUND 09:35:45.387 [http-nio-8080-exec-9] DEBUG org.springframework.web.servlet.DispatcherServlet - GET "/shixun2_war/products", parameters={} 09:35:45.388 [http-nio-8080-exec-9] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to com.itheima.controller.ProductController#showProducts(Model) 09:35:45.388 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 09:35:45.388 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7dd0f5d5] was not registered for synchronization because synchronization is not active 09:35:45.388 [http-nio-8080-exec-9] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 09:35:45.388 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@59befa6] will not be managed by Spring 09:35:45.388 [http-nio-8080-exec-9] DEBUG com.itheima.mapper.ProductMapper.selectAllProducts - ==> Preparing: SELECT product_id, user_id, category_id, title, description, original_price, current_price, negotiable, status, views, location FROM product 09:35:45.388 [http-nio-8080-exec-9] DEBUG com.itheima.mapper.ProductMapper.selectAllProducts - ==> Parameters: 09:35:45.401 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7dd0f5d5] 09:35:45.430 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loaded 11 bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml] 09:35:45.437 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'DB2' 09:35:45.441 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'Derby' 09:35:45.441 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'H2' 09:35:45.447 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'HDB' 09:35:45.448 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'HSQL' 09:35:45.448 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'Informix' 09:35:45.448 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'MS-SQL' 09:35:45.448 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'MySQL' 09:35:45.448 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'Oracle' 09:35:45.448 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'PostgreSQL' 09:35:45.448 [http-nio-8080-exec-9] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'Sybase' 09:35:45.454 [http-nio-8080-exec-9] DEBUG org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource [com.alibaba.druid.pool.DruidDataSource@31a25dd8] 09:35:45.458 [http-nio-8080-exec-9] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 09:35:45.460 [http-nio-8080-exec-9] DEBUG org.springframework.jdbc.support.SQLErrorCodesFactory - SQL error codes for 'MySQL' found 09:35:45.460 [http-nio-8080-exec-9] DEBUG org.springframework.jdbc.support.SQLErrorCodesFactory - Caching SQL error codes for DataSource [com.alibaba.druid.pool.DruidDataSource@31a25dd8]: database product name is 'MySQL' 09:35:45.461 [http-nio-8080-exec-9] DEBUG org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator - Unable to translate SQLException with Error code '0', will now try the fallback translator 09:35:45.465 [http-nio-8080-exec-9] DEBUG org.springframework.web.servlet.DispatcherServlet - Failed to complete request: org.springframework.dao.DataIntegrityViolationException: Error attempting to get column 'title' from result set. Cause: java.sql.SQLDataException: Cannot determine value type from string '����' ; Cannot determine value type from string '����'; nested exception is java.sql.SQLDataException: Cannot determine value type from string '����'
05-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值