Push to origin/master was rejected
在使用Git Push代码的时候,会出现 Push to origin/master was rejected 的错误提示。
远程仓库和本地仓库的内容不一致
在命令窗输入下面命令:
git pull origin master --allow-unrelated-histories
如果无效的话,如果这个项目是刚建的话,可以重新建一个项目
创仓库的时候不要去点这些东西,让我们idea自己去创建master,那么就不会出现远程仓库和本地仓库的内容不一致
的情况了
enum+switch处理好采集信息BunkSaveListReq一级对应值
//enum+switch处理好BunkSaveListReq一级对应值 String dataKey = item.getDataKey(); switch (CollectShopPrimaryGroupEnum.getEnumByKey(dataKey)) { case SHOP_BASIC: bunkSaveListReq.setShopBasicList(shopList); break; case SHOP_IMAGE: bunkSaveListReq.setShopImageList(shopList); break; case SHOP_BUSINESS: bunkSaveListReq.setShopBusinessList(shopList); break; case SHOP_PROJECT: bunkSaveListReq.setShopProjectList(shopList); break; case SHOP_LEGAL: bunkSaveListReq.setShopLegalList(shopList); break; case SHOP_OTHER: bunkSaveListReq.setShopOtherList(shopList); break; default: break; }
public enum CollectShopPrimaryGroupEnum { SHOP_BASIC("collect_shop_basic", "基础信息"), SHOP_IMAGE("collect_shop_image", "相关图片"), SHOP_BUSINESS("shop_business_cond", "商务条件"), SHOP_PROJECT("shop_engineer_cond", "工程条件"), SHOP_LEGAL("shop_legal_license", "法务附件"), SHOP_OTHER("collect_shop_other", "其他信息"), SHOP_OPERATION("shop_operation", "经营信息"); String key; String value; CollectShopPrimaryGroupEnum(String key, String value) { this.key = key; this.value = value; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public static CollectShopPrimaryGroupEnum getEnumByKey(String key) { try { for (CollectShopPrimaryGroupEnum collectShopPrimaryGroupEnum : CollectShopPrimaryGroupEnum.values()) { if (StringUtils.equals(key, collectShopPrimaryGroupEnum.getKey())) { return collectShopPrimaryGroupEnum; } } } catch (Exception e) { e.printStackTrace(); } return null; } }
idea 如何进入debug(常规操作)
首先我们跳转到一个地址,发现没有页面显示,url一看问题可能出在后端,后端查看错误
空指针异常一般很好找到,但是代码量多了以后,其他问题多了,用debug能过更快地解决问题
1.进入debug模式(基础知识列表)
1、设置断点
2、启动servers端的debug模式
3、运行程序,在后台遇到断点时,进入debug调试状态
action没有值,而action是那个从前端来的,所以
结果是少了这行代码,所以action空指针异常。
request调用方法实例
package com.study; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class RequestAPIServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException{ System.out.println("================================"); System.out.println("URI====>"+req.getRequestURI()); System.out.println("URL====="+req.getRequestURL()); System.out.println("客户端 ip地址 => " + req.getRemoteHost());//如果是本地地址的话,0:0:0:0:0:0:0:1是ipv6的表现形式,对应ipv4来说相当于127.0.0.1 System.out.println("请求头User-Agent ==== " + req.getHeader("User-Agent")); System.out.println( "请求的方式 ==== " + req.getMethod() ); System.out.println("request.getContextPath()==="+req.getContextPath());//request.getContextPath() 返回站点的根目录,这里没有设置 System.out.println("request.getLocalAddr()==="+req.getLocalAddr()); System.out.println("request.getPathInfo()===="+req.getPathInfo());//请求的serlvet的url的路径 System.out.println("request.getPathTranslated()==="+req.getPathTranslated());//URL 的路径信息,如果没有信息则返回 null System.out.println("request.getRemoteAddr()==="+req.getRemoteAddr()); System.out.println("request.getScheme()==="+req.getScheme());//协议名称 System.out.println("request.getServerName()==="+req.getServerName()); System.out.println("request.getServletPath()==="+req.getServletPath()); System.out.println("request.getClass()===="+req.getClass()); System.out.println("request.getHeaderNames()===="+req.getHeaderNames()); System.out.println("request.getLocales()===="+req.getLocales()); System.out.println("request.getParameterMap()===="+req.getParameterMap());//一个Map类型的值,该返回值记录着前端所提交请求中的请求参数和请求参数值的映射关系 System.out.println("request.getUserPrincipal()===="+req.getUserPrincipal());//没有通过认证就没有返回值,是用户登录后才有值的 System.out.println("request.getParameterNames()===="+req.getParameterNames()); System.out.println("request.getRealPath===="+req.getRealPath("dong"));//已过时 } }
xml:
RequestAPIServlet com.study.RequestAPIServlet RequestAPIServlet /requestAPIServlet
结果:
URI====>/requestAPIServlet URL===http://localhost:8888/requestAPIServlet 客户端 ip地址 => 0:0:0:0:0:0:0:1 请求头User-Agent ==== Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4343.0 Safari/537.36 请求的方式 ==== GET request.getContextPath()= request.getLocalAddr()===0:0:0:0:0:0:0:1 request.getPathInfo()====null request.getPathTranslated()===null request.getRemoteAddr()===0:0:0:0:0:0:0:1 request.getScheme()===http request.getServerName()=localhost request.getServletPath()=/requestAPIServlet request.getClass()====class org.apache.catalina.connector.RequestFacade request.getHeaderNames()====org.apache.tomcat.util.http.NamesEnumerator@5a3ed1e2 request.getLocales()java.util.Collections$3@5eb80f1 request.getParameterMap(){} request.getUserPrincipal()====null request.getParameterNames()java.util.Collections$3@ffe5ae5 request.getRealPathD:\code\graduationproject\travel\out\artifacts\07_servlet_war_exploded\dong
Error during artifact deployment. See server log for details.
致命的问题导致
项目起不来和项目即使起来了也是404页面或者spring全家桶里实现的功能全部不能使用
我的解决方案是代码的问题!!!
同名冲突!
解决
1、先解决Tomcat配置
https://blog.csdn.net/weixin_43206161/article/details/104401688
2、1.没解决
maven配置看看
基本问题出在这两块