.net 更新的时提示“从客户端中检测到有潜在危险的request.form值“的问题

.net用gridview编辑更新的时候,有报错,报错入题目,发现修改的字段里带有html的链接内容,
内容为:详细信息请点击 ,请问下这种情况应怎么处理下?
我看网上的一些说法,修改配置文件什么的都不行。请大神指教。

2个回答

你提交的时候是不是直接$("form的名字").serialize()提交的

changwen313
changwen313 自己已经解决,分还是给你。谢谢关注
2 年多之前 回复
changwen313
changwen313 sqlmm.executenonquery进行数据库提交的
2 年多之前 回复

配置文件加入有用

changwen313
changwen313 <httpRuntime maxRequestLength="10240" executionTimeout="60" requestValidationMode="2.0"/>
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
servlet调用dao层报错java.lang.ClassNotFoundException: com.mysql.cj.jdbc如何解决?
servlet调用dao层报错java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driv,,相关的jar包已经导入,并且用主函数传递数据在测试coverage时能够正常运行 ``` ``` ``` ``` //处理登录请求 public static void checkUser(ServletRequest req, ServletResponse res) { //获取请求信息 String name =(String) req.getParameter("name"); String pwd =(String) req.getParameter("pwd"); System.out.println("浏览器获取"+name+":"+pwd); //处理请求信息 userServiceImpl us=new userServiceImpl(); user u=us.checkUserService(name, pwd); //响应处理结果 System.out.println(u); //请求去转发 //重定向 //直接响应 } } ``` ``` public user cherDao(String name,String pwd) { //声明jdbc对象 Connection conn=null; PreparedStatement ps=null; ResultSet rs=null; //声明变量 user u=null; try { //加载驱动 System.out.println("加载驱动前"); Class.forName("com.mysql.cj.jdbc.Driver"); System.out.println("加载驱动后"); //获取连接 conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/zyn?useSSL=false&serverTimezone=UTC","root","123456"); //创建sql命令 String sql="select * from user where uname=? and pwd=?"; //创建sql命令对象 ps=conn.prepareStatement(sql); //给占位符赋值 ps.setString(1,name); ps.setString(2,pwd); //执行sql rs=ps.executeQuery(); //遍历结果 System.out.println("遍历结果前"); while (rs.next()) { System.out.println("DAO层"); u=new user(); u.setUid(rs.getInt("uid")); u.setUname(rs.getString("uname")); u.setPwd(rs.getString("pwd")); u.setSex(rs.getInt("sex")); u.setAge(rs.getInt("age")); u.setBirth(rs.getString("birth")); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } finally { try { rs.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { ps.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } //返回结果 return u; } } ``` ```
急!!!lua的ngx.req.get_post_args()为什么会在参数后面加上:true?
![图片说明](https://img-ask.csdn.net/upload/201906/05/1559723546_993295.png)![图片说明](https://img-ask.csdn.net/upload/201906/05/1559723561_444371.png) 第一个图是请求body的参数,第二个是ngx.req.get_post_args()获取到的参数,为什么会给我请求的参数再封装了一层? ``` --获取请求参数 function getRequestParam () local method = getRequestMethod() if "GET" == method then return ngx.req.get_uri_args() elseif "POST" == method then ngx.req.read_body() return ngx.req.get_post_args() end end ```
nodejs接收ajax提交的数据,req.on("data",......)不执行
客户端代码:$.ajax({ url:"http://127.0.0.1:1337/getOrder", dataType:"jsonp", data:{"state":"1"}, type:"get", success:function (chunk) { alert("成功"+chunk.result); }, error:function (err) { alert("失败"+err.message); } }); nodejs代码:var exp_serv=express(); exp_serv.get("/getOrder",function (req,res) { console.log("客户端连接已建立:"+req.host); req.on("data",function (data) { console.log(data.toString()); res.send(data); }) /**设置响应头允许ajax跨域访问**/ res.setHeader("Access-Control-Allow-Origin","*"); /*星号表示所有的异域请求都可以接受,*/ res.setHeader("Access-Control-Allow-Methods","GET","POST"); }) exp_serv.listen(1337,"127.0.0.1");
爬虫(python):为什么验证码总是验证失败(内有描述)?
#这是一个试图模拟12306登陆的程序,只到验证码部分 import urllib.request as U import urllib.parse as P import http.cookiejar as C import ssl import chardet as cd ssl._create_default_https_context = ssl._create_unverified_context #无视证书的有效性 opener = U.build_opener(U.HTTPCookieProcessor(C.CookieJar())) U.install_opener(opener) #创建一个访问者(具有cookie功能) req = U.Request("https://kyfw.12306.cn/passport/captcha/captcha-image64?login_site=E&module=login&rand=sjrand&1581337391968&callback=jQuery19109972447551572461_1581326959299&_=1581326959322") req.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362" res = opener.open(req) #申请验证码 url = "data:image/jpg;base64," + res.read().decode("utf-8").split('({"image":"')[1].split('","result_message"')[0] #12306分为申请验证码和生成两部分,这是根据两部分的URL规律,生成的验证码图片的URL req = U.Request(url) req.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362" res = opener.open(req) code_img = res.read() with open("D:\\py\\测试_练习综合体\\py练习\\imagecode12306.png","wb") as f: f.write(code_img) #获取验证码 pass_code = input("请输入验证码(坐标):") #根据图片获取验证码坐标 data = {"callback":"jQuery19109972447551572461_1581326959299","answer":pass_code,"rand":"sjrand","login_site":"E","_":"1581326959323"} data = P.urlencode(data).encode("utf-8") req = U.Request("https://kyfw.12306.cn/passport/captcha/captcha-check?callback=jQuery19109972447551572461_1581326959299&answer=188%2C49%2C30%2C39&rand=sjrand&login_site=E&_=1581326959323") req.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362" res = opener.open(req,data = data) html = res.read().decode("utf-8") #验证码验证 #疑问:为什么验证码验证总是失败了(通过html获得结果)
新登录的用户名怎么判断是否和已登录的用户名重名?
用户1、用户2、用户3、用户4依次登录,再登录用户2怎么判断是否重名 ![图片说明](https://img-ask.csdn.net/upload/202002/13/1581566962_929174.png) ![图片说明](https://img-ask.csdn.net/upload/202002/13/1581566977_484440.png) ``` package Pack; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; public class Test { private JFrame jf = null; private JTextField CastIPTxtFiled = new JTextField("228.9.6.8");// 组播IP地址文本框 private JTextField portTxtFiled = new JTextField("8000");// 端口地址文本框 private JTextField nameField = new JTextField("用户");// 用户名文本框 private JTextArea receiveMesArea = new JTextArea();// 接收消息文本域 private JTextArea sendMesArea = new JTextArea();// 发送消息文本域 private JButton startChatBtn = new JButton("开始聊天");// 按钮 private JButton stopChatBtn = new JButton("断开聊天"); private JButton quitBtn = new JButton("退出"); private JButton saveBtn = new JButton("保存"); private JButton cleaBtn = new JButton("清空"); private JButton sendBtn = new JButton("发送"); private JRadioButton groupchatBtn = new JRadioButton("群聊");// 单选按钮 private JRadioButton privatechatBtn = new JRadioButton("私聊"); private ButtonGroup btg = new ButtonGroup(); private JList<String> jlist = new JList<String>();// 列表框 private DefaultListModel<String> dlm = new DefaultListModel<String>();// 用dlm向jlist动态增删用户 private JScrollPane jScrollPane1 = new JScrollPane(receiveMesArea);// 滚动窗口 private JScrollPane jScrollPane2 = new JScrollPane(sendMesArea); private JScrollPane jScrollPane3 = new JScrollPane(jlist); private BroadCast broadCast = null; boolean broadCastIsDisable = true; boolean chitchat = true;// 判断是群聊还是私聊 public void InitFrame() { jf = new JFrame("组播聊天室"); jf.setLayout(null); jf.setSize(650, 530); jf.setLocationRelativeTo(null);// 在屏幕中居中显示 jf.setResizable(false);// 不可调整窗口大小 jf.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);// 标题栏关闭按钮失效 JLabel nameJLabel = new JLabel("用户名"); nameJLabel.setBounds(30, 80, 60, 20); jf.add(nameJLabel); nameField.setBounds(80, 80, 100, 20); jf.add(nameField); JLabel portTxtJLabel = new JLabel("端口地址"); portTxtJLabel.setBounds(300, 20, 60, 20); jf.add(portTxtJLabel); portTxtFiled.setBounds(360, 20, 100, 20); jf.add(portTxtFiled); JLabel CastIPTxtJLabel = new JLabel("组播IP地址"); CastIPTxtJLabel.setBounds(10, 20, 90, 20); jf.add(CastIPTxtJLabel); CastIPTxtFiled.setBounds(80, 20, 100, 20); jf.add(CastIPTxtFiled); startChatBtn.setBounds(220, 80, 100, 20); stopChatBtn.setBounds(360, 80, 100, 20); jf.add(startChatBtn); jf.add(stopChatBtn); JLabel receiveJLabel = new JLabel("接收消息"); receiveJLabel.setBounds(20, 140, 100, 20); jScrollPane1.setBounds(20, 160, 460, 130); jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jf.add(jScrollPane1); jf.add(receiveJLabel); JLabel sendJLabel = new JLabel("发送消息"); sendJLabel.setBounds(20, 300, 100, 20); jScrollPane2.setBounds(20, 320, 460, 100); jScrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jf.add(jScrollPane2); jf.add(sendJLabel); jlist.setModel(dlm); jScrollPane3.setBorder(BorderFactory.createTitledBorder("在线用户列表")); jScrollPane3.setBounds(500, 20, 120, 430); jScrollPane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jf.add(jScrollPane3); quitBtn.setBounds(20, 460, 100, 20); // 退出 jf.add(quitBtn); saveBtn.setBounds(140, 460, 100, 20); // 保存 jf.add(saveBtn); cleaBtn.setBounds(260, 460, 100, 20);// 清空 jf.add(cleaBtn); sendBtn.setBounds(380, 460, 100, 20); // 发送 jf.add(sendBtn); groupchatBtn.setBounds(120, 120, 100, 20); jf.add(groupchatBtn); privatechatBtn.setBounds(320, 120, 100, 20); jf.add(privatechatBtn); btg.add(groupchatBtn); btg.add(privatechatBtn); groupchatBtn.setSelected(true); jf.setVisible(true); // 显示窗口 BtnFalse(); Object1(); receiveMesArea.setEditable(false);// 接收消息文本域不能被编辑 sendBtn.setMnemonic(KeyEvent.VK_ENTER); // 给sendBtn设置快捷键(Alt+Enter) broadCast = new BroadCast(Integer.parseInt(portTxtFiled.getText()), CastIPTxtFiled.getText(), nameField.getText()); startChatBtn.addActionListener(new ButtonAction()); stopChatBtn.addActionListener(new ButtonAction()); groupchatBtn.addActionListener(new ButtonAction()); privatechatBtn.addActionListener(new ButtonAction()); quitBtn.addActionListener(new ButtonAction()); saveBtn.addActionListener(new ButtonAction()); cleaBtn.addActionListener(new ButtonAction()); sendBtn.addActionListener(new ButtonAction()); jlist.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { Object2(); } }); } public class ButtonAction implements ActionListener { public void actionPerformed(ActionEvent e) { if (e.getSource().equals(startChatBtn)) { jf.setTitle("当前用户:" + nameField.getText()); startChatBtn.setEnabled(false); BtnTrue(); Object2(); broadCastIsDisable = false; StartChat(); } else if (e.getSource().equals(stopChatBtn)) { jf.setTitle("组播聊天室"); startChatBtn.setEnabled(true); BtnFalse(); Object1(); broadCastIsDisable = true; broadCast.StopChat(); // 用户下线 } else if (e.getSource().equals(groupchatBtn)) { chitchat = true; Object2(); } else if (e.getSource().equals(privatechatBtn)) { chitchat = false; Object2(); } else if (e.getSource().equals(quitBtn)) { if (broadCastIsDisable == false) { broadCast.StopChat(); } System.exit(0); } else if (e.getSource().equals(saveBtn)) { try { SaveScreen(); Object2(); } catch (IOException e1) { e1.printStackTrace(); } } else if (e.getSource().equals(cleaBtn)) { ClearScreen(); Object2(); } else if (e.getSource().equals(sendBtn)) { if (sendMesArea.getText().equals("")) { JOptionPane.showMessageDialog(jf, "请输入需要发送的消息", "提示!!!", JOptionPane.ERROR_MESSAGE); } else { SendMessage(); sendMesArea.setText(null);// 按发送按钮,立即将发送消息文本域内容清空 } Object2(); } } } public void Object1() { nameField.requestFocusInWindow();// 将nameField设置为焦点 nameField.selectAll(); startChatBtn.getRootPane().setDefaultButton(startChatBtn);// 将startChatBtn设置为焦点,按回车相当于鼠标单击 } public void Object2() { sendMesArea.requestFocusInWindow(); } public void BtnTrue() {// 按钮可点击 stopChatBtn.setEnabled(true); sendBtn.setEnabled(true); groupchatBtn.setEnabled(true); privatechatBtn.setEnabled(true); } public void BtnFalse() {// 按钮不可点击 stopChatBtn.setEnabled(false); sendBtn.setEnabled(false); groupchatBtn.setEnabled(false); privatechatBtn.setEnabled(false); } public void StartChat() { // 用户上线开始聊天 String port = portTxtFiled.getText(); String castIp = portTxtFiled.getText(); if (!castIp.equals("") && !port.equals("")) { broadCast = new BroadCast(Integer.parseInt(portTxtFiled.getText()), CastIPTxtFiled.getText(), nameField.getText()); broadCast.start(); // 启动线程 } } public void SendMessage() { if (chitchat == true) { broadCast.SendMessage(sendMesArea.getText().toString()); } else { broadCast.SendMessage("@" + jlist.getSelectedValue() + "#" + sendMesArea.getText().toString()); } } public void SaveScreen() throws IOException { broadCast.SaveScreen(); } public void ClearScreen() { broadCast.ClearScreen(); } public static void main(String[] args) { Test client = new Test(); client.InitFrame(); } public class BroadCast extends Thread { public int port = 0; // 端口地址 String Ip = ""; // 组播IP地址 String name = ""; // 用户名 MulticastSocket multicastSocket = null; boolean StopThread = false; static final char FLAG_CHAT = '#'; static final char FLAG_PM_USER = '@'; static final char FLAG_PM_TEXT = '#'; static final char FLAG_ONLINE = '$'; static final char FLAG_OFFLINE = '&'; static final char FLAG_REQ_ONLINE = '*'; static final char FLAG_ALREADY_ONLINE = '+'; public BroadCast(int port, String Ip, String name) { this.port = port; this.Ip = Ip; this.name = name; } public void SocketSend(String data) // 发送组播消息 { try { byte[] buf = data.getBytes(); DatagramPacket datagramPacket1 = new DatagramPacket(buf, buf.length); InetAddress address = InetAddress.getByName(Ip); datagramPacket1.setAddress(address); datagramPacket1.setPort(port); multicastSocket.send(datagramPacket1); } catch (IOException e) { e.printStackTrace(); } } public void SendMessage(String message) // 发送组播消息 { SocketSend(FLAG_CHAT + this.name + ":" + message); // '#' + this.name + ":" + message } public void SendUserOnline() // 发送用户上线消息 { SocketSend(FLAG_ONLINE + this.name); // '$' + this.name } public void SendUserOffline() // 发送用户下线消息 { SocketSend(FLAG_OFFLINE + this.name); // '&' + this.name } public void ReqOnlineUser() // 请求在线用户 { SocketSend(String.valueOf(FLAG_REQ_ONLINE)); // '*' 请求在线用户 } public void SendAlreadyOnline() // 当前在线用户 { SocketSend(FLAG_ALREADY_ONLINE + this.name); // '+' + this.name } public void StopChat() { SendUserOffline(); // 发送用户下线消息 StopThread = true; // 用户下线 while (StopThread == true) { dlm.removeAllElements(); } } public void PrintMessageWT(String message) // 带时间的消息 { receiveMesArea.append("[" + GetSystemTime() + "] "); receiveMesArea.append(message); receiveMesArea.append("\n"); receiveMesArea.setCaretPosition(receiveMesArea.getText().length()); } public void SaveScreen() throws IOException { // 保存聊天记录 String msg = receiveMesArea.getText(); FileOutputStream Note = new FileOutputStream(this.name + "的聊天记录.txt"); PrintMessageWT("聊天记录保存地址:" + System.getProperty("user.dir") + "\\" + this.name + "的聊天记录.txt"); Note.write(msg.getBytes()); Note.close(); } public void ClearScreen() { receiveMesArea.setText(""); // 清空接收消息文本域内容 } public String GetSystemTime() { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); // 获取当前时间(格式yyyy-MM-dd HH:mm:ss) return sdf.format(new Date()); // 返回当前时间 } public void run() { // 启动线程 try { InetAddress address = InetAddress.getByName(Ip); multicastSocket = new MulticastSocket(this.port); multicastSocket.joinGroup(address); SendUserOnline(); // 发送用户上线消息 ReqOnlineUser(); // 请求在线用户 while (!StopThread) { byte[] buf = new byte[1024]; DatagramPacket datagramPacket = new DatagramPacket(buf, buf.length); if (multicastSocket.isClosed() == false) { multicastSocket.receive(datagramPacket); String string_MS = new String(datagramPacket.getData(), 0, datagramPacket.getLength()); switch (string_MS.charAt(0)) { case (FLAG_ONLINE): // '$' string_MS = string_MS.substring(1, string_MS.length()); // 去掉第一个字符,获取用户名 // dlm.addElement(string_MS); PrintMessageWT("系统提示:" + string_MS + " 上线!"); break; case (FLAG_OFFLINE): // '&' string_MS = string_MS.substring(1, string_MS.length()); dlm.removeElement(string_MS); PrintMessageWT("系统提示:" + string_MS + " 下线!"); break; case (FLAG_REQ_ONLINE): // '*' SendAlreadyOnline(); break; case (FLAG_ALREADY_ONLINE): // '+' string_MS = string_MS.substring(1, string_MS.length()); boolean notfound = true; for (int i = 0; i < dlm.size(); i++) { if (dlm.get(i).equals(string_MS)) { notfound = false; break; } } if (notfound == true) { if (nameField.getText().equals(string_MS)) { JOptionPane.showMessageDialog(jf, "欢迎加入组播聊天室!!!", "提示!!!", JOptionPane.INFORMATION_MESSAGE); } dlm.addElement(string_MS); // receiveMesArea.append("新加入用户:" + string_MS + "\n"); // receiveMesArea.append("目前总人數:" + String.valueOf(dlm.size()) + "\n"); } int max = dlm.size(), min = 0; int ran = (int) (Math.random() * (max - min) + min); jlist.setSelectedIndex(ran); } boolean IsPM1 = false, IsPM2 = false;// 判断是否为私聊,默认不是 int num1 = 0, num2 = 0; if (string_MS.charAt(0) == FLAG_CHAT) {// '#' 判断第一个字符是否相等 string_MS = string_MS.substring(1, string_MS.length());// 去掉第一个字符 for (int i = 0; i < string_MS.length(); i++) {// 私聊,判断@和#在哪个位置,获取姓名 if (string_MS.charAt(i) == FLAG_PM_USER) { // '@' num1 = i + 1; IsPM1 = true;// 是私聊 } if (string_MS.charAt(i) == FLAG_PM_TEXT) { // '#' num2 = i; } } String Chat_UserName = string_MS.substring(num1, num2++);// 获取私聊对象的姓名 if (IsPM1 == true) {// 是私聊 String PM_SenderName = string_MS.substring(0, num1 - 2);// 获取私聊对象的姓名 if (this.name.equals(Chat_UserName)) {// 是和我私聊 PrintMessageWT("私聊消息--> " + PM_SenderName + "@我:" + string_MS.substring(num2, string_MS.length())); } else if (this.name.equals(PM_SenderName)) {// 自己发私聊消息 PrintMessageWT("私聊消息--> " + "我@" + Chat_UserName + ":" + string_MS.substring(num2, string_MS.length())); } else {// 不是和我私聊 IsPM2 = true; } } if (IsPM1 == false && IsPM2 == false) { // 不是私聊 PrintMessageWT(string_MS); } } } } } catch (Exception e) { e.printStackTrace(); } try { multicastSocket.close(); } catch (Exception e) { e.printStackTrace(); } StopThread = false; } } } ```
python更新pip失败,困扰了我好久
更新pip老是出现下列一大串的文字,我在网上查了许多方法,都没用,有哪位大佬能说一下有什么方法解决这个问题。 这是使用管理员的运行 C:\Windows\system32>python -m pip install --upgrade pip WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/ Collecting pip Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB) |█████████████████████▌ | 962kB 2.9kB/s eta 0:02:44ERROR: Exception: Traceback (most recent call last): File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcher yield File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 479, in read data = self._fp.read(amt) File "D:\Program Files\python\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read data = self.__fp.read(amt) File "D:\Program Files\python\lib\http\client.py", line 454, in read n = self.readinto(b) File "D:\Program Files\python\lib\http\client.py", line 498, in readinto n = self.fp.readinto(b) File "D:\Program Files\python\lib\socket.py", line 669, in readinto return self._sock.recv_into(b) File "D:\Program Files\python\lib\ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "D:\Program Files\python\lib\ssl.py", line 1099, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\Program Files\python\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main status = self.run(options, args) File "D:\Program Files\python\lib\site-packages\pip\_internal\commands\install.py", line 345, in run resolver.resolve(requirement_set) File "D:\Program Files\python\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve self._resolve_one(requirement_set, req) File "D:\Program Files\python\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "D:\Program Files\python\lib\site-packages\pip\_internal\legacy_resolve.py", line 305, in _get_abstract_dist_for abstract_dist = self.preparer.prepare_linked_requirement( File "D:\Program Files\python\lib\site-packages\pip\_internal\operations\prepare.py", line 195, in prepare_linked_requirement unpack_url( File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 1058, in unpack_url unpack_http_url( File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 920, in unpack_http_url from_path, content_type = _download_http_url(link, File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 1152, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 861, in _download_url hashes.check_against_chunks(downloaded_chunks) File "D:\Program Files\python\lib\site-packages\pip\_internal\utils\hashes.py", line 75, in check_against_chunks for chunk in chunks: File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 829, in written_chunks for chunk in chunks: File "D:\Program Files\python\lib\site-packages\pip\_internal\utils\ui.py", line 156, in iter for x in it: File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 794, in resp_read for chunk in resp.raw.stream( File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 531, in stream data = self.read(amt=amt, decode_content=decode_content) File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 496, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "D:\Program Files\python\lib\contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. WARNING: You are using pip version 19.2.3, however version 20.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
请问doPost和doGet方法有什么不同,为什么例程里的方法写在doPost里,我的代码只能写在doGet
简单的说,就是同样的代码,例程里写在doPost()里 我的代码只能写在doGet()里,写在doPost()里不会生效 ![图片说明](https://img-ask.csdn.net/upload/201912/16/1576464697_537852.png) ![图片说明](https://img-ask.csdn.net/upload/201912/16/1576464706_339981.png) ++++++++++++++++++++++++++++++++++++++++++++++ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // 1、设置request编码 req.setCharacterEncoding("utf-8"); // 2、获取 jsp页面 中对应的参数,注意区分大小写 String username = req.getParameter("username"); String password = req.getParameter("password"); String checkCode = req.getParameter("checkCode"); // 3、获取 CheckCodeServlet.java 生成的验证码 // 注意,getAttribute() 里的参数是要存在的,CheckCodeServlet那里是有的 HttpSession session = req.getSession(); // Object checkCode_session = session.getAttribute("checkCode_session"); String checkCode_session = (String) session.getAttribute("checkCode_session"); // 注意,这里有两个验证码,可以理解为checkCode_session是答案,checkCode是试卷 // 4、判断验证码是否正确 // 注意,下面用到的比较方法可以不区分大小写,但是两个比较的值要是String,所以上面的Object要转型 if(checkCode_session.equalsIgnoreCase(checkCode)){ System.out.println("1111111"); // 如果验证码一致,则判断用户名与密码是否一致 if("ycw".equals(username) && "123".equals(password)){ System.out.println("2222222"); // 账号密码一致 // 这里原本是要调用 userDao 查询数据库的,现在只是模拟,下面的username也是暂时的 session.setAttribute("user", username); // ===>返回登录页面一个叫 user 的参数,它的值是username // 测试用 System.out.println("登录成功"); // 重定向到success.jsp resp.sendRedirect(req.getContextPath()+"/success.jsp"); } else { // 账号密码不一致 // 存储提示信息到request req.setAttribute("login_error", "账号或者密码错误"); // 转发到登录页面 req.getRequestDispatcher("/login.jsp").forward(req, resp); // 测试用 System.out.println("账号或者密码错误"); } } else { System.out.println("3333333"); // 验证码不一致 // 存储提示信息到request req.setAttribute("cc_error", "验证码错误"); // 转发到登录页面 req.getRequestDispatcher("/login.jsp").forward(req, resp); // 测试用 System.out.println("验证码错误"); } }
openstack启动实例报错No valid host was found
计算节点的nova错误日志: ``` 2020-02-11 17:05:07.817 1295 ERROR nova.virt.libvirt.guest [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] Error launching a defined domain with XML: <domain type='kvm'> 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Instance failed to spawn 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Traceback (most recent call last): 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2229, in _build_resources 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] yield resources 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2075, in _build_and_run_instance 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] block_device_info=block_device_info) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 2779, in spawn 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] block_device_info=block_device_info) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4923, in _create_domain_and_network 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] xml, pause=pause, power_on=power_on) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4854, in _create_domain 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] guest.launch(pause=pause) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 142, in launch 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] self._encoded_xml, errors='ignore') 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] self.force_reraise() 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] six.reraise(self.type_, self.value, self.tb) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 137, in launch 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] return self._domain.createWithFlags(flags) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 186, in doit 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] result = proxy_call(self._autowrap, f, *args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 144, in proxy_call 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] rv = execute(f, *args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 125, in execute 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] six.reraise(c, e, tb) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 83, in tworker 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] rv = meth(*args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1110, in createWithFlags 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] libvirtError: internal error: process exited while connecting to monitor: 2020-02-11T09:05:07.623239Z qemu-kvm: -drive file=/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk': Permission denied 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] ``` 控制节点的nova-conductor.log ``` 2020-02-11 17:05:08.365 958 ERROR nova.scheduler.utils [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Error from last host: compute (node compute): [u'Traceback (most recent call last):\n', u' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1937, in _do_build_and_run_instance\n filter_properties)\n', u' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2127, in _build_and_run_instance\n instance_uuid=instance.uuid, reason=six.text_type(e))\n', u"RescheduledException: Build of instance 8020d30b-33ec-4836-8f61-f23516aa2508 was re-scheduled: internal error: process exited while connecting to monitor: 2020-02-11T09:05:07.623239Z qemu-kvm: -drive file=/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk': Permission denied\n"] 2020-02-11 17:05:08.450 958 WARNING nova.scheduler.utils [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Setting instance to ERROR state. ``` dashboard上报错 ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412785_788625.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581413291_261638.png) 我的网络配置是 ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412842_430142.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412854_59896.png) 不知道有没有路过的大师指导这是什么原因啊,在网上找了好多方法没有解决。万分感谢!
openstack创建实例成功但是启动实例报错
以下是nova报错详情: ``` /var/log/nova/nova-compute.log:2020-02-11 08:43:18.893 1327 ERROR nova.virt.libvirt.guest [req-ecfa9ec9-82fd-42dd-838f-ff5938af32e7 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] Error launching a defined domain with XML: <domain type='kvm'> /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [req-ecfa9ec9-82fd-42dd-838f-ff5938af32e7 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Instance failed to spawn /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Traceback (most recent call last): /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2218, in _build_resources /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] except Exception: /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2064, in _build_and_run_instance /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] # saved in that function to prevent races. /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 2779, in spawn /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] block_device_info=block_device_info) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4923, in _create_domain_and_network /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] xml, pause=pause, power_on=power_on) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4854, in _create_domain /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] guest.launch(pause=pause) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 142, in launch /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] self._encoded_xml, errors='ignore') /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] self.force_reraise() /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] six.reraise(self.type_, self.value, self.tb) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 137, in launch /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] return self._domain.createWithFlags(flags) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 186, in doit /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] result = proxy_call(self._autowrap, f, *args, **kwargs) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 144, in proxy_call /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] rv = execute(f, *args, **kwargs) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 125, in execute /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] six.reraise(c, e, tb) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 83, in tworker /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] rv = meth(*args, **kwargs) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1110, in createWithFlags /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self) /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] libvirtError: 内部错误:qemu unexpectedly closed the monitor: 2020-02-11T00:43:18.668387Z qemu-kvm: -drive file=/var/lib/nova/instances/a26fb462-a721-45eb-8eaa-776ec5da3b23/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/a26fb462-a721-45eb-8eaa-776ec5da3b23/disk': Permission denied /var/log/nova/nova-compute.log:2020-02-11 08:43:18.895 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [req-ecfa9ec9-82fd-42dd-838f-ff5938af32e7 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Unexpected build failure, not rescheduling build. /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] Traceback (most recent call last): /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1926, in _do_build_and_run_instance /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2116, in _build_and_run_instance /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] exception.ImageNotActive, /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128) /var/log/nova/nova-compute.log:2020-02-11 08:43:19.145 1327 ERROR nova.compute.manager [instance: a26fb462-a721-45eb-8eaa-776ec5da3b23] ``` dashboard报错: ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581385833_715215.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581385890_574951.png) 网上说了很多办法都没有用,个人初学小白,有没有路过的大神指点一二。万分感谢!
我生成的mongoDB的证书文件,应该如何用呢?
1.问题 目前我生成了X509证书: ca-cert.pem: CA 证书, 用于生成服务器端/客户端的数字证书. ca.pem: CA 私钥, 用于生成服务器端/客户端的数字证书. server-key.pem: 服务器端的 RSA 私钥 server-req.pem: 服务器端的证书请求文件, 用于生成服务器端的数字证书. server-cert.pem: 服务器端的数字证书. client-key.pem: 客户端的 RSA 私钥 client-req.pem: 客户端的证书请求文件, 用于生成客户端的数字证书. client-cert.pem: 客户端的数字证书. 生成语句: openssl genrsa 2048 > ca-key.pem openssl req -new -x509 -nodes -days 7200 -key ca-key.pem -out ca.pem openssl req -newkey rsa:2048 -days 7200 -nodes -keyout server-key.pem -out server-req.pem openssl rsa -in server-key.pem -out server-key.pem openssl x509 -req -in server-req.pem -days 7200 -CA ca.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem openssl req -newkey rsa:2048 -days 7200 -nodes -keyout client-key.pem -out client-req.pem openssl rsa -in client-key.pem -out client-key.pem openssl x509 -req -in client-req.pem -days 7200 -CA ca.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem 现在我想把证书加入到mongo.cnf中,但是无论如何加客户端都无法连上服务端 2.描述 我将cat server-key.pem server-cert.pem > server.pem cat client-key.pem client-cert.pem > client.pem mongodb.cnf的配置信息 net: port: 27017 ssl: mode: requireSSL PEMKeyFile: /data/db/mongo_key/server.pem PEMKeyPassword: wanbang123 CAFile: /data/db/mongo_key/client.pem allowConnectionsWithoutCertificates: true allowInvalidHostnames: true allowInvalidCertificates: true 目前java端使用的证书为: keytool -importcert -alias MySQLCACert -file ca.pem -keystore xxx.jks -storepass wanbang123 连接语句: ./bin/mongo --host 127.0.0.1:27018 --ssl --sslPEMKeyFile /data/db/mongo_key/client.pem --sslCAFile /data/db/mongo_key/server.pem --sslAllowInvalidHostnames 3.报错信息 2019-10-14T09:49:19.480+0800 E NETWORK [thread1] SSL peer certificate validation failed: unable to verify the first certificate 2019-10-14T09:49:19.480+0800 E QUERY [thread1] Error: socket exception [CONNECT_ERROR] for SSL peer certificate validation failed: unable to verify the first certificate :connect@src/mongo/shell/mongo.js:231:14 日志信息 2019-10-14T09:51:04.153+0800 I NETWORK [initandlisten] connection accepted from 172.17.0.1:38354 #1 (1 connection now open) 2019-10-14T09:51:04.172+0800 W NETWORK [conn1] SSL peer certificate validation failed: unable to verify the first certificate 2019-10-14T09:51:04.173+0800 I NETWORK [conn1] end connection 172.17.0.1:38354 (0 connections now open)
已安装的Nginx追加自带模块始终报错
* Centos7系统下已安装的nginx需要追加http_limit_req_module模块。按照网上的方法,下载了对应版本的源码, 1. 在配置参数后追加--with-http_limit_req_module,出现以下报错 ``` ./configure: error: invalid option "--with-http_limit_req_module" ``` 2. 使用--add-module=http_limit_req_module报找不到config文件 ``` adding module in http_limit_req_module ./configure: error: no http_limit_req_module/config was found ``` 3. 将模块名改成ngx_http_limit_req_module报的也是类似的错误 # 求大神看看应该怎么添加 下面是完整配置参数,nginx版本是1.17.8,--with-http_limit_req_module前的参数是用nginx -V查出来的 ``` ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' --with-http_limit_req_module ```
第三方应用请求微信授权登入的问题,错误提示是scope参数错误或没有scope权限
final SendAuth.Req req = new SendAuth.Req(); req.scope = "snsapi_userinfo"; req.state = "none"; api.sendReq(req); APPID和AppSecret是从微信官网申请下来的,应该没错。 错误提示是scope参数错误或没有scope权限 请问这是什么问题造成的呢?
django 在if语句中判断之后return render报错
``` def video(request): target = "http://api.pingcc.cn/?" genre_list = ["韩国剧", "海外剧", "欧美剧 ", "国产剧 "] get_url = request.GET.get('ysurl') get_genre = requests.GET.get('genre') url = target + "ysurl=" + get_url req = requests.get(url) jsons = req.json() list = jsons.get('list') connect = { 'message':list, } if get_genre in genre_list: return render(request,'api/series_list.html',connect) else: return render(request,'api/video.html',connect) ``` ![图片说明](https://img-ask.csdn.net/upload/202001/02/1577979869_786550.png)
将一个简单的数据库查询部署到Tomcat时java.lang.NoClassDefFoundError: Could not initialize class
在完成一个数据库查询操作部署到Tomcat时报错java.lang.NoClassDefFoundError: Could not initialize class. 在没有使用服务器时,查询功能可以正常运行. 在启动服务器查询时报错 Servlet代码如下: ``` package com.lxl.web.servlet; import com.lxl.smis.dao.impl.IStudentDAO; import com.lxl.smis.dao.impl.StudentDAOImpl; import com.lxl.smis.domain.Student; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @WebServlet("/student/list") public class ListStudentServlet extends HttpServlet { private IStudentDAO dao; public void init() throws ServletException { dao = new StudentDAOImpl(); } @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //1.接受请求参数,封装对象 //2.调用业务方法处理请求 System.out.println("hello"); List<Student> stus= dao.listAll(); for (Student stu : stus) { System.out.println(stu); } //3.控制界面跳转 } } ``` 错误提示: ![图片说明](https://img-ask.csdn.net/upload/201911/16/1573886138_700745.png) ```16-Nov-2019 15:29:27.029 严重 [http-nio-8080-exec-3] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [com.lxl.web.servlet.ListStudentServlet] in context with path [] threw exception [Servlet execution threw an exception] with root cause java.lang.NoClassDefFoundError: Could not initialize class com.lxl.smis.util.JDBCUtil at com.lxl.smis.util.JDBCTemplate.query(JDBCTemplate.java:73) at com.lxl.smis.dao.impl.StudentDAOImpl.listAll(StudentDAOImpl.java:41) at com.lxl.web.servlet.ListStudentServlet.service(ListStudentServlet.java:28) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) ``` 使用DeBug运行 感觉是这里出现问题,但并不知道到是什么意思 ![图片说明](https://img-ask.csdn.net/upload/201911/16/1573886445_32104.png) 查找网上解决方法 说这个报错的问题原因就是static变量的初始化失败导致 但我如果不用Servlet运行这个查找功能,直接在本地实现这个方法,是可以正常运行的. 请教一下各位大佬,是什么原因? 我是初学JAVA的小白,各位大佬见笑了.
在idea中jsp涉及到页面跳转就404的问题,求大佬支招!!!!
psp代码:<%-- Created by IntelliJ IDEA. User: HASEE Date: 2019/11/24 Time: 22:22 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8"isELIgnored="false" language="java" %> <html> <head> <title>Title</title> </head> <body> ${requestScope.hai} <form action="/Loginservlet" method="post" value="%{param.name}"> username:<input type="next" name="name"><br/> password:<input type="password" name="password"><br/> <input type="submit" name="tijiao"> </form> </body> </html> servlet 代码: package cn.kgc.servlet; import cn.kgc.entity.utils.User; import cn.kgc.service.UserService; import cn.kgc.service.inpl.Userservicepml; import javax.jws.soap.SOAPBinding; 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 Loginservlet extends HttpServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //获取页面输入的用户名和密码 String name = req.getParameter("name"); String password = req.getParameter("password"); //调用service中登录的方法 UserService userService=new Userservicepml(); User user=new User(null,"name","password"); User login = userService.login(user); if (login!=null){ //3.登录成功跳转到succcess.jsp // resp.sendRedirect("/success.jsp"); req.setAttribute("name",name); req.getRequestDispatcher("/success.jsp"); }else { //4登录失败跳转到login.jsp // resp.sendRedirect("/login.jsp"); req.setAttribute("hai","用户名或密码错误"); req.getRequestDispatcher("login.jsp").forward(req,resp); } } } servlet 配置文件(web.xml): <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>Loginservlet</servlet-name> <servlet-class>cn.kgc.servlet.Loginservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Loginservlet</servlet-name> <url-pattern>/Loginservlet</url-pattern> </servlet-mapping> <servlet> <servlet-name>loginout</servlet-name> <servlet-class>cn.kgc.servlet.loginout</servlet-class> </servlet> <servlet-mapping> <servlet-name>loginout</servlet-name> <url-pattern>/loginout</url-pattern> </servlet-mapping> </web-app>
测试报错,Connection refused: connect,求解?
代码: ``` public class ItfTest { /** * @param args */ public static void main(String[] args) { try { String out = testbiz(); System.out.println(out); } catch (IOException e) { e.printStackTrace(); } } public static String testbiz() throws HttpException, IOException { HttpClient httpClient = new HttpClient(); PostMethod post = new PostMethod( "http://localhost:8001/itf/OI_AddSaleByParameter"); // PostMethod post = new PostMethod( "https://rryx.sinovatech.com/itf/OI_QueryEShopOrder"); post.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); String key = "123321abc"; String channel="ch_shenxun"; Map<String, Object> req = new HashMap<>(); String instr ="{\"body\": \"{\\\"startTime\\\":\\\"2019-01-01 14:43:19\\\",\\\"endTime\\\":\\\"2019-01-12 15:14:42\\\",\\\"phone\\\":\\\"18309858042\\\"}\",\"head\": {} }"; /* String instr ="6351"; req.put("loginCode",instr);*/ Map<String, Object> header = new HashMap<>(); header.put("appId", channel); header.put("tid", UUID.randomUUID().toString()); header.put("timestamp", System.currentTimeMillis()); header.put("ver", "1.0"); Map<String, Object> reMap = new HashMap<>(); reMap.put("header", header); reMap.put("req", req); req.put("saleName","123"); req.put("goodIds","ff8080815e562c4d015e6103956700b6"); req.put("orderValue","1"); req.put("createName","管理员"); System.out.println(JSONObject.toJSON(reMap)); String reqdata = JSONObject.toJSONString(reMap); String sign = DigestUtils.md5Hex(reqdata + key); NameValuePair[] param = { new NameValuePair("sign", sign), new NameValuePair("reqdata", reqdata) }; post.setRequestBody(param); int result = httpClient.executeMethod(post); System.out.println("返回结果=" + result); InputStream in = post.getResponseBodyAsStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder sb = new StringBuilder(); String line = reader.readLine(); while (line != null) { sb.append(line); line = reader.readLine(); } reader.close(); return sb.toString(); } } //以上代码传参测试,但是运行后报错 java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:286) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) at com.sinovatech.test.ItfTest.testbiz(ItfTest.java:95) at com.sinovatech.test.ItfTest.main(ItfTest.java:52) 求大神指点 ```
java web的Filter和cookie退出登陆问题求解!
我要做一个退出登陆的功能,因为是两个不同的页面(index和index1),但是用户表用的是同一个,即账号密码名称一样,现在从退出index页面能顺利推到login页面,但是从index1退出会先进入index页面后再次点击退出才退出到login,怎样才可以也让index1直接推到login? 下面是相关代码: ``` //LoginFilter部分 HttpServletRequest req = (HttpServletRequest)request; HttpServletResponse res = (HttpServletResponse)response; String path = req.getContextPath(); String basepath = req.getScheme()+"://"+req.getServerName()+":"+req.getServerPort()+path+"/"; String uri = req.getRequestURI(); if(uri.contains("/LoginServlet")||uri.contains("/RegisterServlet")||uri.contains("/css/")||uri.contains("/iconfont/")||uri.contains("/image/")||uri.contains("/js/")||uri.contains("/layui/")||uri.contains("/CheckCodeServlet")){ chain.doFilter(request, response); }else if(uri.contains("/login.jsp")){ Object user = req.getSession().getAttribute("user"); if(user!=null){ System.out.println("3"); res.sendRedirect(basepath+"jsp\\index.jsp"); //res.sendRedirect(basepath+"jsp\\index1.jsp"); }else{ chain.doFilter(request, response); } }else if(uri.contains("/register.jsp")){ Object user = req.getSession().getAttribute("user"); if(user!=null){ res.sendRedirect(basepath+"jsp\\index.jsp"); }else{ chain.doFilter(request, response); } } else{ Object user = req.getSession().getAttribute("user"); if(user!=null){ chain.doFilter(request, response); }else{ res.sendRedirect(basepath+"login.jsp"); } } //CookieLoginFilter部分 HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; Cookie[] cookies = req.getCookies(); boolean flag = false; boolean flag1 = false; if(cookies!=null){ for(Cookie cookie:cookies){ if("username".equals(cookie.getName())){ flag=true; break; } } } if(flag){ res.sendRedirect("LoginServlet"); }else if(flag1) { res.sendRedirect("RegisterServlet"); }else{ chain.doFilter(request, response); } //LogoutServlet部分 HttpSession session = request.getSession(); /*session.removeAttribute("name");*/ session.invalidate(); Cookie cookieName = new Cookie("username",null); cookieName.setMaxAge(0); cookieName.setPath("/"); Cookie cookiePwd = new Cookie("password",null); cookiePwd.setMaxAge(0); cookiePwd.setPath("/"); Cookie cookieUpower = new Cookie("upower",null); cookieUpower.setMaxAge(0); cookieUpower.setPath("/"); response.addCookie(cookieName); response.addCookie(cookiePwd); response.addCookie(cookieUpower); response.sendRedirect("login.jsp"); //loginoutservlet部分 HttpSession session = request.getSession(); //session.removeAttribute("name"); session.invalidate(); Cookie cookieName = new Cookie("username",null); cookieName.setMaxAge(0); cookieName.setPath("/"); Cookie cookiePwd = new Cookie("password",null); cookiePwd.setMaxAge(0); cookiePwd.setPath("/"); Cookie cookieUpower = new Cookie("upower",null); cookieUpower.setMaxAge(0); cookieUpower.setPath("/"); response.addCookie(cookieName); response.addCookie(cookiePwd); response.addCookie(cookieUpower); response.sendRedirect("login.jsp"); //index1的jsp部分 <header class="layout-header"> <span class="header-logo">图书馆系统</span> <div class="dl-log">欢迎您,<span class="dl-log-user">${user.username}</span><a href="../login.jsp" title="退出系统" class="dl-log-quit">[退出]</a> <a class="header-menu-btn" href="javascript:;"><i class="icon-font">&#xe600;</i></a> </div> </header> ```
int类型转换成User对象类型报错问题 User u=(User) req.getSession().getAttribute("servlet");
``` private void UserUpdate(HttpServletRequest req, HttpServletResponse resp) throws IOException { String pwd=req.getParameter("pwd"); //下面的User的转换报错 User u=(User) req.getSession().getAttribute("servlet"); int uid=u.getUid(); int index=us.Update(pwd,uid); System.out.println("index="+index); if(index>0){ HttpSession hs=req.getSession(); hs.setAttribute("pwd","true"); resp.sendRedirect("/Login.jsp"); } ``` ``` Servlet.service() for servlet [servlet] in context with path [/New] threw exception java.lang.ClassCastException: java.lang.Integer cannot be cast to com.cwj.pojo.User at com.cwj.servlet.UserServlet.UserUpdate(UserServlet.java:88) at com.cwj.servlet.UserServlet.service(UserServlet.java:41) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:319) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) ```
webservlet在doGet中 不执行 req.getRequestDispatcher(USER_VIEW).forward(req,resp),一直在doget里面循环
``` @WebServlet( urlPatterns = {"/user/*"}, initParams = { @WebInitParam(name = "USER_VIEW",value = "user.jsp") } ) public class User extends HttpServlet { private String USER_VIEW; public void init(){ USER_VIEW = getServletConfig().getInitParameter("USER_VIEW"); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { UserService userService = (UserService) getServletContext().getAttribute("userService"); String usrname = req.getPathInfo().substring(1); if(userService.isUerExisted(usrname)){ Blah blah = new Blah(); blah.setUsername(usrname); List<Blah> blahs = userService.getBlahs(blah); req.setAttribute("blahs",blahs); } req.setAttribute("username",usrname); req.getRequestDispatcher(USER_VIEW).forward(req,resp); } ``` USER_VIEW 是 user.jsp 页面. 在浏览器请求:http://localhost:8080/wbojsp/user/liming 请求大神支援!
GetResponse时,出现异常:以一种访问权限不允许的方式 做了一个访问套接字的尝试。
公司使用了代理,要访问外部网站,必须要通过代理访问。 代码如下: // 设置一些公用的请求头 NameValueCollection collection = new NameValueCollection(); collection.Add("Accept-Encoding", "gzip,deflate,sdch"); collection.Add("Accept-Language", "zh-CN,zh;q=0.8"); req = (HttpWebRequest)WebRequest.Create(url); req.KeepAlive = true; req.Method = method.ToUpper(); req.AllowAutoRedirect = true; req.CookieContainer = Cookies; req.ContentType = ContentType; req.UserAgent = UserAgent; req.Accept = AcceptType; req.Timeout = TimeOut; req.Referer = refer; req.Headers.Add(collection); WebProxy wp = new WebProxy("openproxy.com:8080",true); wp.Credentials = new NetworkCredential("username","pwd","area"); req.Proxy = wp; 操作的结果是: 会报异常,提示: System.Net.WebException:无法连接到远程服务器----> System.Net.Sockets.SocketException:以一种访问权限不允许的方式做了一个访问套接字的尝试。192.16.133.23:8080 在System.Net.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)。。。 我做了以下尝试: 1、把访问了代理的端口改成80,如果使用默认的代理,提示要验证信息;如果使用代码中的代理,获得的是代理服务器的访问错误页面提示。(这是正确结果)。 2、telnet了代理服务器的8080端口,成功。 由上面两个尝试可以知道,我的代理的验证信息是对的,本地的端口也没有冲突,同时代理服务器的8080端口也是开放的。 但是就是不知道为什么,把80端口改成8080端口,就会报异常,百思不得其解。 从网上搜到的信息中看,可能的原因是端口冲突和没有应用程序权限不够。端口冲突是不可能的,应该本地访问的端口不是固定的;也用管理打开过,还是这个问题。 我想跟踪一下汇编代码, 但是进入到Response里面,调用了一个call就返回了,进不去。 不知道哪个大神知道是什么情况,或者是有没有什么定位手段或处理思路。
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
MyBatis研习录(01)——MyBatis概述与入门
MyBatis 是一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射。MyBatis原本是apache的一个开源项目iBatis, 2010年该项目由apache software foundation 迁移到了google code并改名为MyBatis 。2013年11月MyBatis又迁移到Github。
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
Python爬虫精简步骤1 获取数据
爬虫,从本质上来说,就是利用程序在网上拿到对我们有价值的数据。 爬虫能做很多事,能做商业分析,也能做生活助手,比如:分析北京近两年二手房成交均价是多少?广州的Python工程师平均薪资是多少?北京哪家餐厅粤菜最好吃?等等。 这是个人利用爬虫所做到的事情,而公司,同样可以利用爬虫来实现巨大的商业价值。比如你所熟悉的搜索引擎——百度和谷歌,它们的核心技术之一也是爬虫,而且是超级爬虫。 从搜索巨头到人工...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
web前端javascript+jquery知识点总结
1.Javascript 语法.用途 javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
渗透测试-灰鸽子远控木马
木马概述 灰鸽子( Huigezi),原本该软件适用于公司和家庭管理,其功能十分强大,不但能监视摄像头、键盘记录、监控桌面、文件操作等。还提供了黑客专用功能,如:伪装系统图标、随意更换启动项名称和表述、随意更换端口、运行后自删除、毫无提示安装等,并采用反弹链接这种缺陷设计,使得使用者拥有最高权限,一经破解即无法控制。最终导致被黑客恶意使用。原作者的灰鸽子被定义为是一款集多种控制方式于一体的木马程序...
Python:爬取疫情每日数据
前言 目前每天各大平台,如腾讯、今日头条都会更新疫情每日数据,他们的数据源都是一样的,主要都是通过各地的卫健委官网通报。 以全国、湖北和上海为例,分别为以下三个网站: 国家卫健委官网:http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml 湖北卫健委官网:http://wjw.hubei.gov.cn/bmdt/ztzl/fkxxgzbdgrfyyq/xxfb...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允许使用这...
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧???? 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升自...
粒子群算法求解物流配送路线问题(python)
1.Matlab实现粒子群算法的程序代码:https://www.cnblogs.com/kexinxin/p/9858664.html matlab代码求解函数最优值:https://blog.csdn.net/zyqblog/article/details/80829043 讲解通俗易懂,有数学实例的博文:https://blog.csdn.net/daaikuaichuan/article/...
教你如何编写第一个简单的爬虫
很多人知道爬虫,也很想利用爬虫去爬取自己想要的数据,那么爬虫到底怎么用呢?今天就教大家编写一个简单的爬虫。 下面以爬取笔者的个人博客网站为例获取第一篇文章的标题名称,教大家学会一个简单的爬虫。 第一步:获取页面 #!/usr/bin/python # coding: utf-8 import requests #引入包requests link = "http://www.santostang....
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
相关热词 c#导入fbx c#中屏蔽键盘某个键 c#正态概率密度 c#和数据库登陆界面设计 c# 高斯消去法 c# codedom c#读取cad文件文本 c# 控制全局鼠标移动 c# temp 目录 bytes初始化 c#
立即提问