求救:有人用java做过大华摄像头web端的二次开发吗

找了很多大华摄像头二次开发的例子,但是都没什么用。我就想在web页面上实时显示大华摄像头的监控视频,希望能够不用安装插件什么的,最好能适配各种浏览器。有做过的大佬能否分享一下!!!

1个回答

以前对接过大华的视频,记得是分页播放视频。大华的采用OCX控件,并且指定浏览器为google,还有版本限制。你在做这个项目还是好好和人家对接,不是在这里询问。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
求救:java调用大华摄像头问题

网上找了一些用java二次开发大华摄像头的例子,但在64位机器上不能运行,32位机器可以运行,问题出在Native加载dll文件导致的(Native.loadLibrary("dhnetsdk.dll"),但不知道怎么解决?

Java语言问题在线求救:Java语言的Integer和int是不是一回事?为什么要有两种,是不是造成了重复?

Java语言问题在线求救:Java语言的Integer和int是不是一回事?为什么要有两种,是不是造成了重复?

JAVA小白求救:坦克大战-多关卡咋做?没思路。。。

坦克大战-多关卡咋做: 自己代码如下: //坦克大战:-换关卡,-IO声音流,把爆炸换成外面的图片,有BUG继续游戏的时候看不到爆炸一下才能看到地方坦克, import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; import java.io.*; public class Tank1 extends JFrame implements ActionListener{ MyPanel mp=null; StartPanel gkmp=null; //Record record=null; JMenuBar cd=null;//??不熟 JMenu cd1=null;//??不熟 JMenu cd2=null; JMenuItem cd1xl1=null;//菜单栏1系列的1 JMenuItem cd1xl2=null;//菜单栏1系列的2 JMenuItem cd1xl3=null;//菜单栏1系列的1 JMenuItem cd1xl4=null;//菜单栏1系列的2 JMenuItem cd2xl1=null;//菜单栏2系列的1 JLabel imageJLabel=null; String newGame="newGame";//? //Image tp1=null; public static void main(String[] args) { Tank1 t1=new Tank1(); } public Tank1(){ gkmp=new StartPanel(); mp=new MyPanel(newGame);//?? Record record=new Record();//创建一个记录对象 Thread t=new Thread(gkmp); t.start(); cd=new JMenuBar();//菜单栏 不熟 cd1=new JMenu("游戏(G)");//第一个菜单栏的第一个菜单 cd1.setMnemonic('G');//快界键 cd2=new JMenu("设置(Z)"); cd2.setMnemonic('Z'); cd1xl1=new JMenuItem("开始新游戏(N)");//菜单系列 cdxl cd1xl1.setMnemonic('N'); cd1xl1.addActionListener(this);//加组件监听 cd1xl1.setActionCommand("newGame");//设置键值,和上文同名参数有啥关系没? cd1.add(cd1xl1); cd1xl2=new JMenuItem("继续游戏(H)");//菜单系列 cdxl cd1xl2.setMnemonic('H'); cd1xl2.addActionListener(this);//加组件监听 cd1xl2.setActionCommand("goonGame");//设置键值 cd1.add(cd1xl2); cd1xl3=new JMenuItem("保存退出(S)");//菜单系列 cdxl cd1xl3.setMnemonic('S'); cd1xl3.addActionListener(this);//加组件监听 cd1xl3.setActionCommand("saveOut");//设置键值 cd1.add(cd1xl3); cd1xl4=new JMenuItem("退出(Q)"); cd1xl4.setMnemonic('Q'); cd1xl4.addActionListener(this);//加组件监听 cd1xl4.setActionCommand("exit");//设置键值 cd1.add(cd1xl4); cd.add(cd1);//给菜单栏 cd 添加菜单 cd1 cd2xl1=new JMenuItem("速度(F)");//菜单系列 cdxl 没做好效果? cd1xl4.setMnemonic('F'); cd1xl4.addActionListener(this);//加组件监听 cd1xl4.setActionCommand("FSpeed");//设置键值 cd2.add(cd2xl1); cd.add(cd2); ImageIcon img = new ImageIcon("E:/Tank1/tankebig.PNG"); JLabel imageJLabel = new JLabel(img); gkmp.add(imageJLabel); this.add(gkmp); this.setJMenuBar(cd); this.setTitle("坦克大战"); ImageIcon tp1=new ImageIcon("E:/Tank1/tankexiao.PNG");//设置小图标地址要写全路径 this.setIconImage(tp1.getImage()); this.setSize(700,620); this.setLocation(300,80); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true);//可见 this.setResizable(false);//可调 // this.setResizable(true); } public void actionPerformed(ActionEvent e){ //boolean flag=true; if(e.getActionCommand().equals("newGame")) { this.remove(gkmp);//取消界面 gkmp if(mp.flag==false)//因为在主类构造函数开始就创建了mp,所以可以引用flag变量 { this.remove(mp); mp=new MyPanel("newGame"); } this.add(mp); this.addKeyListener(mp); Thread t=new Thread(mp);//启动我的MyPanel模板对象mp的线程 t.start();//叫醒线程 this.setVisible(true);//因为默认的是不可见,必须写这个!! Record.bcjl();//???? }else if(e.getActionCommand().equals("saveOut")) { Record record0=new Record(); // record0.setDtk(mp.dtk); record0.cunpan();///?????? System.exit(0);//游戏退出 }else if(e.getActionCommand().equals("exit")) { Record.bcjl(); System.exit(0);//游戏退出 }else if(e.getActionCommand().equals("goonGame")){ this.remove(gkmp); if(mp.flag==false)//因为在主类构造函数开始就创建了mp,所以可以引用flag变量 { this.remove(mp); mp=new MyPanel("goonGame"); } Thread t=new Thread(mp); t.start(); this.add(mp); this.addKeyListener(mp); this.setVisible(true); } } class StartPanel extends JPanel implements Runnable //开始界面类 { int time=0; public void paint(Graphics g){ super.paint(g); // g.fillRect(0, 0, 600, 500);//设置画布 g.setColor(Color.black);//设置颜色 Color mycolor1=new Color(250,50,0);//自定义红色 g.setFont(new Font("华文琥珀",Font.BOLD,80));//设置字体//? g.drawString("坦克大战",190 , 460);//绘字符串 g.setColor(Color.black);//设置颜色 g.setFont(new Font("黑体",1,14));//设置字体 g.drawString("李晋祥",648 , 552);//绘字符串 if(time%2==0) { g.setColor(Color.white);//设置颜色 g.setFont(new Font("华文行楷",3,35));//字体:华康楷体, Ravie, OCR A Extended g.drawString("准备战斗",270 , 345);//绘字符串 } } StartPanel(){ } public void run(){ while(true){ try{ Thread.sleep(400); }catch(Exception e){} time++; this.repaint(); } } } class MyPanel extends JPanel implements KeyListener,Runnable { //Vector<MyTank> mts=new Vector<MyTank>();//建立一个我的坦克集合类可以出无限个坦克 MyTank mt=null; MyTank mt0=null; MyTank mt01=null; MyTank mt02=null; Vector<DiTank> dtk=new Vector<DiTank>();//建立一个敌坦克集合类 Props props=null; Vector<Baozha> bzjh=new Vector<Baozha>();//创建一个爆炸类的集合 Vector<Weizhi> wzjh=new Vector<Weizhi>();//建立一个位置集合类,为啥建立这集合类 int tksl=3;//坦克数量 int a=122; int b=455; int n=10; int myzdNum=4;//? int propsSort=5; int time=0; boolean flag=true;//标记是不是已经创建过MyPanel类 boolean b1=false; int x=1;//总关卡数? int rocket=1;//没用? int huopao=0;//? Color mycolor1=new Color(250,50,0);//自定义红色 Color mycolor2=new Color(0,250,50);//自定义绿色 Color mycolor3=new Color(0,50,250);//自定义兰色 Color mycolor11=new Color(130,200,0);//自定义土黄 Color mycolor31=new Color(0,100,200);//自定义兰色 Color mycolor21=new Color(0,250,0);//自定义绿色 JLabel imageJLabel0=null; JLabel imageJLabel1=null; ImageIcon img0=null;//? ImageIcon img1=null;//? public MyPanel(String ss) { ImageIcon img0 = new ImageIcon("e:/Tank1/background.jpg"); JLabel imageJLabel0 = new JLabel(img0); this.add(imageJLabel0); Record.dqjl();//? mt=new MyTank(600,280);//new多个可改为多个坦克,循环数组 mt0=new MyTank(550,280);//new多个可改为多个坦克,循环数组 mt01=new MyTank(550,330);//new多个可改为多个坦克,循环数组 mt02=new MyTank(600,330);//new多个可改为多个坦克,循环数组 props=new Props(30,30);//没有实际意义,为了new对象,必须要有个参数? if(ss.equals("newGame")){ // record=new Record(); for(int i=0;i<tksl;i++){ DiTank dt=new DiTank((i)*a,b);//添加出场敌坦 // dt.dtkxl(dtk);///???是不是敌人坦克血量 dt.setFangxiang(1);//给一个初始值,调drawTank()赋初值要用 Thread t2=new Thread(dt); t2.start(); Zidan zd=new Zidan(dt.x,dt.y,1);//?这是干啥加子弹元素吗? Thread t3=new Thread(zd);//? t3.start(); dtk.add(dt); } }else if(ss.equals("goongame")){//继续游戏有问题 感觉读取存盘信息有问题 wzjh=Record.dupan(); for(int i=0;i<wzjh.size();i++){ Weizhi wz=wzjh.get(i); DiTank dt=new DiTank(wz.x,wz.y);//添加出场敌坦 dt.setFangxiang(wz.fangxiang); // dt.dtkxl(dtk);//?敌坦克血量,好像暂时用不着 // dt.setFangxiang(1);//给一个初始值,调drawTank()赋初值要用 Thread t2=new Thread(dt); t2.start(); Zidan zd=new Zidan(dt.x,dt.y,1);//?这是干啥加子弹元素吗? Thread t3=new Thread(zd);//? t3.start(); dtk.add(dt); } } flag=false;//MyPanel类的mp创建过一次就标记为假 // this.repaint(); // Record.next(); // if(Record.next()%2!=0){ // Record.reMtNum();//需要吗? // Record.reDtNum();//需要吗? // Record.reAddMtNum(); // } } public void outNum(Graphics g)//画出统计数据的方法也即使显示数量的函数 { g.setColor(Color.cyan); this.drawTank(500,150,g,0,0);//引用drawtank()的不能是g,而是this this.drawTank(570,150,g,0,1); this.drawTank(500,70,g,0,1); g.setColor(Color.black); g.setFont(new Font("仿宋",2,20));//??换换字体效果 g.drawString(Record.getDtNum()+"",600,170); if((Record.getMtNum()+Record.getAddMtNum())>=0){ g.drawString((Record.getMtNum()+Record.getAddMtNum())+"",530,170);// }else{ g.drawString((Record.getAddMtNum())+"",530,170); } g.setColor(Color.blue); g.setFont(new Font("方正小标宋",1,17)); g.drawString("干掉的坦克总数:",510,40); g.setColor(Color.black); g.setFont(new Font("仿宋",2,20)); g.drawString(Record.getSumDtNum()+"",530,90); g.setColor(Color.MAGENTA);//设置颜色 g.setFont(new Font("隶书",0,20));//设置字体 g.drawString("第"+x+"关",500 , 200);//绘字符串 } public void paint(Graphics g){//这个方法每当窗口激活,最小化,调用repaint()方法都会运行,线程中调用就一直显示 super.paint(g); // g.fillRect(0,0,400,300);//做个背景画布,默认黑色 this.outNum(g);//调用显示数量的函数 g.setColor(Color.red);//设置颜色 g.fillRect(530, 210, 30, 20); g.setColor(Color.black);//设置颜色 g.drawLine(530, 210, 530, 320); g.setColor(mycolor11);//设置颜色 if(mt.live==true){ this.drawTank(mt.getX(),mt.getY(),g,mt.fangxiang,0); } if(mt0.live==true){ this.drawTank(mt0.getX(),mt0.getY(),g,mt0.fangxiang,2); } if(mt01.live==true){ this.drawTank(mt01.getX(),mt01.getY(),g,mt01.fangxiang,2); } if(mt02.live==true){ this.drawTank(mt02.getX(),mt02.getY(),g,mt02.fangxiang,2); } if(mt.getLive()==false){ g.setColor(mycolor11);//设置颜色 g.setFont(new Font("Gill Sans Ultra Bold Condensed",1,40));//字体:华康楷体, Ravie, OCR A Extended g.drawString("game over...",200 , 220);//绘字符串 this.repaint(); } if(Record.getDtNum()%6==0&&(Record.getDtNum()>10)){ // if(time%2==0) // { g.setColor(Color.blue);//设置颜色 g.setFont(new Font("华文行楷",1,35));//字体:华康楷体, Ravie, OCR A Extended g.drawString("你行不行?",310 , 265);//绘字符串 // } } if(Record.getDtNum()==0){ g.setColor(Color.red);//设置颜色 g.setFont(new Font("华文行楷",1,35));//字体:华康楷体, Ravie, OCR A Extended g.drawString("过关!",300 , 265);//绘字符串 } for(int i=0;i<dtk.size();i++)//画敌人坦克asd { DiTank dt=dtk.get(i); if(dt.live==true){ this.drawTank(dt.getX(),dt.getY(),g,dt.fangxiang,1);//??!!注意用法用dtk 还是dt调用 } } for(int i=0;i<mt.aa.size();i++)//画我的子弹 { Zidan zd=mt.aa.get(i); if(mt.zd!=null&&mt.zd.live==true) //???画子弹的条件 { //g.fill3DRect((mt.zd.x-2),(mt.zd.y-2), 8, 8, false); //???画子弹火力圈 g.setColor(Color.black);//子弹颜色设置为白色 g.fillOval(zd.x+1,zd.y+1, 4,4); } if(zd.live==false) { mt.aa.remove(zd); } } //this.repaint();//? for(int i=0;i<dtk.size();i++)//画敌人的子弹 { DiTank dt=dtk.get(i); for(int j=0;j<dt.dzd.size();j++) { Zidan zd=dt.dzd.get(j); if(zd!=null&&dtk.get(i).live==true) { g.setColor(Color.red);//子弹颜色设置为红色,次处不进循环是不是更好? g.fillOval(zd.x+1,zd.y+1, 4,4); } if(zd.live==false)//删除生命为假的敌人子弹???? { dt.dzd.remove(zd); } } } for(int i=0;i<bzjh.size();i++) //画爆炸 { Baozha bz=bzjh.get(i); if(bzjh.get(i).livetime>140){ g.setColor(Color.red); g.fillOval(bz.x, bz.y+5, 20,20 );//代替上面的句子 //g.fillOval(bz.x, bz.y, 20,5 );//可以用来做合成图形,但是要定好坐标点 }else if((bzjh.get(i).livetime<=100)&&(bzjh.get(i).livetime>50)){ g.setColor(Color.orange); g.fillOval(bz.x+4, bz.y+9, 12,12 ); }else if((bzjh.get(i).livetime<=50)&&(bzjh.get(i).livetime>20)){ g.setColor(Color.yellow); g.fillOval(bz.x+7, bz.y+11,5,5 ); }else{ g.setColor(Color.pink); g.fillOval(bz.x+10, bz.y+13,2,2 ); } bz.ltjs(); //生存时间减少函数 if(bz.livetime==0){ bzjh.remove(bz); } } // if(props.live==true){//画道具 this.drawProps(props.getX(),props.getY(),g,props.getleixing()); } //} this.repaint();//教学视频少了这句,子弹无法自主运行,主类启动线程后仍然可动 } public void keyPressed(KeyEvent e)//键盘输入事件 { if(mt.getLive()==true){ if(e.getKeyCode()==KeyEvent.VK_W){ this.mt.setFangxiang(0); this.mt.xiangshang(); }else if(e.getKeyCode()==KeyEvent.VK_S){ this.mt.setFangxiang(1); this.mt.xiangxia(); }else if(e.getKeyCode()==KeyEvent.VK_A){ this.mt.setFangxiang(2); this.mt.xiangzuo(); }else if(e.getKeyCode()==KeyEvent.VK_D){ this.mt.setFangxiang(3); this.mt.xiangyou(); } if(e.getKeyCode()==KeyEvent.VK_J) { if((mt.aa.size()<myzdNum)&&(mt.live==true))//子弹设置最多 myzdNum 发 { this.mt.fszd();//调用发射子弹函数 } } } } public void crash(){ } public boolean addprops(Props props,MyTank mt)//吃道具触发 方法 (道具功能触发模型为边长20的正方形) { boolean b2=false; switch(props.leixing){ case 0://我的坦克速度提高//mt.fangxiang 0\1\2\3 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; mt.sudu=20; b2=true; } break; case 1://效果回到出生地 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; mt.setX(630); mt.setY(280); b2=true; } break; case 2://提高我可以发射的子弹数目 //mt.fangxiang 0\1\2\3 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; this.myzdNum=30; this.huopao=1; this.n=4; b2=true; } break; case 3://显示的敌人坦克全死,但实际效果是..是不出敌方坦克了!!!! if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; for(int i=0;i<dtk.size();i++){ if(dtk.get(i).live==true){ dtk.get(i).live=false; Record.setDtNum();//有几个活坦克生命变假,就累计几辆dtNum } } b1=true; b2=true; } break; case 4://吃道具加命 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; Record.setAddMtNum(); b2=true; // System.out.println("吃道具加命程序,正常运行"); } break; } return b2; } // addMyTank++; //MyTank mt1=new MyTank(mt.getX(),mt.getY());//??创建另一个MyTank对象 // public void setAddMytank(){ // addMyTank++; // }; // public static int getAddMytank(){ // return addMyTank; // }; public void run() //我的画板的 线程函数 { while(true){ try{ Thread.sleep(50);// }catch(Exception e){} for(int i=0;i<mt.aa.size();i++)//我的子弹集中敌坦克的线程 { Zidan myzd=mt.aa.get(i); if(myzd.live){ for(int j=0;j<dtk.size();j++){ DiTank dt=dtk.get(j); // Zidan zd=dt.dzd.get(j);//为啥dzd可以直接用,不用创建// ||(b1==true&&Record.getDtNum()>0) if(dt.live)//内关联敌人坦克重生的一种情况,有敌人坦克被打中 { if(this.jzsf(myzd,dt)&&((Record.getDtNum()-tksl)>=0)){//调用jzsf(),打中同时,坦克定点?及时重生 DiTank dt0=new DiTank((int)(Math.random()*50+5)*10,(int)(Math.random()*100+450)); Thread t2=new Thread(dt0); t2.start(); Zidan zd0=new Zidan(dt0.x,dt0.y,dt0.fangxiang); Thread t3=new Thread(zd0); t3.start(); dt0.dzd.add(zd0); dtk.add(dt0); } } } } } if(Record.getDtNum()>=tksl&&b1==true){ //炸弹爆炸,敌坦克按条件重生, for(int i=0;i<tksl;i++){ DiTank dt1=new DiTank((int)(Math.random()*20)*10,(int)(Math.random()*100+450)); Thread t6=new Thread(dt1); t6.start(); Zidan zd1=new Zidan(dt1.x,dt1.y,dt1.fangxiang); Thread t7=new Thread(zd1); t7.start(); dt1.dzd.add(zd1); dtk.add(dt1); } b1=false; } if((Record.getDtNum()==(tksl-1))&&(b1==true)){ for(int i=0;i<tksl-1;i++){ DiTank dt1=new DiTank((int)(Math.random()*20)*10,(int)(Math.random()*100+450)); Thread t6=new Thread(dt1); t6.start(); Zidan zd1=new Zidan(dt1.x,dt1.y,dt1.fangxiang); Thread t7=new Thread(zd1); t7.start(); dt1.dzd.add(zd1); dtk.add(dt1); } b1=false; } if((Record.getDtNum()==(tksl-2))&&(b1==true)){ // for(int i=0;i<tksl-1;i++){ DiTank dt1=new DiTank((int)(Math.random()*20)*10,(int)(Math.random()*100+450)); Thread t6=new Thread(dt1); t6.start(); Zidan zd1=new Zidan(dt1.x,dt1.y,dt1.fangxiang); Thread t7=new Thread(zd1); t7.start(); dt1.dzd.add(zd1); dtk.add(dt1); b1=false; } for(int j=0;j<dtk.size();j++)//敌人的子弹击中我的坦克的线程 { DiTank dt=dtk.get(j);//取出所有敌方坦克 for(int i=0;i<dt.dzd.size();i++) { Zidan zd=dt.dzd.get(i);//? if(zd.live) { if(this.jzsf(zd,mt)==true){//调用 击中敌坦 函数 } } } } if((this.time%120)==0){//6秒发生1次 道具随机重置//draw mt hit props props.live=true; // props.leixing=2; props.leixing=(int)(Math.random()*propsSort); props.x=(int)(Math.random()*370); props.y=(int)(Math.random()*270); props.livetime=100;//道具生存期 } if(props.livetime>0){//道具生存期变化 props.livetime--; }else{ props.live=false; } if(mt.live==true&&props.live==true){//调用 吃道具 方法 this.addprops(props,mt); } time++; // if(SaveData.getSumDtNum()%20==0){ // Record.next(); // } this.repaint();//线程运行中重绘?? } } public void jzwf()//敌人子弹集中我方坦克的方法 { for(int i=0;i<this.dtk.size();i++){ DiTank dt=dtk.get(i); for(int j=0;j<dt.dzd.size();j++){ Zidan zd=dt.dzd.get(j); this.jzsf(zd, mt); } } } public void jzdf() //我的子弹击中坦克的方法 { for(int i=0;i<mt.aa.size();i++){ Zidan zd=mt.aa.get(i);//从我的子弹集合类取我的各个子弹 if(zd.live==true){ for(int j=0;j<dtk.size();j++){ DiTank dt=dtk.get(j);//从敌坦克集合类取出各个敌坦克 if(dt.live){ this.jzsf(zd,dt); // levelDtNum--; } } } this.repaint(); } } public boolean jzsf(Zidan zd,Tank tk)//击中双方的方法 { boolean b2=false; switch(tk.fangxiang) { case 0: case 1: if(zd.x>tk.x&&zd.x<tk.x+20&&zd.y>tk.y&&zd.y<tk.y+30)//分辨率判断? { if(tk instanceof DiTank){//只改这就实现 判断tk是不是DiTank的实例 Record.setDtNum(); Record.setSumDtNum(); // Record.setAddMtNum(); tk.live=false; b2=true; }else{ // System.out.println("Record.getMtNum()="+Record.getMtNum()); Record.setMtNum();//Record.getSumMtNum()一直小于0 ?bug if(Record.getMtNum()+1<=0){ Record.lowAddMtNum(); } // System.out.println("Record.getMtNum()="+Record.getMtNum()); // System.out.println("Record.AddMtNum()="+Record.getAddMtNum()); if(Record.getMtNum()+Record.getAddMtNum()>0){//bug 被打一下就游戏结束 已经解决 mt.setX(140); mt.setY(232); } if(Record.getMtNum()+Record.getAddMtNum()<=0){ tk.live=false; } } zd.live=false; Baozha bz=new Baozha(tk.x,tk.y); bzjh.add(bz); } break; case 2: case 3: if(zd.x>tk.x&&zd.x<tk.x+30&&zd.y>tk.y&&zd.y<tk.y+20){ if(tk instanceof DiTank){//只改这就实现 判断tk是不是DiTank的实例 Record.setDtNum();//每次敌人坦克数量-1 Record.setSumDtNum(); // Record.setAddMtNum(); tk.live=false; b2=true; }else{ // System.out.println("Record.getMtNum()="+Record.getMtNum()); Record.setMtNum();//Record.getSumMtNum()一直小于0 ?bug if(Record.getMtNum()+1<=0){ Record.lowAddMtNum(); } // System.out.println("Record.getMtNum()="+Record.getMtNum()); // System.out.println("Record.AddMtNum()="+Record.getAddMtNum()); if(Record.getMtNum()+Record.getAddMtNum()>0){//bug 被打一下就游戏结束 已经解决 mt.setX(550); mt.setY(270); } if(Record.getMtNum()+Record.getAddMtNum()<=0){ tk.live=false; } } zd.live=false; Baozha bz=new Baozha(tk.x,tk.y); bzjh.add(bz); } break; } return b2; } public void keyTyped(KeyEvent e){} public void keyReleased(KeyEvent e){} public void drawTank(int x,int y,Graphics g,int fangxiang,int leixing)//画坦克函数 { int m=10; //double n=1; switch(leixing)//不同阵营坦克 { case 0://我的坦克 g.setColor(Color.yellow);// 我的坦克颜色 黄色 // g.fillOval(170*huopao, 240*huopao, 30*huopao, 30*huopao); m=11; break; case 1://敌人的坦克 g.setColor(mycolor3);//敌人坦克颜色 蓝色 // m=15; break; case 2://玩家2的坦克 g.setColor(mycolor1);//敌人坦克颜色 绿色 break; } switch(fangxiang)//不同方向的坦克(0,1,2,3)分别代表上下左右,中心原点不变做坐标变换 { case 0://上 g.fill3DRect(x,y,5,30,true); g.fill3DRect(x+15,y,5,30,true); g.fill3DRect(x+5,y+5,10,20,true); g.drawLine(x+10,y-5,x+10,(y+10)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; case 1://下 g.fill3DRect(x,y,5,30,true); g.fill3DRect(x+15,y,5,30,true); g.fill3DRect(x+5,y+5,10,20,true); g.drawLine(x+10,y+10,x+10,(y+35)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; case 2://左 g.fill3DRect(x-5,y+5,30,5,true); g.fill3DRect(x-5,y+20,30,5,true); g.fill3DRect(x,y+10,20,10,true); g.drawLine((x-10)+n-m,y+15,(x+10),(y+15)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; case 3://右 g.fill3DRect(x-5,y+5,30,5,true); g.fill3DRect(x-5,y+20,30,5,true); g.fill3DRect(x,y+10,20,10,true); g.drawLine((x+10)-n+m,y+15,(x+30),(y+15)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; } } public void drawProps(int x,int y,Graphics g,int leixing)//画道具 { if(time%8==0){ switch(leixing) { case 0://画车轮对应坦克加速 g.setColor(Color.white); g.fillOval(x, y, 21, 21); g.setColor(Color.black); g.fillOval(x+2,y+2,16,16); g.setColor(Color.white); g.drawOval(x+2,y+2,16,16); g.drawLine(x+2,y+10,x+18,y+10); g.drawLine(x+10,y+2,x+10,y+18); g.drawLine(x+16,y+4,x+4,y+16); g.drawLine(x+4,y+4,x+16,y+16); break; case 1://画回出生地道具图标 g.setColor(Color.white); g.drawRoundRect(x, y, 20, 20, 5, 5); g.setColor(mycolor3); g.fillRoundRect(x+5, y+5, 10, 10, 5, 5); break; case 2://画增加子弹数目道具//? g.setColor(mycolor2); g.fill3DRect(x-15,y+8,30,5,false); g.fill3DRect(x-15,y+6,10,10,true); g.fillOval(x+15,y+7,7,7); break; case 3://画炸弹 g.setColor(mycolor2); g.fillRect(x, y, 21, 21); g.setColor(Color.black); g.fillRect(x+8,y+6,6,2); g.fillOval(x+3,y+7,14,14); g.drawLine(x+11, y+3, x+11, y+6); g.setColor(Color.white); g.drawLine(x+11, y+15, x+8, y+14); break; case 4://画小坦克道具 g.setColor(Color.yellow); g.fill3DRect(x,y,20,3,true); g.fill3DRect(x,y+10,20,3,true); g.fill3DRect(x+3,y+3,14,7,false); g.fillOval(x+6,y+3,7,7); g.drawLine(x-7,y+6,x+7,y+6); break; } } } } } //坦克大战: 不会做多关卡??!! //IO声音流没做,IO流存储也有点问题,有BUG继续游戏的时候看不到爆炸一下才能看到地方坦克, import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; import java.io.*; public class Tank1 extends JFrame implements ActionListener{ MyPanel mp=null; StartPanel gkmp=null; //Record record=null; JMenuBar cd=null;//??不熟 JMenu cd1=null;//??不熟 JMenu cd2=null; JMenuItem cd1xl1=null;//菜单栏1系列的1 JMenuItem cd1xl2=null;//菜单栏1系列的2 JMenuItem cd1xl3=null;//菜单栏1系列的1 JMenuItem cd1xl4=null;//菜单栏1系列的2 JMenuItem cd2xl1=null;//菜单栏2系列的1 JLabel imageJLabel=null; String newGame="newGame";//? //Image tp1=null; public static void main(String[] args) { Tank1 t1=new Tank1(); } public Tank1(){ gkmp=new StartPanel(); mp=new MyPanel(newGame);//?? Record record=new Record();//创建一个记录对象 Thread t=new Thread(gkmp); t.start(); cd=new JMenuBar();//菜单栏 不熟 cd1=new JMenu("游戏(G)");//第一个菜单栏的第一个菜单 cd1.setMnemonic('G');//快界键 cd2=new JMenu("设置(Z)"); cd2.setMnemonic('Z'); cd1xl1=new JMenuItem("开始新游戏(N)");//菜单系列 cdxl cd1xl1.setMnemonic('N'); cd1xl1.addActionListener(this);//加组件监听 cd1xl1.setActionCommand("newGame");//设置键值,和上文同名参数有啥关系没? cd1.add(cd1xl1); cd1xl2=new JMenuItem("继续游戏(H)");//菜单系列 cdxl cd1xl2.setMnemonic('H'); cd1xl2.addActionListener(this);//加组件监听 cd1xl2.setActionCommand("goonGame");//设置键值 cd1.add(cd1xl2); cd1xl3=new JMenuItem("保存退出(S)");//菜单系列 cdxl cd1xl3.setMnemonic('S'); cd1xl3.addActionListener(this);//加组件监听 cd1xl3.setActionCommand("saveOut");//设置键值 cd1.add(cd1xl3); cd1xl4=new JMenuItem("退出(Q)"); cd1xl4.setMnemonic('Q'); cd1xl4.addActionListener(this);//加组件监听 cd1xl4.setActionCommand("exit");//设置键值 cd1.add(cd1xl4); cd.add(cd1);//给菜单栏 cd 添加菜单 cd1 cd2xl1=new JMenuItem("速度(F)");//菜单系列 cdxl 没做好效果? cd1xl4.setMnemonic('F'); cd1xl4.addActionListener(this);//加组件监听 cd1xl4.setActionCommand("FSpeed");//设置键值 cd2.add(cd2xl1); cd.add(cd2); ImageIcon img = new ImageIcon("E:/Tank1/tankebig.PNG"); JLabel imageJLabel = new JLabel(img); gkmp.add(imageJLabel); this.add(gkmp); this.setJMenuBar(cd); this.setTitle("坦克大战"); ImageIcon tp1=new ImageIcon("E:/Tank1/tankexiao.PNG");//设置小图标地址要写全路径 this.setIconImage(tp1.getImage()); this.setSize(700,620); this.setLocation(300,80); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true);//可见 this.setResizable(false);//可调 // this.setResizable(true); } public void actionPerformed(ActionEvent e){ //boolean flag=true; if(e.getActionCommand().equals("newGame")) { this.remove(gkmp);//取消界面 gkmp if(mp.flag==false)//因为在主类构造函数开始就创建了mp,所以可以引用flag变量 { this.remove(mp); mp=new MyPanel("newGame"); } this.add(mp); this.addKeyListener(mp); Thread t=new Thread(mp);//启动我的MyPanel模板对象mp的线程 t.start();//叫醒线程 this.setVisible(true);//因为默认的是不可见,必须写这个!! Record.bcjl();//???? }else if(e.getActionCommand().equals("saveOut")) { Record record0=new Record(); // record0.setDtk(mp.dtk); record0.cunpan();///?????? System.exit(0);//游戏退出 }else if(e.getActionCommand().equals("exit")) { Record.bcjl(); System.exit(0);//游戏退出 }else if(e.getActionCommand().equals("goonGame")){ this.remove(gkmp); if(mp.flag==false)//因为在主类构造函数开始就创建了mp,所以可以引用flag变量 { this.remove(mp); mp=new MyPanel("goonGame"); } Thread t=new Thread(mp); t.start(); this.add(mp); this.addKeyListener(mp); this.setVisible(true); } } class StartPanel extends JPanel implements Runnable //开始界面类 { int time=0; public void paint(Graphics g){ super.paint(g); // g.fillRect(0, 0, 600, 500);//设置画布 g.setColor(Color.black);//设置颜色 Color mycolor1=new Color(250,50,0);//自定义红色 g.setFont(new Font("华文琥珀",Font.BOLD,80));//设置字体//? g.drawString("坦克大战",190 , 460);//绘字符串 g.setColor(Color.black);//设置颜色 g.setFont(new Font("黑体",1,14));//设置字体 g.drawString("李晋祥",648 , 552);//绘字符串 if(time%2==0) { g.setColor(Color.white);//设置颜色 g.setFont(new Font("华文行楷",3,35));//字体:华康楷体, Ravie, OCR A Extended g.drawString("准备战斗",270 , 345);//绘字符串 } } StartPanel(){ } public void run(){ while(true){ try{ Thread.sleep(400); }catch(Exception e){} time++; this.repaint(); } } } class MyPanel extends JPanel implements KeyListener,Runnable { //Vector<MyTank> mts=new Vector<MyTank>();//建立一个我的坦克集合类可以出无限个坦克 MyTank mt=null; MyTank mt0=null; MyTank mt01=null; MyTank mt02=null; Vector<DiTank> dtk=new Vector<DiTank>();//建立一个敌坦克集合类 Props props=null; Vector<Baozha> bzjh=new Vector<Baozha>();//创建一个爆炸类的集合 Vector<Weizhi> wzjh=new Vector<Weizhi>();//建立一个位置集合类,为啥建立这集合类 int tksl=3;//坦克数量 int a=122; int b=455; int n=10; int myzdNum=4;//? int propsSort=5; int time=0; boolean flag=true;//标记是不是已经创建过MyPanel类 boolean b1=false; int x=1;//总关卡数? int rocket=1;//没用? int huopao=0;//? Color mycolor1=new Color(250,50,0);//自定义红色 Color mycolor2=new Color(0,250,50);//自定义绿色 Color mycolor3=new Color(0,50,250);//自定义兰色 Color mycolor11=new Color(130,200,0);//自定义土黄 Color mycolor31=new Color(0,100,200);//自定义兰色 Color mycolor21=new Color(0,250,0);//自定义绿色 JLabel imageJLabel0=null; JLabel imageJLabel1=null; ImageIcon img0=null;//? ImageIcon img1=null;//? public MyPanel(String ss) { ImageIcon img0 = new ImageIcon("e:/Tank1/background.jpg"); JLabel imageJLabel0 = new JLabel(img0); this.add(imageJLabel0); Record.dqjl();//? mt=new MyTank(600,280);//new多个可改为多个坦克,循环数组 mt0=new MyTank(550,280);//new多个可改为多个坦克,循环数组 mt01=new MyTank(550,330);//new多个可改为多个坦克,循环数组 mt02=new MyTank(600,330);//new多个可改为多个坦克,循环数组 props=new Props(30,30);//没有实际意义,为了new对象,必须要有个参数? if(ss.equals("newGame")){ // record=new Record(); for(int i=0;i<tksl;i++){ DiTank dt=new DiTank((i)*a,b);//添加出场敌坦 // dt.dtkxl(dtk);///???是不是敌人坦克血量 dt.setFangxiang(1);//给一个初始值,调drawTank()赋初值要用 Thread t2=new Thread(dt); t2.start(); Zidan zd=new Zidan(dt.x,dt.y,1);//?这是干啥加子弹元素吗? Thread t3=new Thread(zd);//? t3.start(); dtk.add(dt); } }else if(ss.equals("goongame")){//继续游戏有问题 感觉读取存盘信息有问题 wzjh=Record.dupan(); for(int i=0;i<wzjh.size();i++){ Weizhi wz=wzjh.get(i); DiTank dt=new DiTank(wz.x,wz.y);//添加出场敌坦 dt.setFangxiang(wz.fangxiang); // dt.dtkxl(dtk);//?敌坦克血量,好像暂时用不着 // dt.setFangxiang(1);//给一个初始值,调drawTank()赋初值要用 Thread t2=new Thread(dt); t2.start(); Zidan zd=new Zidan(dt.x,dt.y,1);//?这是干啥加子弹元素吗? Thread t3=new Thread(zd);//? t3.start(); dtk.add(dt); } } flag=false;//MyPanel类的mp创建过一次就标记为假 // this.repaint(); // Record.next(); // if(Record.next()%2!=0){ // Record.reMtNum();//需要吗? // Record.reDtNum();//需要吗? // Record.reAddMtNum(); // } } public void outNum(Graphics g)//画出统计数据的方法也即使显示数量的函数 { g.setColor(Color.cyan); this.drawTank(500,150,g,0,0);//引用drawtank()的不能是g,而是this this.drawTank(570,150,g,0,1); this.drawTank(500,70,g,0,1); g.setColor(Color.black); g.setFont(new Font("仿宋",2,20));//??换换字体效果 g.drawString(Record.getDtNum()+"",600,170); if((Record.getMtNum()+Record.getAddMtNum())>=0){ g.drawString((Record.getMtNum()+Record.getAddMtNum())+"",530,170);// }else{ g.drawString((Record.getAddMtNum())+"",530,170); } g.setColor(Color.blue); g.setFont(new Font("方正小标宋",1,17)); g.drawString("干掉的坦克总数:",510,40); g.setColor(Color.black); g.setFont(new Font("仿宋",2,20)); g.drawString(Record.getSumDtNum()+"",530,90); g.setColor(Color.MAGENTA);//设置颜色 g.setFont(new Font("隶书",0,20));//设置字体 g.drawString("第"+x+"关",500 , 200);//绘字符串 } public void paint(Graphics g){//这个方法每当窗口激活,最小化,调用repaint()方法都会运行,线程中调用就一直显示 super.paint(g); // g.fillRect(0,0,400,300);//做个背景画布,默认黑色 this.outNum(g);//调用显示数量的函数 g.setColor(Color.red);//设置颜色 g.fillRect(530, 210, 30, 20); g.setColor(Color.black);//设置颜色 g.drawLine(530, 210, 530, 320); g.setColor(mycolor11);//设置颜色 if(mt.live==true){ this.drawTank(mt.getX(),mt.getY(),g,mt.fangxiang,0); } if(mt0.live==true){ this.drawTank(mt0.getX(),mt0.getY(),g,mt0.fangxiang,2); } if(mt01.live==true){ this.drawTank(mt01.getX(),mt01.getY(),g,mt01.fangxiang,2); } if(mt02.live==true){ this.drawTank(mt02.getX(),mt02.getY(),g,mt02.fangxiang,2); } if(mt.getLive()==false){ g.setColor(mycolor11);//设置颜色 g.setFont(new Font("Gill Sans Ultra Bold Condensed",1,40));//字体:华康楷体, Ravie, OCR A Extended g.drawString("game over...",200 , 220);//绘字符串 this.repaint(); } if(Record.getDtNum()%6==0&&(Record.getDtNum()>10)){ // if(time%2==0) // { g.setColor(Color.blue);//设置颜色 g.setFont(new Font("华文行楷",1,35));//字体:华康楷体, Ravie, OCR A Extended g.drawString("你行不行?",310 , 265);//绘字符串 // } } if(Record.getDtNum()==0){ g.setColor(Color.red);//设置颜色 g.setFont(new Font("华文行楷",1,35));//字体:华康楷体, Ravie, OCR A Extended g.drawString("过关!",300 , 265);//绘字符串 } for(int i=0;i<dtk.size();i++)//画敌人坦克asd { DiTank dt=dtk.get(i); if(dt.live==true){ this.drawTank(dt.getX(),dt.getY(),g,dt.fangxiang,1);//??!!注意用法用dtk 还是dt调用 } } for(int i=0;i<mt.aa.size();i++)//画我的子弹 { Zidan zd=mt.aa.get(i); if(mt.zd!=null&&mt.zd.live==true) //???画子弹的条件 { //g.fill3DRect((mt.zd.x-2),(mt.zd.y-2), 8, 8, false); //???画子弹火力圈 g.setColor(Color.black);//子弹颜色设置为白色 g.fillOval(zd.x+1,zd.y+1, 4,4); } if(zd.live==false) { mt.aa.remove(zd); } } //this.repaint();//? for(int i=0;i<dtk.size();i++)//画敌人的子弹 { DiTank dt=dtk.get(i); for(int j=0;j<dt.dzd.size();j++) { Zidan zd=dt.dzd.get(j); if(zd!=null&&dtk.get(i).live==true) { g.setColor(Color.red);//子弹颜色设置为红色,次处不进循环是不是更好? g.fillOval(zd.x+1,zd.y+1, 4,4); } if(zd.live==false)//删除生命为假的敌人子弹???? { dt.dzd.remove(zd); } } } for(int i=0;i<bzjh.size();i++) //画爆炸 { Baozha bz=bzjh.get(i); if(bzjh.get(i).livetime>140){ g.setColor(Color.red); g.fillOval(bz.x, bz.y+5, 20,20 );//代替上面的句子 //g.fillOval(bz.x, bz.y, 20,5 );//可以用来做合成图形,但是要定好坐标点 }else if((bzjh.get(i).livetime<=100)&&(bzjh.get(i).livetime>50)){ g.setColor(Color.orange); g.fillOval(bz.x+4, bz.y+9, 12,12 ); }else if((bzjh.get(i).livetime<=50)&&(bzjh.get(i).livetime>20)){ g.setColor(Color.yellow); g.fillOval(bz.x+7, bz.y+11,5,5 ); }else{ g.setColor(Color.pink); g.fillOval(bz.x+10, bz.y+13,2,2 ); } bz.ltjs(); //生存时间减少函数 if(bz.livetime==0){ bzjh.remove(bz); } } // if(props.live==true){//画道具 this.drawProps(props.getX(),props.getY(),g,props.getleixing()); } //} this.repaint();//教学视频少了这句,子弹无法自主运行,主类启动线程后仍然可动 } public void keyPressed(KeyEvent e)//键盘输入事件 { if(mt.getLive()==true){ if(e.getKeyCode()==KeyEvent.VK_W){ this.mt.setFangxiang(0); this.mt.xiangshang(); }else if(e.getKeyCode()==KeyEvent.VK_S){ this.mt.setFangxiang(1); this.mt.xiangxia(); }else if(e.getKeyCode()==KeyEvent.VK_A){ this.mt.setFangxiang(2); this.mt.xiangzuo(); }else if(e.getKeyCode()==KeyEvent.VK_D){ this.mt.setFangxiang(3); this.mt.xiangyou(); } if(e.getKeyCode()==KeyEvent.VK_J) { if((mt.aa.size()<myzdNum)&&(mt.live==true))//子弹设置最多 myzdNum 发 { this.mt.fszd();//调用发射子弹函数 } } } } public void crash(){ } public boolean addprops(Props props,MyTank mt)//吃道具触发 方法 (道具功能触发模型为边长20的正方形) { boolean b2=false; switch(props.leixing){ case 0://我的坦克速度提高//mt.fangxiang 0\1\2\3 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; mt.sudu=20; b2=true; } break; case 1://效果回到出生地 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; mt.setX(630); mt.setY(280); b2=true; } break; case 2://提高我可以发射的子弹数目 //mt.fangxiang 0\1\2\3 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; this.myzdNum=30; this.huopao=1; this.n=4; b2=true; } break; case 3://显示的敌人坦克全死,但实际效果是..是不出敌方坦克了!!!! if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; for(int i=0;i<dtk.size();i++){ if(dtk.get(i).live==true){ dtk.get(i).live=false; Record.setDtNum();//有几个活坦克生命变假,就累计几辆dtNum } } b1=true; b2=true; } break; case 4://吃道具加命 if((mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15<props.getY()+20&&mt.getY()+15>props.getY())||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+10>props.getX()&&mt.getX()+10<props.getX()+20&&mt.getY()+15>props.getY()&&mt.getY()+15<props.getY()+20)||(mt.getX()+15>props.getX()&&mt.getX()+15<props.getX()+20&&mt.getY()+10>props.getY()&&mt.getY()+10<props.getY()+20)){ props.live=false; Record.setAddMtNum(); b2=true; // System.out.println("吃道具加命程序,正常运行"); } break; } return b2; } // addMyTank++; //MyTank mt1=new MyTank(mt.getX(),mt.getY());//??创建另一个MyTank对象 // public void setAddMytank(){ // addMyTank++; // }; // public static int getAddMytank(){ // return addMyTank; // }; public void run() //我的画板的 线程函数 { while(true){ try{ Thread.sleep(50);// }catch(Exception e){} for(int i=0;i<mt.aa.size();i++)//我的子弹集中敌坦克的线程 { Zidan myzd=mt.aa.get(i); if(myzd.live){ for(int j=0;j<dtk.size();j++){ DiTank dt=dtk.get(j); // Zidan zd=dt.dzd.get(j);//为啥dzd可以直接用,不用创建// ||(b1==true&&Record.getDtNum()>0) if(dt.live)//内关联敌人坦克重生的一种情况,有敌人坦克被打中 { if(this.jzsf(myzd,dt)&&((Record.getDtNum()-tksl)>=0)){//调用jzsf(),打中同时,坦克定点?及时重生 DiTank dt0=new DiTank((int)(Math.random()*50+5)*10,(int)(Math.random()*100+450)); Thread t2=new Thread(dt0); t2.start(); Zidan zd0=new Zidan(dt0.x,dt0.y,dt0.fangxiang); Thread t3=new Thread(zd0); t3.start(); dt0.dzd.add(zd0); dtk.add(dt0); } } } } } if(Record.getDtNum()>=tksl&&b1==true){ //炸弹爆炸,敌坦克按条件重生, for(int i=0;i<tksl;i++){ DiTank dt1=new DiTank((int)(Math.random()*20)*10,(int)(Math.random()*100+450)); Thread t6=new Thread(dt1); t6.start(); Zidan zd1=new Zidan(dt1.x,dt1.y,dt1.fangxiang); Thread t7=new Thread(zd1); t7.start(); dt1.dzd.add(zd1); dtk.add(dt1); } b1=false; } if((Record.getDtNum()==(tksl-1))&&(b1==true)){ for(int i=0;i<tksl-1;i++){ DiTank dt1=new DiTank((int)(Math.random()*20)*10,(int)(Math.random()*100+450)); Thread t6=new Thread(dt1); t6.start(); Zidan zd1=new Zidan(dt1.x,dt1.y,dt1.fangxiang); Thread t7=new Thread(zd1); t7.start(); dt1.dzd.add(zd1); dtk.add(dt1); } b1=false; } if((Record.getDtNum()==(tksl-2))&&(b1==true)){ // for(int i=0;i<tksl-1;i++){ DiTank dt1=new DiTank((int)(Math.random()*20)*10,(int)(Math.random()*100+450)); Thread t6=new Thread(dt1); t6.start(); Zidan zd1=new Zidan(dt1.x,dt1.y,dt1.fangxiang); Thread t7=new Thread(zd1); t7.start(); dt1.dzd.add(zd1); dtk.add(dt1); b1=false; } for(int j=0;j<dtk.size();j++)//敌人的子弹击中我的坦克的线程 { DiTank dt=dtk.get(j);//取出所有敌方坦克 for(int i=0;i<dt.dzd.size();i++) { Zidan zd=dt.dzd.get(i);//? if(zd.live) { if(this.jzsf(zd,mt)==true){//调用 击中敌坦 函数 } } } } if((this.time%120)==0){//6秒发生1次 道具随机重置//draw mt hit props props.live=true; // props.leixing=2; props.leixing=(int)(Math.random()*propsSort); props.x=(int)(Math.random()*370); props.y=(int)(Math.random()*270); props.livetime=100;//道具生存期 } if(props.livetime>0){//道具生存期变化 props.livetime--; }else{ props.live=false; } if(mt.live==true&&props.live==true){//调用 吃道具 方法 this.addprops(props,mt); } time++; // if(SaveData.getSumDtNum()%20==0){ // Record.next(); // } this.repaint();//线程运行中重绘?? } } public void jzwf()//敌人子弹集中我方坦克的方法 { for(int i=0;i<this.dtk.size();i++){ DiTank dt=dtk.get(i); for(int j=0;j<dt.dzd.size();j++){ Zidan zd=dt.dzd.get(j); this.jzsf(zd, mt); } } } public void jzdf() //我的子弹击中坦克的方法 { for(int i=0;i<mt.aa.size();i++){ Zidan zd=mt.aa.get(i);//从我的子弹集合类取我的各个子弹 if(zd.live==true){ for(int j=0;j<dtk.size();j++){ DiTank dt=dtk.get(j);//从敌坦克集合类取出各个敌坦克 if(dt.live){ this.jzsf(zd,dt); // levelDtNum--; } } } this.repaint(); } } public boolean jzsf(Zidan zd,Tank tk)//击中双方的方法 { boolean b2=false; switch(tk.fangxiang) { case 0: case 1: if(zd.x>tk.x&&zd.x<tk.x+20&&zd.y>tk.y&&zd.y<tk.y+30)//分辨率判断? { if(tk instanceof DiTank){//只改这就实现 判断tk是不是DiTank的实例 Record.setDtNum(); Record.setSumDtNum(); // Record.setAddMtNum(); tk.live=false; b2=true; }else{ // System.out.println("Record.getMtNum()="+Record.getMtNum()); Record.setMtNum();//Record.getSumMtNum()一直小于0 ?bug if(Record.getMtNum()+1<=0){ Record.lowAddMtNum(); } // System.out.println("Record.getMtNum()="+Record.getMtNum()); // System.out.println("Record.AddMtNum()="+Record.getAddMtNum()); if(Record.getMtNum()+Record.getAddMtNum()>0){//bug 被打一下就游戏结束 已经解决 mt.setX(140); mt.setY(232); } if(Record.getMtNum()+Record.getAddMtNum()<=0){ tk.live=false; } } zd.live=false; Baozha bz=new Baozha(tk.x,tk.y); bzjh.add(bz); } break; case 2: case 3: if(zd.x>tk.x&&zd.x<tk.x+30&&zd.y>tk.y&&zd.y<tk.y+20){ if(tk instanceof DiTank){//只改这就实现 判断tk是不是DiTank的实例 Record.setDtNum();//每次敌人坦克数量-1 Record.setSumDtNum(); // Record.setAddMtNum(); tk.live=false; b2=true; }else{ // System.out.println("Record.getMtNum()="+Record.getMtNum()); Record.setMtNum();//Record.getSumMtNum()一直小于0 ?bug if(Record.getMtNum()+1<=0){ Record.lowAddMtNum(); } // System.out.println("Record.getMtNum()="+Record.getMtNum()); // System.out.println("Record.AddMtNum()="+Record.getAddMtNum()); if(Record.getMtNum()+Record.getAddMtNum()>0){//bug 被打一下就游戏结束 已经解决 mt.setX(550); mt.setY(270); } if(Record.getMtNum()+Record.getAddMtNum()<=0){ tk.live=false; } } zd.live=false; Baozha bz=new Baozha(tk.x,tk.y); bzjh.add(bz); } break; } return b2; } public void keyTyped(KeyEvent e){} public void keyReleased(KeyEvent e){} public void drawTank(int x,int y,Graphics g,int fangxiang,int leixing)//画坦克函数 { int m=10; //double n=1; switch(leixing)//不同阵营坦克 { case 0://我的坦克 g.setColor(Color.yellow);// 我的坦克颜色 黄色 // g.fillOval(170*huopao, 240*huopao, 30*huopao, 30*huopao); m=11; break; case 1://敌人的坦克 g.setColor(mycolor3);//敌人坦克颜色 蓝色 // m=15; break; case 2://玩家2的坦克 g.setColor(mycolor1);//敌人坦克颜色 绿色 break; } switch(fangxiang)//不同方向的坦克(0,1,2,3)分别代表上下左右,中心原点不变做坐标变换 { case 0://上 g.fill3DRect(x,y,5,30,true); g.fill3DRect(x+15,y,5,30,true); g.fill3DRect(x+5,y+5,10,20,true); g.drawLine(x+10,y-5,x+10,(y+10)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; case 1://下 g.fill3DRect(x,y,5,30,true); g.fill3DRect(x+15,y,5,30,true); g.fill3DRect(x+5,y+5,10,20,true); g.drawLine(x+10,y+10,x+10,(y+35)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; case 2://左 g.fill3DRect(x-5,y+5,30,5,true); g.fill3DRect(x-5,y+20,30,5,true); g.fill3DRect(x,y+10,20,10,true); g.drawLine((x-10)+n-m,y+15,(x+10),(y+15)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; case 3://右 g.fill3DRect(x-5,y+5,30,5,true); g.fill3DRect(x-5,y+20,30,5,true); g.fill3DRect(x,y+10,20,10,true); g.drawLine((x+10)-n+m,y+15,(x+30),(y+15)); g.setColor(Color.black); g.fillOval(x+5,y+10,10,10); break; } } public void drawProps(int x,int y,Graphics g,int leixing)//画道具 { if(time%8==0){ switch(leixing) { case 0://画车轮对应坦克加速 g.setColor(Color.white); g.fillOval(x, y, 21, 21); g.setColor(Color.black); g.fillOval(x+2,y+2,16,16); g.setColor(Color.white); g.drawOval(x+2,y+2,16,16); g.drawLine(x+2,y+10,x+18,y+10); g.drawLine(x+10,y+2,x+10,y+18); g.drawLine(x+16,y+4,x+4,y+16); g.drawLine(x+4,y+4,x+16,y+16); break; case 1://画回出生地道具图标 g.setColor(Color.white); g.drawRoundRect(x, y, 20, 20, 5, 5); g.setColor(mycolor3); g.fillRoundRect(x+5, y+5, 10, 10, 5, 5); break; case 2://画增加子弹数目道具//? g.setColor(mycolor2); g.fill3DRect(x-15,y+8,30,5,false); g.fill3DRect(x-15,y+6,10,10,true); g.fillOval(x+15,y+7,7,7); break; case 3://画炸弹 g.setColor(mycolor2); g.fillRect(x, y, 21, 21); g.setColor(Color.black); g.fillRect(x+8,y+6,6,2); g.fillOval(x+3,y+7,14,14); g.drawLine(x+11, y+3, x+11, y+6); g.setColor(Color.white); g.drawLine(x+11, y+15, x+8, y+14); break; case 4://画小坦克道具 g.setColor(Color.yellow); g.fill3DRect(x,y,20,3,true); g.fill3DRect(x,y+10,20,3,true); g.fill3DRect(x+3,y+3,14,7,false); g.fillOval(x+6,y+3,7,7); g.drawLine(x-7,y+6,x+7,y+6); break; } } } } }

求救:JAVA dom4j获取XML嵌套节点属性值

本人小白,求JAVA DOM4J源码,如: ``` <?xml version="1.0" encoding="UTF-8"?> <test> <a name="1"> <a name="2">测试</a> </a> </test> ``` dom4j怎么解出a节点name属性值,即获得1 2 (*a节点可能嵌套了多个a节点,所以节点路径不能写死*)

求救,阿里云Linux服务器Tomcat报错,被折磨了一下午也没找到问题出在哪儿。

我的流程:1、阿里云Linux,重装系统盘CentOS7.6 x64,清空磁盘内容。2、用Xftp传输apache-tomcat-7.0.82和jdk-7u80-linux-x64.tar.gz并用指令解压。3、向etc/profile内export JAVA环境变量并用sorce刷新文件。4、用vim指令更改Tomcat/conf/server.xml中的8080接口为80。5、转到/bin目录下启动startup.sh,可ping通但外网无法访问,随后启动shutdown.sh。 第5步的控制台内容如下: [root@iZj6c1q38vbvbchvmhrp3gZ bin]# ./startup.sh Using CATALINA_BASE: /usr/web/apache-tomcat-7.0.82 Using CATALINA_HOME: /usr/web/apache-tomcat-7.0.82 Using CATALINA_TMPDIR: /usr/web/apache-tomcat-7.0.82/temp Using JRE_HOME: /usr/web/jdk1.7.0_80/jre Using CLASSPATH: /usr/web/apache-tomcat-7.0.82/bin/bootstrap.jar:/usr/web/apache-tomcat-7.0.82/bin/tomcat-juli.jar Tomcat started. [root@iZj6c1q38vbvbchvmhrp3gZ bin]# ./shutdown.sh Using CATALINA_BASE: /usr/web/apache-tomcat-7.0.82 Using CATALINA_HOME: /usr/web/apache-tomcat-7.0.82 Using CATALINA_TMPDIR: /usr/web/apache-tomcat-7.0.82/temp Using JRE_HOME: /usr/web/jdk1.7.0_80/jre Using CLASSPATH: /usr/web/apache-tomcat-7.0.82/bin/bootstrap.jar:/usr/web/apache-tomcat-7.0.82/bin/tomcat-juli.jar Oct 07, 2017 3:12:04 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Could not contact localhost:8005. Tomcat may not be running. Oct 07, 2017 3:12:05 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Catalina.stop: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at java.net.Socket.<init>(Socket.java:425) at java.net.Socket.<init>(Socket.java:208) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:499) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:343) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430) [root@iZj6c1q38vbvbchvmhrp3gZ bin]# 不尽感激!!!!

坐等求救,java用ssh的时候,Gson解析json有外键的时候报错

解析json是用的gson,实体类涉及到三张表三个类,之间的关系是: C表的一个字段是外键,为A表的主键 C表的另一个字段是外键,为B表的主键 转json的时候报如下异常,该怎么做,请具体一点. 这是多对多的关系吧? java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter? at com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:67) at com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:61) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:107) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:96) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:60) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195) at com.google.gson.Gson.toJson(Gson.java:593) at com.google.gson.Gson.toJson(Gson.java:572) at com.google.gson.Gson.toJson(Gson.java:527) at com.chebeiyuan.utils.GsonUtil.objectToString(GsonUtil.java:29) at com.chebeiyuan.action.BaseAction.setResultJson(BaseAction.java:136) at com.chebeiyuan.action.BaseAction.setSuccessJson(BaseAction.java:149) at com.chebeiyuan.action.CarTypeAction.getUserCarList(CarTypeAction.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619)

