项目部署到阿里云后无法获取图片和信息
来源:3-3 验证配置
追风之神
2019-02-02
1.项目在本地访问frontend/index可以获得图片和信息,我在自己的笔记本电脑做了主从同步,主库和从库分别装在两台虚拟机上。访问frontend/index接口时日志如下:
2019-02-02 22:19:57.516[http-nio-8080-exec-2] DEBUG c.imooc.o2o.dao.split.DynamicDataSourceInterceptor - 设置方法[com.imooc.o2o.dao.ShopCategoryDao.queryShopCategory] use [slave] Strategy ,SqlCommanType[SELECT]...
2019-02-02 22:19:57.516[http-nio-8080-exec-4] DEBUG c.imooc.o2o.dao.split.DynamicDataSourceInterceptor - 设置方法[com.imooc.o2o.dao.ShopCategoryDao.queryShopCategory] use [slave] Strategy ,SqlCommanType[SELECT]...
2019-02-02 22:19:57.531[http-nio-8080-exec-2] DEBUG com.imooc.o2o.dao.split.DynamicDataSourceHolder - 所使用的数据源为:slave
2019-02-02 22:19:57.531[http-nio-8080-exec-4] DEBUG com.imooc.o2o.dao.split.DynamicDataSourceHolder - 所使用的数据源为:slave
2019-02-02 22:19:57.571[http-nio-8080-exec-4] DEBUG c.imooc.o2o.dao.ShopCategoryDao.queryShopCategory - ==> Preparing: SELECT shop_category_id, shop_category_name, shop_category_desc, shop_category_img, priority, create_time, last_edit_time, parent_id FROM tb_shop_category WHERE parent_id is null ORDER BY priority DESC
2019-02-02 22:19:57.571[http-nio-8080-exec-2] DEBUG c.imooc.o2o.dao.ShopCategoryDao.queryShopCategory - ==> Preparing: SELECT shop_category_id, shop_category_name, shop_category_desc, shop_category_img, priority, create_time, last_edit_time, parent_id FROM tb_shop_category WHERE parent_id is null ORDER BY priority DESC
二月 02, 2019 10:19:57 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 2, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 10000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hgeby9a01cftwaysqoxj4|20d4ef38, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgeby9a01cftwaysqoxj4|20d4ef38, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://192.168.17.132:3306/o2o?useUnicode=true&characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
2019-02-02 22:19:58.069[http-nio-8080-exec-2] DEBUG c.imooc.o2o.dao.ShopCategoryDao.queryShopCategory - ==> Parameters:
2019-02-02 22:19:58.069[http-nio-8080-exec-4] DEBUG c.imooc.o2o.dao.ShopCategoryDao.queryShopCategory - ==> Parameters:
2019-02-02 22:19:58.109[http-nio-8080-exec-2] DEBUG c.imooc.o2o.dao.ShopCategoryDao.queryShopCategory - <== Total: 2
2019-02-02 22:19:58.109[http-nio-8080-exec-4] DEBUG c.imooc.o2o.dao.ShopCategoryDao.queryShopCategory - <== Total: 2
2019-02-02 22:19:58.134[http-nio-8080-exec-2] DEBUG c.imooc.o2o.dao.split.DynamicDataSourceInterceptor - 设置方法[com.imooc.o2o.dao.HeadLineDao.queryHeadLine] use [slave] Strategy ,SqlCommanType[SELECT]...
2019-02-02 22:19:58.135[http-nio-8080-exec-2] DEBUG com.imooc.o2o.dao.split.DynamicDataSourceHolder - 所使用的数据源为:slave
2019-02-02 22:19:58.136[http-nio-8080-exec-4] DEBUG c.imooc.o2o.dao.split.DynamicDataSourceInterceptor - 设置方法[com.imooc.o2o.dao.HeadLineDao.queryHeadLine] use [slave] Strategy ,SqlCommanType[SELECT]...
2019-02-02 22:19:58.136[http-nio-8080-exec-4] DEBUG com.imooc.o2o.dao.split.DynamicDataSourceHolder - 所使用的数据源为:slave
2019-02-02 22:19:58.145[http-nio-8080-exec-4] DEBUG com.imooc.o2o.dao.HeadLineDao.queryHeadLine - ==> Preparing: SELECT line_id, line_name, line_link, line_img, priority, enable_status, create_time, last_edit_time FROM tb_head_line WHERE enable_status = ? ORDER BY priority DESC
2019-02-02 22:19:58.146[http-nio-8080-exec-2] DEBUG com.imooc.o2o.dao.HeadLineDao.queryHeadLine - ==> Preparing: SELECT line_id, line_name, line_link, line_img, priority, enable_status, create_time, last_edit_time FROM tb_head_line WHERE enable_status = ? ORDER BY priority DESC
2019-02-02 22:19:58.146[http-nio-8080-exec-4] DEBUG com.imooc.o2o.dao.HeadLineDao.queryHeadLine - ==> Parameters: 1(Integer)
2019-02-02 22:19:58.217[http-nio-8080-exec-4] DEBUG com.imooc.o2o.dao.HeadLineDao.queryHeadLine - <== Total: 2
2019-02-02 22:19:58.318[http-nio-8080-exec-2] DEBUG com.imooc.o2o.dao.HeadLineDao.queryHeadLine - ==> Parameters: 1(Integer)
2019-02-02 22:19:58.418[http-nio-8080-exec-2] DEBUG com.imooc.o2o.dao.HeadLineDao.queryHeadLine - <== Total: 2
2.jdbc的配置文件如下:
jdbc.driver=com.mysql.jdbc.Driver
jdbc.master.url=jdbc:mysql://192.168.17.131:3306/o2o?useUnicode=true&characterEncoding=utf8
jdbc.slave.url=jdbc:mysql://192.168.17.132:3306/o2o?useUnicode=true&characterEncoding=utf8
jdbc.username=jerry
jdbc.password=JerryLee520!
3.运行截图:
4.在阿里云服务器上的效果:
5.阿里云tomcat的debug.log输出日志如下,error.log和infor.log没有日志:
2019-02-02 22:18:51.648[http-nio-80-exec-36] DEBUG c.imooc.o2o.dao.split.DynamicDataSourceInterceptor - 设置方法[com.imooc.o2o.dao.ShopCategoryDao.queryShopCategory] use [slave] Strategy ,SqlCommanType[SELECT]...
2019-02-02 22:18:51.648[http-nio-80-exec-36] DEBUG com.imooc.o2o.dao.split.DynamicDataSourceHolder - 所使用的数据源为:slave
2019-02-02 22:20:42.304[http-nio-80-exec-34] DEBUG c.imooc.o2o.dao.split.DynamicDataSourceInterceptor - 设置方法[com.imooc.o2o.dao.ShopCategoryDao.queryShopCategory] use [slave] Strategy ,SqlCommanType[SELECT]...
2019-02-02 22:20:42.305[http-nio-80-exec-34] DEBUG com.imooc.o2o.dao.split.DynamicDataSourceHolder - 所使用的数据源为:slave
6.图片位置信息:
我实在是想不出哪里出错了。
server.xml如下:
向翔仔老师求助。
写回答
1回答
-
同学好,感谢提供如此详尽的信息,这样挺好的,便于问题解决。
出现这个问题可能的原因有几个
同学的数据有没有从后端获取出来
redis访问的是哪里的,服务器上的redis需要flush all一下
server.xml是服务器的不,如果是,请检查下文件夹的权限,需要用root帐号 chmod -R 777 图片目录,否则别的帐号可能没权限读取
路径问题,数据库里相对路径必须得/upload打头而非upload,这样遇到/upload会被解析成/home/jiange/image/upload + 除了/upload的后缀 ,拼接起来看看能否实际找到图片。
同学需要看看chrome开发者工具访问页面的时候是否报错, 如果开发者这里报404 就和3 4 相关 如果不报 就是1,2,3
022019-02-04
相似问题