Java小白求救啊!!!

package com.shuai.plane; import java.awt.Color; import java.awt.Graphics; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.lang.ref.PhantomReference; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; //JAVA中游戏面板:JPanel /* * 自定义游戏面板 * 1.写一个类继承JPanel * 2.创建构造方法,初始化游戏面板的属性 * * 画图的步骤 * 1.在类中定义图片,并取名 * 2.在构造方法中调用工具类(Photo)初始化图片 * 3.在画图方法paint中,画图片(paint是专门的画图方法) * */ public class GamePanel extends JPanel{ //创建一个集合,用来存放敌机(敌机的大本营) List<EnemyPlane> arrays = new ArrayList<>(); //创建一个集合,用来放英雄机的弹药 List<HeroFire> HFire = new ArrayList<>(); //创建一个集合,用来放敌机的弹药 List<EnemyFire> EnFire = new ArrayList<>(); //创建英雄机的对象 HeroPlane heroPlane = new HeroPlane(); //创建敌机的对象 EnemyPlane enemyPlane = new EnemyPlane(); //写一个线程,让程序跑起来 //写一个方法,启动线程 public void action() { new Thread() { public void run() { //定义一个变量控制敌机出现的数量 int a = 0; int b = 20; //写一个死循环,让程序一直运行 while(true) { //让敌机出现在面板上 if(a == b) { MakeEP(); a = 0; } //让敌机移动 epMove(); //让英雄机子弹出现在面板上 if(a == 0) { MakeHeroFire(); } //让英雄机的子弹动起来 HeroFireMove(); //让敌机的子弹出现在面板上 //MakeEnemyFire(); //让敌机的子弹动起来 //EnemyFireMove(); //重绘布局(刷新页面) repaint(); try { this.sleep(30); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } a++; } } }.start(); } //写一个方法,让敌机移动 public void epMove() { for(int i = 0; i < arrays.size(); i++) { EnemyPlane enemyPlane = arrays.get(i); enemyPlane.y += 10; if(enemyPlane.y > 800) { arrays.remove(enemyPlane); } //EnemyFire enemyFire = EnFire.get(i); //enemyFire.y += 15; } } //写一个方法,用来生产敌机,并把它放进集合中 void MakeEP() { //创建敌机 EnemyPlane enemyPlane = new EnemyPlane(); //创建敌机的子弹 //EnemyFire enemyFire = new EnemyFire(enemyPlane.x, enemyPlane.y); //把敌机加到大本营中(集合) arrays.add(enemyPlane); //EnFire.add(enemyFire); } //写一个方法,生产英雄机的弹药,并把它放进英雄机的弹药库 void MakeHeroFire() { for(int i = 0; i < arrays.size(); i++) { HeroFire heroFire = new HeroFire(heroPlane.x + 15, heroPlane.y, 0); HFire.add(heroFire); HeroFire heroFire2 = new HeroFire(heroPlane.x + 78, heroPlane.y, 2); HFire.add(heroFire2); HeroFire heroFire3 = new HeroFire(heroPlane.x + 48, heroPlane.y - 20, 1); HFire.add(heroFire3); } } //写一个方法让英雄机子弹移动 public void HeroFireMove() { for(int i = 0; i < HFire.size(); i++) { HeroFire heroFire = HFire.get(i); if(heroFire.dir == 0) { heroFire.x -= 1; } if(heroFire.dir == 2) { heroFire.x += 1; } heroFire.y -= 10; // if(heroFire.y < -heroFire.h) { // HFire.remove(heroFire); // } } } //写一个方法生产敌机的弹药,并放进敌机的弹药库 void MakeEnemyFire() { EnemyFire enemyFire = new EnemyFire(enemyPlane.x, enemyPlane.y); EnFire.add(enemyFire); } //让敌机的子弹动起来 void EnemyFireMove() { for(int i = 0; i < EnFire.size(); i++) { EnFire.get(i).y += 15; } } //定义背景图 BufferedImage bgp; //创建构造方法,初始化面板 public GamePanel(GameFrame gameFrame) { //设置面板的背景 //setBackground(Color.cyan); //通过工具类(Photo)获取图片 bgp = Photo.getImage("/Img/bg1.jpg"); /* * 使用鼠标监听器(固定格式) */ //1.创建鼠标适配器 //这是一个匿名内部类 MouseAdapter adapter = new MouseAdapter() { //2.确定需要的鼠标监听事件 /* * 鼠标监听事件: * 1.mouseMoved();监听鼠标移动事件 * 2.mouseCliked();监听鼠标单击事件(鼠标按下后松开才会被监听,按下不会被监听) * 3.mousePressed();监听鼠标按下去的事件(只要鼠标按下就会被监听) * 4.mouseEntered();监听鼠标移入游戏界面的事件 * 5.mouseExited();监听鼠标移出游戏界面的事件 * * MouseEvevt:鼠标的事件,记录鼠标做的事情 * */ @Override //当鼠标在游戏界面移动时,会触发此方法 public void mouseMoved(MouseEvent e) { //让英雄机跟着鼠标移动,就让英雄机的横纵坐标等于鼠标的横纵坐标 //获取鼠标的坐标(getX();获取鼠标的横坐标, getY();获取鼠标的纵坐标) int mx = e.getX(); int my = e.getY(); //让英雄机移动到鼠标的位置(英雄机移动到鼠标的位置,是英雄机的行为,可以在英雄机中定义方法) //此时英雄机依然不会移动,其实英雄机的坐标已经改变,但是没有把英雄机绘制到新的坐标,需要刷新页面 //heroPlane.move(mx, my); heroPlane.x = mx - heroPlane.w/2; heroPlane.y = my - heroPlane.h/2; //刷新页面,将英雄机绘制到新的页面 //重新调用paint方法(re 表示重新调用) repaint(); } @Override //当鼠标在游戏界面单击时,会触发此方法 public void mouseClicked(MouseEvent e) { System.out.println("~~~~~~~鼠标单击了"); } @Override //当鼠标在游戏界面按下时,会触发此方法 public void mousePressed(MouseEvent e) { System.out.println("!!!!!!!!鼠标被按下了"); } @Override //当鼠标移入游戏界面时,会触发此方法 public void mouseEntered(MouseEvent e) { System.out.println("**************鼠标被移出"); } @Override //当鼠标移出游戏界面时,会触发此方法 public void mouseExited(MouseEvent e) { System.out.println("**************鼠标被移入"); } }; //3.将适配器加入到监听器中(固定格式) addMouseListener(adapter); addMouseMotionListener(adapter); /* * 使用键盘适配器(固定模式) */ // 1.创建键盘适配器 KeyAdapter key = new KeyAdapter() { // 2.确定需要监听的键盘事件 @Override //当键盘按下时,会触发此方法 public void keyPressed(KeyEvent e) { //监听键盘的按键(每一个按键都对应有一个数字) //获取按键的数字 int a = e.getKeyCode(); //KeyEvent.VK_?;是表示指定的按键对应的数字 if(a == KeyEvent.VK_A || a == KeyEvent.VK_LEFT) { if((heroPlane.x -= 10) < -heroPlane.w/2) { heroPlane.x = 0 - heroPlane.w/2; } }else if(a == KeyEvent.VK_D || a == KeyEvent.VK_RIGHT) { if((heroPlane.x += 10) > 600 - heroPlane.w/2) { heroPlane.x = 600 - heroPlane.w/2; } }else if(a == KeyEvent.VK_W || a == KeyEvent.VK_UP) { if((heroPlane.y -= 10) < 0) { heroPlane.y = 0; } }else if(a == KeyEvent.VK_S || a == KeyEvent.VK_DOWN) { if((heroPlane.y += 10) > 800 - heroPlane.h) { heroPlane.y = 800 - heroPlane.h; } } //重绘,将英雄机画到新的位置上 repaint(); /* if(e.getKeyChar() == 'a') { if((heroPlane.x -= 10) < -heroPlane.w/2) { heroPlane.x = 0 - heroPlane.w/2; } } if(e.getKeyChar() == 'd') { if((heroPlane.x += 10) > 600 - heroPlane.w/2) { heroPlane.x = 600 - heroPlane.w/2; } } if(e.getKeyChar() == 'w') { if((heroPlane.y -= 10) < 0) { heroPlane.y = 0; } } if(e.getKeyChar() == 's') { if((heroPlane.y += 10) > 800 - heroPlane.h) { heroPlane.y = 800 - heroPlane.h; } } //重绘,将英雄机画到新的位置上 repaint(); */ } }; // 3.将适配器加入到窗体的监听器中(加到面板的键盘监听器中是没有用的) //可以在创建面板对象时,把窗体对象传过来,然后把键盘适配器添加到窗体的键盘监听器中 //需要面板的构造器添加参数,并指定类型 gameFrame.addKeyListener(key); } //专门画图的方法,重写于JComponent类(JPanel的父类) //画图的方法:(画图时一定要注意图片的尺寸) // 格式: g.drawImage(图片, 横坐标, 纵坐标, 宽度, 高度, 当转换了更多图片是要通知的对象) // 画图时如果不设定图片的大小,图片显示就是原图的大小 @Override public void paint(Graphics g) { //g.drawImage(img, x, y, observer); //横纵坐标是设置图片左上角的坐标,设置图片的大小 g.drawImage(bgp, 0, 0, 600, 800, null); //在paint中画图是有顺序的,先画的在下面一层,先画的会被后画的覆盖 //给敌机画图 //已经把敌机放入集合中了,使用遍历绘制敌机 for(int i = 0; i < arrays.size(); i++) { EnemyPlane enemyPlane = arrays.get(i); g.drawImage(enemyPlane.img, enemyPlane.x, enemyPlane.y, enemyPlane.w, enemyPlane.h, null); } //给英雄机画图 g.drawImage(heroPlane.img, heroPlane.x, heroPlane.y, heroPlane.w, heroPlane.h, null); //把英雄机的弹药画进面板 for(int i = 0; i < HFire.size(); i++) { HeroFire heroFire = HFire.get(i); g.drawImage(heroFire.img, heroFire.x, heroFire.y, heroFire.w, heroFire.h, null); } //把敌机的子弹画进面板中 // for(int i = 0; i < EnFire.size(); i++) { // EnemyFire enemyFire = EnFire.get(i); // g.drawImage(enemyFire.img, enemyFire.x, enemyFire.y, enemyFire.w, enemyFire.h, null); // } } } ![图片说明](https://img-ask.csdn.net/upload/202003/20/1584711414_269752.png)![图片说明](https://img-ask.csdn.net/upload/202003/20/1584711424_683016.png)![图片说明](https://img-ask.csdn.net/upload/202003/20/1584711438_860998.png)![图片说明](https://img-ask.csdn.net/upload/202003/20/1584711451_113820.jpg) ![图片说明](https://img-ask.csdn.net/upload/202003/20/1584711743_593343.png) 图一是运行时操作的画面,如果移动鼠标或者按着键盘不放(应该是飞机移动太快的时候),就会出现下面的画面,会一次出现多个子弹(我就的是鼠标移动时刷新的太快,但是线程里面是限制了时间的,难道是鼠标或者键盘和县线程里面重复刷新了???不会啊,求救啊!!!)。还有,截图代码中,如果把圈出来的判断代码放出来,游戏界面就会出现圈起来的样子(最左边的子弹向上走到一定高度就会变成两个,每次都是在那个高度,并且只有最左边的子弹会变化。)(我就的可能是集合删除后子弹的位置改变了,如果用LinkedList会不会好点?求救!!!)

坐等求救,java用ssh的时候,Gson解析json有外键的时候报错

java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter? com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:73) com.google.gson.internal.bind.TypeAdapters$1.write(TypeAdapters.java:69) com.google.gson.TypeAdapter$1.write(TypeAdapter.java:191) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:95) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:107) com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:97) com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:61) com.google.gson.Gson.toJson(Gson.java:669) com.google.gson.Gson.toJson(Gson.java:648) com.google.gson.Gson.toJson(Gson.java:603) com.google.gson.Gson.toJson(Gson.java:583) com.gx.lyf.other.controls.NoticeAction.text(NoticeAction.java:96) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

自学MVC做的JAVAEE网站,遇到404求救

![图片说明](https://img-ask.csdn.net/upload/201911/22/1574424804_499937.png) ![图片说明](https://img-ask.csdn.net/upload/201911/22/1574424813_768240.png) 不知道如何解决 很绝望 ![图片说明](https://img-ask.csdn.net/upload/201911/22/1574424869_990973.png) 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/8.5.41 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: May 4 2019 09:17:16 UTC 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 8.5.41.0 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 8.1 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 6.3 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: amd64 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: C:\Program Files\Java\jdk1.8.0\jre 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.8.0-b132 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: D:\JAVA others\apache-tomcat-8.5.41 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: D:\JAVA others\apache-tomcat-8.5.41 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=D:\JAVA others\apache-tomcat-8.5.41 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=D:\JAVA others\apache-tomcat-8.5.41 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=D:\JAVA others\apache-tomcat-8.5.41\webapps 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=D:\JAVA others\apache-tomcat-8.5.41\endorsed 十一月 22, 2019 8:08:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=GBK 十一月 22, 2019 8:08:04 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.8.0/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0/bin/../jre/lib/amd64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0\bin;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;D:\JAVA others\apache-maven-3.6.1\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\AppData\Roaming\npm;E:\Mysql\mysql-5.7.27-winx64\\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Autodesk\Backburner\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\Desktop;;.] 十一月 22, 2019 8:08:04 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-nio-8080"] 十一月 22, 2019 8:08:04 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 十一月 22, 2019 8:08:05 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-nio-8009"] 十一月 22, 2019 8:08:05 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 十一月 22, 2019 8:08:05 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 686 ms 十一月 22, 2019 8:08:05 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service [Catalina] 十一月 22, 2019 8:08:05 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/8.5.41 十一月 22, 2019 8:08:05 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 十一月 22, 2019 8:08:10 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom 警告: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [5,002] milliseconds. 十一月 22, 2019 8:08:10 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\docs] 十一月 22, 2019 8:08:10 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\docs] has finished in [19] ms 十一月 22, 2019 8:08:10 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\examples] 十一月 22, 2019 8:08:10 下午 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 十一月 22, 2019 8:08:10 下午 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 十一月 22, 2019 8:08:10 下午 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@1a91efec') 十一月 22, 2019 8:08:10 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\examples] has finished in [306] ms 十一月 22, 2019 8:08:10 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\host-manager] 十一月 22, 2019 8:08:11 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\host-manager] has finished in [26] ms 十一月 22, 2019 8:08:11 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\manager] 十一月 22, 2019 8:08:11 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\manager] has finished in [31] ms 十一月 22, 2019 8:08:11 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\ROOT] 十一月 22, 2019 8:08:11 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory [D:\JAVA others\apache-tomcat-8.5.41\webapps\ROOT] has finished in [19] ms 十一月 22, 2019 8:08:11 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-nio-8080"] 十一月 22, 2019 8:08:11 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-nio-8009"] 十一月 22, 2019 8:08:11 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in 6062 ms ![图片说明](https://img-ask.csdn.net/upload/201911/22/1574424946_347972.png)![图片说明](https://img-ask.csdn.net/upload/201911/22/1574424951_857846.png)

小白求救:文件下载预览

java如何实现文件下载时预览文件,类似qq邮件那样的预览,图片预览

求救!!!!!HessianProxy cannot connect to xxxxx

我们系统中调用了另一个系统的服务端的Hessian接口,调用正常没有问题,但是运行一段时候(一般为一天两天)后,报连接不上的错误。重启我们的系统应用之后又正常了,一段时候之后又报错。 查了资料这类报错一般都是url不对,这应该是一开始就报错才能归为url地址不对吧。真诡异…… **调用代码如下:** HessianProxyFactory f = new HessianProxyFactory(); f.setOverloadEnabled(true); f.setReadTimeout(10000L); f.setConnectTimeout(10000L); WfWechatHessianService wfWechatService = (WfWechatHessianService) f.create(WfWechatHessianService.class, url); WfWechartRequestInfo info = new WfWechartRequestInfo(); info.setCustNo(custListId); info.setRemark(remark); String requestJson = JSONObject.fromObject(info).toString(); RespInfo respInfo = wfWechatService.addWechart(requestJson); ``` ``` **报错日志:** [ ERROR] [2019-06-21 11:48:56] com.ec.nscs.exception.ExceptionHandle [25] [http-nio-8000-exec-9] - 系统异常{} com.caucho.hessian.client.HessianConnectionException: HessianProxy cannot connect to 'http://x.x.x.xxxx/xxxxService/WfWechatService at com.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:142) at com.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:296) at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:171) at com.sun.proxy.$Proxy188.addWechart(Unknown Source) at com.ec.nscs.controller.WwwwApplyController.WwwwApply(WwwwApplyController.java:83) at com.ec.nscs.controller.WwwwApplyController$$FastClassBySpringCGLIB$$a825dae8.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) at com.ec.nscs.controller.WwwwApplyController$$EnhancerBySpringCGLIB$$5b971647.WwwwApply(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) 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:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:129) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.ec.nscs.filter.EscapeFilter.doFilter(EscapeFilter.java:41) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 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:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.FileNotFoundException: http://x.x.x.xxxx/xxxxService/WfWechatService at sun.reflect.GeneratedConstructorAccessor324.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at com.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:125) ... 82 common frames omitted Caused by: java.io.FileNotFoundException: http://x.x.x.xxxx/xxxxService/WfWechatService at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at com.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:112) ... 82 common frames omitted

大一新生妹子求救:求2的100万次方

求2的100万次方的值,不能使用java中的系统函数,这两天急用,关乎到进项目组锻炼的机会,谢谢大家了。

java.lang.ClassNotFoundException: com.android.id.impl.IdProviderImpl

巨量引擎SDK接入报错java.lang.ClassNotFoundException: com.android.id.impl.IdProviderImpl 求救,非常感谢! ``` 05/15 16:49:59: Launching 'app' on Pixel 2 API 28. $ adb shell am start -n "com.cn.leaf.demo/com.cn.leaf.demo.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Connected to process 6411 on device 'Pixel_2_API_28 [emulator-5554]'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/MultiDex: VM with version 2.1.0 has multidex support Installing application VM has multidex support, MultiDex support library is disabled. W/om.cn.leaf.dem: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking) W/om.cn.leaf.dem: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection) W/om.cn.leaf.dem: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection) W/om.cn.leaf.dem: Accessing hidden method Landroid/widget/TextView;->getTextDirectionHeuristic()Landroid/text/TextDirectionHeuristic; (light greylist, linking) D/TrackerDr: f#init: D/TrackerDr: i#init: E/i#IdentifierManager: reflect exception! java.lang.ClassNotFoundException: com.android.id.impl.IdProviderImpl at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at java.lang.Class.forName(Class.java:378) at com.bytedance.a.i$a.<clinit>(SourceFile:195) at com.bytedance.a.i$a.a(SourceFile:185) at com.bytedance.a.i.a(SourceFile:106) at com.bytedance.a.i.<init>(SourceFile:49) at com.bytedance.a.i.b(SourceFile:41) at com.bytedance.a.i.a(SourceFile:34) at com.bytedance.a.g.a(SourceFile:46) at com.bytedance.a.b.a(SourceFile:33) at com.bytedance.applog.b.i.<init>(SourceFile:67) at com.bytedance.applog.AppLog.init(SourceFile:106) at com.cn.leaf.demo.MainActivity.initConfig(MainActivity.java:133) at com.cn.leaf.demo.MainActivity.PerMissions(MainActivity.java:186) at com.cn.leaf.demo.MainActivity.judgeBrand(MainActivity.java:265) at com.cn.leaf.demo.MainActivity.onCreate(MainActivity.java:56) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.id.impl.IdProviderImpl" on path: DexPathList[[zip file "/data/app/com.cn.leaf.demo-XfKMKxO94jFGo_lzV_gX6A==/base.apk"],nativeLibraryDirectories=[/data/app/com.cn.leaf.demo-XfKMKxO94jFGo_lzV_gX6A==/lib/x86, /data/app/com.cn.leaf.demo-XfKMKxO94jFGo_lzV_gX6A==/base.apk!/lib/x86, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:453)  at java.lang.Class.forName(Class.java:378)  at com.bytedance.a.i$a.<clinit>(SourceFile:195)  at com.bytedance.a.i$a.a(SourceFile:185)  at com.bytedance.a.i.a(SourceFile:106)  at com.bytedance.a.i.<init>(SourceFile:49)  at com.bytedance.a.i.b(SourceFile:41)  at com.bytedance.a.i.a(SourceFile:34)  at com.bytedance.a.g.a(SourceFile:46)  at com.bytedance.a.b.a(SourceFile:33)  at com.bytedance.applog.b.i.<init>(SourceFile:67)  at com.bytedance.applog.AppLog.init(SourceFile:106)  at com.cn.leaf.demo.MainActivity.initConfig(MainActivity.java:133)  at com.cn.leaf.demo.MainActivity.PerMissions(MainActivity.java:186)  at com.cn.leaf.demo.MainActivity.judgeBrand(MainActivity.java:265)  at com.cn.leaf.demo.MainActivity.onCreate(MainActivity.java:56)  at android.app.Activity.performCreate(Activity.java:7136)  at android.app.Activity.performCreate(Activity.java:7127)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:6669)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)  ```

求救:cdh旧版本的pacel无法激活

在把cloudera manager和cdh从5.2.0升级到5.7.5后,现在想把cdh从5.7.5回退到5.2.0, 可是在激活pacel5.2.0版本的时候报错,错误信息如下:org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of com.cloudera.cmf.model.ParcelServicesRestartInfo out of START_ARRAY token at [Source: java.io.StringReader@3699bc13; line: 1, column: 1]。 然后日志没有任何错误显示。cloudera-scm-server 日志信息如下: 2017-02-23 16:20:27,528 INFO 1904297772@scm-web-1566:com.cloudera.parcel.components.ParcelManagerImpl: Determined obsoleted releases ( DbRelease{id=2, product=CDH, version=5.7.5-1.cdh5.7.5.p0.3} ) if release DbRelease{id=1, product=CDH, version=5.2.0-1.cdh5.2.0.p0.36} is activated. ![图片说明](https://img-ask.csdn.net/upload/201702/24/1487900609_651281.png) ![图片说明](https://img-ask.csdn.net/upload/201702/24/1487900630_385030.png)

shiro+cas+velocity:单点登录cas退出之后跳转到应用的另一个页面报错,求救!

shiro+cas+velocity:单点登录cas退出之后跳转到应用的另一个页面报错,求救! 报错信息如下: HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalStateException: org.apache.shiro.session.UnknownSessionException: There is no session with id [dda73627-d317-47f1-a1fb-6bc52431fa86] type Exception report message Request processing failed; nested exception is java.lang.IllegalStateException: org.apache.shiro.session.UnknownSessionException: There is no session with id [dda73627-d317-47f1-a1fb-6bc52431fa86] description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: org.apache.shiro.session.UnknownSessionException: There is no session with id [dda73627-d317-47f1-a1fb-6bc52431fa86] org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:979) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) javax.servlet.http.HttpServlet.service(HttpServlet.java:624) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.jasig.cas.client.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:75) org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:201) org.e3.security.filter.ReAuthenticationFilter.doFilter(ReAuthenticationFilter.java:144) org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76) org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) root cause java.lang.IllegalStateException: org.apache.shiro.session.UnknownSessionException: There is no session with id [dda73627-d317-47f1-a1fb-6bc52431fa86] org.apache.shiro.web.servlet.ShiroHttpSession.getAttribute(ShiroHttpSession.java:133) org.apache.velocity.tools.view.ServletUtils.getMutex(ServletUtils.java:417) org.apache.velocity.tools.view.ViewToolManager.publishToolboxes(ViewToolManager.java:326) org.apache.velocity.tools.view.ViewToolManager.prepareContext(ViewToolManager.java:261) org.apache.velocity.tools.view.ViewToolManager.createContext(ViewToolManager.java:250) org.e3.base.velocity.VelocityLayoutToolboxView.createVelocityContext(VelocityLayoutToolboxView.java:32) org.springframework.web.servlet.view.velocity.VelocityView.renderMergedTemplateModel(VelocityView.java:288) org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1246) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1029) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:973) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) javax.servlet.http.HttpServlet.service(HttpServlet.java:624) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.jasig.cas.client.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:75) org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:201) org.e3.security.filter.ReAuthenticationFilter.doFilter(ReAuthenticationFilter.java:144) org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76) org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) root cause org.apache.shiro.session.UnknownSessionException: There is no session with id [dda73627-d317-47f1-a1fb-6bc52431fa86] org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170) org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236) org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222) org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118) org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:148) org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:152) org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:249) org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) org.apache.shiro.web.servlet.ShiroHttpSession.getAttribute(ShiroHttpSession.java:131) org.apache.velocity.tools.view.ServletUtils.getMutex(ServletUtils.java:417) org.apache.velocity.tools.view.ViewToolManager.publishToolboxes(ViewToolManager.java:326) org.apache.velocity.tools.view.ViewToolManager.prepareContext(ViewToolManager.java:261) org.apache.velocity.tools.view.ViewToolManager.createContext(ViewToolManager.java:250) org.e3.base.velocity.VelocityLayoutToolboxView.createVelocityContext(VelocityLayoutToolboxView.java:32) org.springframework.web.servlet.view.velocity.VelocityView.renderMergedTemplateModel(VelocityView.java:288) org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1246) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1029) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:973) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) javax.servlet.http.HttpServlet.service(HttpServlet.java:624) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.jasig.cas.client.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:75) org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:201) org.e3.security.filter.ReAuthenticationFilter.doFilter(ReAuthenticationFilter.java:144) org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76) org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.70 logs. Apache Tomcat/7.0.70

求救啊,这边有java web的同学么,这边下图可用datagrid么,怎么用,用什么比较好呢

![图片说明](https://img-ask.csdn.net/upload/201508/25/1440496191_269588.png)

tomcat部署的web端服务器连接mysql,应用程序连接服务器给出的http接口

求救 1、tomcat部署的web端服务器连接mysql,应用程序连接服务器给出的http接口,然后应用程序就可以通过和服务器交互来使用mysql里面的数据,这样理解是对的吗? 2、如果这是对的,那服务器是不是就要封装好数据库连接类、数据增删查改类?这样,应用程序就可以只需要传参数就可以使用数据了? 3、在服务器端封装好数据库连接类的话:那不是每次应用程序使用数据的时候,服务器都要连接又断开数据库了吗? 4、数据库连接池到底干嘛用的,能不能通俗点说啊? 5、要是有一个让我一看就明白的简单例子就更好了。。。![图片说明](http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/11.gif)

各位高手求救:ASP.NET MVC 日期范围 自定义验证特性如何实现呢?

各位高手求救:ASP.NET MVC 日期范围 自定义验证特性如何实现呢? 想实现一个日期范围自定义验证特性 ASP.NET MVC 自带的RangeAttribute验证不好使? 比如: [Display(Name="出生日期")] [Required(ErrorMessage="{0}不能为空!")] [Range(typeof(DateTime),"1980-01-01","2000-12-31",ErrorMessage="{0}必须介于{1}和{2}之间")] public DateTime? BirthDate {get;set;} 这个验证我在注册页面输入1992-03-23报该日期格式不对,也不知道是怎么回事,初学ASP.NET MVC,请各位大侠帮小弟解决一下,小弟在这里感谢了!急等.....

求救:kali数据库启动后依然无法打开metasploit

在终端输入 msfconsole后出现: A database appears to be already configured, skipping initialization /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- msf/core/payload/firefox (LoadError) from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core/payload.rb:32:in `<class:Payload>' from /usr/share/metasploit-framework/lib/msf/core/payload.rb:14:in `<module:Msf>' from /usr/share/metasploit-framework/lib/msf/core/payload.rb:5:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core/exploit/php_exe.rb:13:in `<module:PhpEXE>' from /usr/share/metasploit-framework/lib/msf/core/exploit/php_exe.rb:10:in `<module:Msf>' from /usr/share/metasploit-framework/lib/msf/core/exploit/php_exe.rb:9:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core/exploit/mixins.rb:18:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core/exploit.rb:224:in `<class:Exploit>' from /usr/share/metasploit-framework/lib/msf/core/exploit.rb:30:in `<module:Msf>' from /usr/share/metasploit-framework/lib/msf/core/exploit.rb:5:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core/auxiliary/ntp.rb:3:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core/auxiliary/mixins.rb:28:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core/auxiliary.rb:16:in `<class:Auxiliary>' from /usr/share/metasploit-framework/lib/msf/core/auxiliary.rb:14:in `<module:Msf>' from /usr/share/metasploit-framework/lib/msf/core/auxiliary.rb:4:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/msf/core.rb:66:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' from /usr/share/metasploit-framework/lib/metasploit/framework.rb:25:in `<top (required)>' from /usr/share/metasploit-framework/lib/metasploit/framework/database.rb:1:in `require' from /usr/share/metasploit-framework/lib/metasploit/framework/database.rb:1:in `<top (required)>' from /usr/share/metasploit-framework/lib/metasploit/framework/parsed_options/base.rb:17:in `require' from /usr/share/metasploit-framework/lib/metasploit/framework/parsed_options/base.rb:17:in `<top (required)>' from /usr/share/metasploit-framework/lib/metasploit/framework/parsed_options/console.rb:2:in `require' from /usr/share/metasploit-framework/lib/metasploit/framework/parsed_options/console.rb:2:in `<top (required)>' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:263:in `require' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:263:in `const_get' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:263:in `block in constantize' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `each' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `inject' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `constantize' from /usr/share/metasploit-framework/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/string/inflections.rb:66:in `constantize' from /usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:73:in `parsed_options_class' from /usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:69:in `parsed_options' from /usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:47:in `require_environment!' from /usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:81:in `start' from /usr/bin/msfconsole:48:in `<main>' root@kali:~#

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

C++(数据结构与算法)78:---分而治之

一、分而治之的思想 分而治之方法与软件设计的模块化方法非常相似 分而治之通常不用于解决问题的小实例,而要解决一个问题的大实例。一般步骤为: ①把一个大实例分为两个或多个更小的实例 ②分别解决每个小实例 ③把这些小实例的解组合成原始大实例的解 二、实际应用之找出假币 问题描述 一个袋子有16个硬币,其中只有一个是假币,这个假币比其他的真币重量轻(其他所有真币的重量都是相同的)...

springboot+jwt实现token登陆权限认证

一 前言 此篇文章的内容也是学习不久,终于到周末有时间码一篇文章分享知识追寻者的粉丝们,学完本篇文章,读者将对token类的登陆认证流程有个全面的了解,可以动态搭建自己的登陆认证过程;对小项目而已是个轻量级的认证机制,符合开发需求;更多精彩原创内容关注公主号知识追寻者,读者的肯定,就是对作者的创作的最大支持; 二 jwt实现登陆认证流程 用户使用账号和面发出post请求 服务器接受到请求后使用私...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

win10暴力查看wifi密码

刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

早上躺尸,晚上干活:硅谷科技公司这么流行迟到?

硅谷科技公司上班时间OPEN早已不是什么新鲜事,早九晚五是常态,但有很多企业由于不打卡,员工们10点、11点才“姗姗来迟”的情况也屡见不鲜。 这种灵活的考勤制度为人羡慕,甚至近年来,国内某些互联网企业也纷纷效仿。不过,硅谷普遍弹性的上班制度是怎么由来的呢?这种“流行性迟到”真的有那么轻松、悠哉吗? 《动态规划专题班》 课程试听内容: 动态规划的解题要领 动态规划三大类 求最值/计数/可行性 常...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

立即提问
相关内容推荐