List操作错误Exception in thread "main" java.lang.IllegalStateException
Iterator<Teacher> iter = teacherList.iterator();
while(iter.hasNext()){
    Teacher teacher =iter.next();
    //①查找老师的最大上限值,如果该老师已经达到上限了,则将该老师从List中拿出,不予安排
    if(teacher.getMaxnum()<=teacher.getRealnum()){
    iter.remove();
    teacherList.remove(teacher);
    }
    //②找到该考试的时间点,如果该考试桶中存在与该老师的ID则将该老师摘除,不予考虑.
    if(examBarrelDao.isRelated(exam,teacher)){
    iter.remove();
    teacherList.remove(teacher);
    }
    }
    //③按照监考上限减去监考下限差额最大的顺序排列,取该老师序列的第一个为最优老师。
    for(int i=0;i<teacherList.size()-1;i++){
        for (int j=i+1;j<teacherList.size();j++){
        Teacher teacher = new Teacher();
        if(teacherList.get(i).getMaxnum()-teacherList.get(i).getRealnum()
                                <teacherList.get(j).getMaxnum()-teacherList.get(j).getRealnum()){
                teacher =teacherList.get(i);
                teacherList.set(i, teacherList.get(j));
                teacherList.set(j, teacher);
                }
            }

我将得到的List判断以后,remove了其中的不符合条件的teacher,然后将List中剩余的teacher重新按照大小进行了一次排序,但是有时报 Exception in thread "main" java.lang.IllegalStateException
at java.util.AbstractList$Itr.remove(Unknown Source)
at com.sdjzglxy.jwMis.help.ConditionalJudge.listTeacher(ConditionalJudge.java:229)
at com.sdjzglxy.jwMis.help.ConditionalJudge.teacherChoiceForSecond(ConditionalJudge.java:162)
at com.sdjzglxy.jwMis.action.ArrayExam.arraySecondTeacher(ArrayExam.java:132)
at com.sdjzglxy.jwMis.action.ArrayExam.main(ArrayExam.java:159)
有时对有时错,我想问一下,该如何解决这个问题……

1个回答

iter.remove();
teacherList.remove(teacher);

你删除两次,只用iter.remove(); 就行了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Java中遇到的一个异常Exception in thread "main" java.lang.NullPointerException

import java.util.*; public class NewHashTest { public static void main(String[] args) { HashMap hash = new HashMap(); Emp emp1 = new Emp("laoda","111",123f); Emp emp2 = new Emp("laoer","222",234f); Emp emp3 = new Emp("laosan","333",5466f); hash.put(111,emp1); hash.put(222,emp2); hash.put(333,emp3); if(hash.containsKey(111)) { Emp em = (Emp)hash.get(111); em.info();//可以正常显示 } Iterator iter = hash.keySet().iterator(); while(iter.hasNext()) { String key = iter.next().toString(); Emp ems = (Emp)hash.get(key); ems.info();//这里会报错 } } } class Emp { String name; String number; float slary; public void info() { System.out.println("名字叫:"+name); System.out.println("编号为:"+number); System.out.println("薪水是:"+slary); } public Emp(String name,String number,float slary) { this.name = name; this.number = number; this.slary = slary; } } 会在ems.info();一行报一个Exception in thread "main" java.lang.NullPointerException的错误,是不是传入的KEY类型有问题,还是什么别的问题,求指点。

Java反射 java.lang.NoSuchMethodException

``` public static void testTT() throws Exception { Class<?> clazz = Class.forName("reflect.Person"); // 获得构造器 Constructor<?> constructor = clazz.getDeclaredConstructor(new Class[] {}); // 根据类的默认构造器来获得一个对象 Object instance = constructor.newInstance(new Object[] {}); System.out.println(instance); Constructor<?> constructor2 = clazz .getDeclaredConstructor(new Class[] { Integer.class, String.class, Integer.class }); Object instance2 = constructor2.newInstance(new Object[]{1,"Tom",21}); System.out.println(instance2); } ``` ``` public Person(int id, String name, int age) { super(); this.id = id; this.name = name; this.age = age; } ``` ``` Exception in thread "main" java.lang.NoSuchMethodException: reflect.Person.<init>(java.lang.Integer, java.lang.String, java.lang.Integer) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) ```

JAVA报错:Exception in thread "main"……求帮助?

题目要求: (1)创建MaxArray类:  声明1个一维数组的成员变量,例如:int array[ ]; //一维数组  设置有参构造方法,如:MaxArray(int n){ …… } //有参构造方法,为成员变量创建长为n的一维数组  设置无参构造方法:通过键盘输入数组长度n,然后为成员变量创建长度为n的数组。  设置修改数组元素值的成员方法:int setArray(){ …//输入数组各元素的值 }  设置查找并返回数组最大值的成员方法:int findMax( ){……}  设置输出数组所有元素的成员方法:void output( ){……} (2)创建主类CreateArray:生成MaxArray类对象,并调用相关成员方法求数组最大值,并输出。 代码块 ``` import java.util.*; class MaxArray{ int len; int array[]; //有参构造方法 MaxArray(int n){ len=n; int array[]=new int[len]; } //无参构造方法 MaxArray(){ Scanner num=new Scanner(System.in); len=num.nextInt(); int array[]=new int[len]; } //修改数组元素值的成员方法 void setArray(){ Scanner num=new Scanner(System.in); for(int i=0;i<len;i++){ array[i]=num.nextInt(); } } //查找并返回数组最大值的成员方法 int findMax(){ int max=array[0]; for(int i=0;i<len;i++){ if(array[0]<array[i]){ max=array[i]; } } return max; } //输出数组所有元素的成员方法 void output(){ for(int i=0;i<len;i++){ System.out.printf("\t"+array[i]); if(len%5==0){ System.out.println(); } } } } public class CreateArray { public static void main(String[] args) { // TODO Auto-generated method stub int max; //生成MaxArray类对象 MaxArray arr=new MaxArray(); arr.setArray(); arr.output(); max=arr.findMax(); System.out.println("the Max is:"+max); } } ``` 无论是调用有参构造方法还是无参构造方法都是这样报错: ![图片说明](https://img-ask.csdn.net/upload/201706/25/1498360766_353049.png) ![图片说明](https://img-ask.csdn.net/upload/201706/25/1498360776_677745.png) ![图片说明](https://img-ask.csdn.net/upload/201706/25/1498360787_689460.png) ![图片说明](https://img-ask.csdn.net/upload/201706/25/1498360800_738783.png) 请问是哪里出了问题

Runnable 中抛出java.lang.ArrayIndexOutOfBoundsException: -1

[已解决] SimpleDateFormat.format并发调用会有问题private SimpleDateFormat.StringBuffer format(Date date, StringBuffer toAppendTo, FieldDelegate delegate) 里面用了calendar.setTime(date);这玩意是全局的,后面还会调用它,所以并发时候会出问题。 Random中protected Random.next(int bits);采用AtomicLong的CAS操作并发时候不会出问题。 ------------------------------------------------------------------------------ 每个Task有自己的ArrayList实例,在多线程情况下每个ArrayList实例应该不存在并发写入啊,为没什么还报ArrayIndexOutOfBoundsException: -1 求助大神,网上找了好久没结果。 ``` import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static java.lang.System.out; public class TestArrayList { public static void main(String[] args){ TestArrayList t= new TestArrayList(); t.testInsertRows(); } private static int millisecondOf1Day= 1000*3600*24; private static int millisecondOf5Min= 1000*60*5; private static final SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private final ExecutorService pool= Executors.newFixedThreadPool(8); public void testInsertRows(){ Random random= new Random(); int taskId= 0; for(int i=0; i< 8; i++){ taskId++; pool.submit(new Task(taskId, 10000, null)); } out.println("all submited!"); } static class Task implements Runnable{ private Integer id; private List<Bean> list; private int rowCount; private int count=0; private Random random; public Task(Integer id, Integer rowCount, Random random){ this.id= id; this.list= new ArrayList<>(rowCount+1); this.rowCount= rowCount; // this.random= random; this.random= new Random(); } @Override public void run() { out.println("task:"+id+" is running! "+Thread.currentThread()); try{ for(int j=0; j< rowCount; j++ ){ Long randomTime= random.nextLong(); Date validityDate= new Date(randomTime- millisecondOf1Day), startDate= new Date(randomTime), endDate= new Date(randomTime+ 2*millisecondOf1Day); Bean bean = new Bean(); bean.setField0("K0000033"); bean.setField1("0001"); bean.setField2(sdf.format(validityDate)); bean.setField3(new Double(0.0).toString()); bean.setField4(sdf.format(startDate)); bean.setField5(sdf.format(endDate)); list.add(bean); } out.println("list is prepared in thread:"+id); Thread.sleep(millisecondOf5Min);// out.println(count+" rows has been inserted in thread:"+id); }catch (Exception e) { synchronized (out) { out.println("task:"+id+" in error"+Thread.currentThread()); e.printStackTrace(); out.println("task:"+id+" error info print completed"); } } } } } class Bean{ private String field0; private String field1; private String field2; private String field3; private String field4; private String field5; private String field6; /** * @return the field0 */ public String getField0() { return field0; } /** * @param field0 the field0 to set */ public void setField0(String field0) { this.field0 = field0; } /** * @return the field1 */ public String getField1() { return field1; } /** * @param field1 the field1 to set */ public void setField1(String field1) { this.field1 = field1; } /** * @return the field2 */ public String getField2() { return field2; } /** * @param field2 the field2 to set */ public void setField2(String field2) { this.field2 = field2; } /** * @return the field3 */ public String getField3() { return field3; } /** * @param field3 the field3 to set */ public void setField3(String field3) { this.field3 = field3; } /** * @return the field4 */ public String getField4() { return field4; } /** * @param field4 the field4 to set */ public void setField4(String field4) { this.field4 = field4; } /** * @return the field5 */ public String getField5() { return field5; } /** * @param field5 the field5 to set */ public void setField5(String field5) { this.field5 = field5; } /** * @return the field6 */ public String getField6() { return field6; } /** * @param field6 the field6 to set */ public void setField6(String field6) { this.field6 = field6; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "Bean [field0=" + field0 + ", field1=" + field1 + ", field2=" + field2 + ", field3=" + field3 + ", field4=" + field4 + ", field5=" + field5 + ", field6=" + field6 + "]"; } } ``` task:1 is running! Thread[pool-1-thread-1,5,main] task:4 is running! Thread[pool-1-thread-4,5,main] task:3 is running! Thread[pool-1-thread-3,5,main] task:2 is running! Thread[pool-1-thread-2,5,main] task:5 is running! Thread[pool-1-thread-5,5,main] task:6 is running! Thread[pool-1-thread-6,5,main] all submited! task:7 is running! Thread[pool-1-thread-7,5,main] task:8 is running! Thread[pool-1-thread-8,5,main] task:7 in errorThread[pool-1-thread-7,5,main] java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Calendar.getDisplayName(Unknown Source) at java.text.SimpleDateFormat.subFormat(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.DateFormat.format(Unknown Source) at com.haimian.test.concurrent.TestArrayList$Task.run(TestArrayList.java:64) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) task:7 error info print completed task:8 in errorThread[pool-1-thread-8,5,main] java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Calendar.getDisplayName(Unknown Source) at java.text.SimpleDateFormat.subFormat(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.DateFormat.format(Unknown Source) at com.haimian.test.concurrent.TestArrayList$Task.run(TestArrayList.java:65) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) task:8 error info print completed task:4 in errorThread[pool-1-thread-4,5,main] java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Calendar.getDisplayName(Unknown Source) at java.text.SimpleDateFormat.subFormat(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.DateFormat.format(Unknown Source) at com.haimian.test.concurrent.TestArrayList$Task.run(TestArrayList.java:62) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) task:4 error info print completed task:1 in errorThread[pool-1-thread-1,5,main] java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Calendar.getDisplayName(Unknown Source) at java.text.SimpleDateFormat.subFormat(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.DateFormat.format(Unknown Source) at com.haimian.test.concurrent.TestArrayList$Task.run(TestArrayList.java:64) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) task:1 error info print completed task:5 in errorThread[pool-1-thread-5,5,main] java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Calendar.getDisplayName(Unknown Source) at java.text.SimpleDateFormat.subFormat(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.DateFormat.format(Unknown Source) at com.haimian.test.concurrent.TestArrayList$Task.run(TestArrayList.java:65) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) task:5 error info print completed task:3 in errorThread[pool-1-thread-3,5,main] java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Calendar.getDisplayName(Unknown Source) at java.text.SimpleDateFormat.subFormat(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.DateFormat.format(Unknown Source) at com.haimian.test.concurrent.TestArrayList$Task.run(TestArrayList.java:64) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) task:3 error info print completed task:6 in errorThread[pool-1-thread-6,5,main] java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Calendar.getDisplayName(Unknown Source) at java.text.SimpleDateFormat.subFormat(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.SimpleDateFormat.format(Unknown Source) at java.text.DateFormat.format(Unknown Source) at com.haimian.test.concurrent.TestArrayList$Task.run(TestArrayList.java:64) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) task:6 error info print completed list is prepared in thread:2

java.lang.ExceptionInInitializerError

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/![![图片说明](https://img-ask.csdn.net/upload/201708/08/1502204324_25919.png)图片说明](https://img-ask.csdn.net/upload/201708/08/1502204269_224607.png)aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:jdbc.properties</value> </property> </bean> <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <!-- 目录及子目录的映射文件的路径 --> <property name="mappingDirectoryLocations"> <list> <value>classpath:com/itheima11/gyl/domain</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <!-- <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> --> <!-- 事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <context:component-scan base-package="com.itheima11.gyl"></context:component-scan> <!-- proxy-target-class="true" 如果目标类实现了接口,也可以用cglib --> <tx:annotation-driven transaction-manager="transactionManager"/> </beans>

Exception in thread "AWT-EventQueue-0"

``` import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.File; import java.io.IOException; public class PipeFilterTestGui extends JPanel { private JScrollPane btnPane; private JSplitPane splitPane; private JSplitPane rightSplitPane; private JTextArea originalTxt; private JTextArea resultTxt; private JScrollPane originPane; private JScrollPane resultPane; private JLabel filelbl; private JPanel buttonPanel; private JComboBox cmbFileList; static final String PROCESS = "Process"; static final String EXIT = "Exit"; static final String ORIGINALFILES = "OriginalFiles/"; static final Dimension minimumSize = new Dimension(230, 200); public PipeFilterTestGui() { super(new GridLayout(1, 0)); resultTxt = new JTextArea("Encrypted File Text\n\n", 6, 20); originalTxt = new JTextArea("Original File Text: \n\n", 6, 20); buildUpScrollGUI(); } private void buildUpScrollGUI() { // Setup buttonPanel, which contains all buttons and // will be used in btnPane below setUpButtonPanel(); btnPane = new JScrollPane(buttonPanel); btnPane.setMinimumSize(minimumSize); resultPane = new JScrollPane(resultTxt); originPane = new JScrollPane(originalTxt); rightSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); rightSplitPane.setLeftComponent(originPane); rightSplitPane.setRightComponent(resultPane); rightSplitPane.setDividerLocation(190); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setLeftComponent(btnPane); splitPane.setRightComponent(rightSplitPane); splitPane.setDividerLocation(220); splitPane.setPreferredSize(new Dimension(600, 250)); add(splitPane); setSize(new Dimension(600, 400)); setVisible(true); } private void setUpButtonPanel() { cmbFileList = new JComboBox(); String[] cl = extractFileList(); setupFileList(cmbFileList, cl); filelbl = new JLabel("Files:"); // Create buttons JButton srchButton = new JButton(PROCESS); srchButton.setMnemonic(KeyEvent.VK_S); JButton exitButton = new JButton(EXIT); exitButton.setMnemonic(KeyEvent.VK_X); ButtonListener btnListener = new ButtonListener(); // add action Listener srchButton.addActionListener(btnListener); exitButton.addActionListener(btnListener); buttonPanel = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); buttonPanel.setLayout(gridbag); GridBagConstraints gbc = new GridBagConstraints(); buttonPanel.add(filelbl); buttonPanel.add(cmbFileList); buttonPanel.add(srchButton); buttonPanel.add(exitButton); gbc.insets.top = 5; gbc.insets.bottom = 5; gbc.insets.left = 5; gbc.insets.right = 5; gbc.anchor = GridBagConstraints.EAST; gbc.gridx = 0; gbc.gridy = 0; gridbag.setConstraints(filelbl, gbc); gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 1; gbc.gridy = 0; gridbag.setConstraints(cmbFileList, gbc); gbc.anchor = GridBagConstraints.EAST; gbc.gridx = 0; gbc.gridy = 1; gbc.insets.left = 2; gbc.insets.right = 2; gbc.insets.top = 25; gbc.anchor = GridBagConstraints.EAST; gbc.gridx = 0; gbc.gridy = 3; gridbag.setConstraints(srchButton, gbc); gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 1; gbc.gridy = 3; gridbag.setConstraints(exitButton, gbc); } /* ========================================= */ /* Get a selected file name from User GUI */ /* ========================================= */ public String getSelectedFile() { return (String) cmbFileList.getSelectedItem(); } /* ================================================ */ /* Extract file names from a diectory on your */ /* computer */ /* ================================================ */ public String[] extractFileList() { File f = new File(ORIGINALFILES); String[] fileNames = f.list(); return fileNames; } /* ============================================== */ /* Add car list to combox cmbFileList. Both */ /* objects cmbFileList and files are passed */ /* in from parameters. */ /* ============================================== */ public void setupFileList(JComboBox cmbFileList, String[] files) { for (int k = 0; k < files.length; k++) { cmbFileList.addItem(files[k]); } } class ButtonListener implements ActionListener { String carPrice; public void actionPerformed(ActionEvent e) { String searchResult = null; if (e.getActionCommand().equals(EXIT)) { System.exit(1); } if (e.getActionCommand().equals(PROCESS)) { String selectedFile = getSelectedFile(); try { originalTxt.append("File Name: " + selectedFile + "\n\n"); resultTxt.append("From file: " + selectedFile + "\n"); AssemblyOfPipeLines apline = new AssemblyOfPipeLines(); apline.assembly(selectedFile, originalTxt, resultTxt); } catch (IOException ex) { } } } } // End of class ButtonListener private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("Pipes and Filters Architecture demo- Legacy File Update"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); PipeFilterTestGui newContentPane = new PipeFilterTestGui(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); frame.pack(); frame.setVisible(true); } static public void main(String argv[]) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } ``` Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at PipeFilterTestGui.setupFileList(PipeFilterTestGui.java:150) at PipeFilterTestGui.setUpButtonPanel(PipeFilterTestGui.java:67) at PipeFilterTestGui.buildUpScrollGUI(PipeFilterTestGui.java:37) at PipeFilterTestGui.<init>(PipeFilterTestGui.java:30) at PipeFilterTestGui.createAndShowGUI(PipeFilterTestGui.java:191) at PipeFilterTestGui.access$2(PipeFilterTestGui.java:185) at PipeFilterTestGui$1.run(PipeFilterTestGui.java:205) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 还有其他几个类。 需要上传吗?

使用dbcp连接数据库报错java.lang.NumberFormatException: For input string: "20 "?

内容: 换了一个工程就可以跑得动 报错: ``` java.lang.NumberFormatException: For input string: "20 " at java.base/java.lang.NumberFormatException.forInputString(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at org.apache.commons.dbcp.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:228) at com.ekihin.part01.day20.DBCPDemo.<clinit>(DBCPDemo.java:21) at com.ekihin.part01.day20.DBCPDemoTest.main(DBCPDemoTest.java:15) Exception in thread "main" java.lang.NullPointerException at com.ekihin.part01.day20.DBCPDemo.getConnection(DBCPDemo.java:29) at com.ekihin.part01.day20.DBCPDemoTest.main(DBCPDemoTest.java:15) ``` 类: ``` import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class DBCPDemoTest { public static void main(String[] args) throws Exception { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; String sql = "Update emp set ename = ? where ename = ? "; conn = DBCPDemo.getConnection(); ps = conn.prepareStatement(sql); ps.setObject(1, "彭奕滨"); ps.setObject(2, "ekihin"); int rows = 0; rows = ps.executeUpdate(); System.out.println(rows); DBCPDemo.closeAll(conn, ps, rs); } } ``` ``` import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSourceFactory; public class DBCPDemo { private static DataSource ds = null; static { Properties pt = new Properties(); try { pt.load(DBCPDemo.class.getClassLoader().getResourceAsStream("dbcpconfig.properties")); ds = BasicDataSourceFactory.createDataSource(pt); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static Connection getConnection() throws SQLException{ //返回一个连接对象,不要用DriverManager获取,而是连接池中获取 return ds.getConnection(); } //关闭所有资源的统一代码 public static void closeAll(Connection conn,Statement st,ResultSet rs){ //负责关闭 if(conn != null){ try { conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(st != null){ try { st.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(rs != null){ try { rs.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } ```

一个简单的学生信息管理系统,类中报错 java.lang.NullPointerException

/* * 学生类 * 姓名,学号,性别,年级,班级,总分 */ public class Student implements Comparable<Student> { private String name; private String num; private String sex; private String grade; private String banji; private String score; public Student(String name, String num, String sex, String grade, String banji, String score) { this.name = name; this.num = num; this.sex = sex; this.grade = grade; this.banji = banji; this.score = score; } public Student() { this.name = "未知"; this.num = "未知"; this.sex = "未知"; this.grade = "未知"; this.banji = "未知"; this.score = "未知"; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNum() { return num; } public void setNum(String num) { this.num = num; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getGrade() { return grade; } public void setGrade(String grade) { this.grade = grade; } public String getBanji() { return banji; } public void setBanji(String banji) { this.banji = banji; } public String getScore() { return score; } public void setScore(String score) { this.score = score; } public String getStudent() { return name+" "+num+" "+sex+" "+grade+" "+banji+" "+score+"\r\n"; } public int compareTo(Student other) { if (Integer.parseInt(num)<Integer.parseInt(other.num)) //学号从小到大排列 return - 1 ; if (Integer.parseInt(num)>Integer.parseInt(other.num)) return 1 ; return 0 ; } } import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class Sort { private File f; public Sort(File f) { this.f = f; } public Sort() { } public List<Student> filereader() throws IOException{//对原TXT文件的读取 FileReader fr = new FileReader(f); BufferedReader cin=new BufferedReader(fr); List<Student> l=new ArrayList<Student>(); Student[] student=new Student[1000]; String s="";int i=0; while((s=cin.readLine())!=null) { student[i]=new Student(); String[] a=new String[6]; a=s.split(" "); student[i].setName(a[0]); student[i].setNum(a[1]); student[i].setSex(a[2]);; student[i].setGrade(a[3]); student[i].setBanji(a[4]); student[i].setScore(a[5]); i++; l.add(student[i]); } cin.close(); fr.close(); return l; } public void Sortsex(String sex,File f1) throws IOException{//指定性別后按学号排序 FileWriter fw = new FileWriter(f1); @SuppressWarnings("resource") BufferedWriter cout=new BufferedWriter(fw); List<Student> a=new ArrayList<Student>(); List<Student> b=new ArrayList<Student>(); a=filereader(); int i=0; Student[] student=new Student[1000]; for(int t=0;t<a.size();t++){ if(a.get(t).getSex().equals(sex)){ /*******这行报错*********/ student[i]=a.get(t); i++; } } Arrays.sort(student); for(int m=0;m<i-1;m++) { cout.write(student[i].getStudent()); } System.out.println("已生成文件"); } } Exception in thread "main" java.lang.NullPointerException at Info.main(Info.java:31)

java.lang.OutOfMemory异常

各位大神,小生在做excel导出的时候遇见了这么一个问题,作为实习生实在是莫名其妙,求各位大神帮个小忙。 java.lang.OutOfMemoryError: GC overhead limit exceeded 16:31:22.700 [nioEventLoopGroup-2-8] WARN io.netty.channel.nio.NioEventLoop - Unexpected exception in the selector loop. java.lang.OutOfMemoryError: GC overhead limit exceeded at java.util.ArrayList.iterator(ArrayList.java:814) ~[na:1.7.0_80] at sun.nio.ch.WindowsSelectorImpl.updateSelectedKeys(WindowsSelectorImpl.java:496) ~[na:1.7.0_80] at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:172) ~[na:1.7.0_80] at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87) ~[na:1.7.0_80] at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98) ~[na:1.7.0_80] at io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:622) ~[netty-transport-4.0.32.Final.jar:4.0.32.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:310) ~[netty-transport-4.0.32.Final.jar:4.0.32.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-common-4.0.32.Final.jar:4.0.32.Final] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-common-4.0.32.Final.jar:4.0.32.Final] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80] 16:31:23.334 [Thread-6] ERROR o.a.e.i.a.AcquireTimerJobsRunnable - exception during timer job acquisition: GC overhead limit exceeded java.lang.OutOfMemoryError: GC overhead limit exceeded at java.util.Arrays.copyOf(Arrays.java:2367) ~[na:1.7.0_80] at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130) ~[na:1.7.0_80] at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114) ~[na:1.7.0_80] at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415) ~[na:1.7.0_80] at java.lang.StringBuilder.append(StringBuilder.java:132) ~[na:1.7.0_80] at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:171) ~[mybatis-3.3.0.jar:3.3.0] at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49) ~[mybatis-3.3.0.jar:3.3.0] at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122) ~[mybatis-3.3.0.jar:3.3.0] at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:212) ~[mybatis-3.3.0.jar:3.3.0] at org.apache.ibatis.executor.CachingExecutor.createCacheKey(CachingExecutor.java:139) ~[mybatis-3.3.0.jar:3.3.0] at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81) ~[mybatis-3.3.0.jar:3.3.0] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:120) ~[mybatis-3.3.0.jar:3.3.0] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113) ~[mybatis-3.3.0.jar:3.3.0] at org.activiti.engine.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:438) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:429) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:424) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:411) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.persistence.entity.JobEntityManager.findNextTimerJobsToExecute(JobEntityManager.java:157) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.cmd.AcquireTimerJobsCmd.execute(AcquireTimerJobsCmd.java:45) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.cmd.AcquireTimerJobsCmd.execute(AcquireTimerJobsCmd.java:29) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) ~[activiti-spring-5.19.0.2.jar:5.19.0.2] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.2.2.RELEASE.jar:4.2.2.RELEASE] at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) ~[activiti-spring-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at org.activiti.engine.impl.asyncexecutor.AcquireTimerJobsRunnable.run(AcquireTimerJobsRunnable.java:52) ~[activiti-engine-5.19.0.2.jar:5.19.0.2] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80] /report/collectionPaymentClass-report-down java.lang.OutOfMemoryError: GC overhead limit exceeded

Servlet /claim threw load() exception java.lang.RuntimeException: 启动环境报错,如何解决?

严重: Servlet /claim threw load() exception java.lang.RuntimeException: 无法获取environmenTypeCode,请在Web应用容器启动文件中添加environmenTypeCode变量或在调用前使用setEnvironmenTypeCode方法进行环境变量初始化! at com.sinosoft.platform.ipservice.IPService.initEnvironmenTypeCode(IPService.java:462) at com.sinosoft.platform.ipservice.IPService.getIpInfoBeanByKeyAndNetType(IPService.java:429) at com.sinosoft.platform.ipservice.IpSelectAction.getIpInfoBeanByKeyAndNetType(IpSelectAction.java:86) at cn.com.cis.claim.car.wtc.WTCServlet.init(WTCServlet.java:51) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) 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:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2019-3-28 13:55:59 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2019-3-28 13:55:59 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2019-3-28 13:55:59 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/15 config=null 2019-3-28 13:55:59 org.apache.catalina.startup.Catalina start 信息: Server startup in 55286 ms 2019-3-28 13:57:31 org.apache.coyote.http11.Http11Protocol pause 信息: Pausing Coyote HTTP/1.1 on http-8080 2019-3-28 13:57:32 org.apache.catalina.core.StandardService stop 信息: Stopping service Catalina 2019-3-28 13:57:38 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2019-3-28 13:57:40 org.apache.coyote.http11.Http11Protocol destroy 信息: Stopping Coyote HTTP/1.1 on http-8080 ![图片说明](https://img-ask.csdn.net/upload/201903/28/1553756397_999041.png)

多数据源spring 报java.lang.NullPointerException

在调用test.java的时候就会报 Exception in thread "main" java.lang.NullPointerException at cn.m_solution.mds.mds40.service.MDS40T01Service.getStudent(MDS40T01Service.java:23) at cn.m_solution.mds.mds40.service.test.main(test.java:13) 请大家一定帮忙,已经弄了两天了 [color=red]moduleContext-sys.xml:[/color] <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- +++++++++++++++++++++++++++++++++++++++++ --> <!-- 系统关联设定(必须) --> <!-- +++++++++++++++++++++++++++++++++++++++++ --> <bean id="ApplicationInfo" class="net.uniuvo.webridger.beans.ApplicationInfo"> <!-- 应用系统名称 --> <property name="applicationName" value="mds" /> <!-- 允许直接访问的Action列表 --> <property name="directAccessActions"> <list> <value>mds00.do</value> <value>/mds13.do</value> <value>/mds40.do</value> </list> </property> <!-- 禁止访问的扩展名列表 --> <property name="prohibitedExtensions"> <list> <value>js</value> <value>css</value> <value>jsp</value> <value>html</value> </list> </property> <!-- 禁止访问的扩展名中例外的文件列表 --> <property name="restrictionEscapeFiles"> <list> <value>/pages/index.html</value> <value>/pages/mds40/mds40s00.jsp</value> </list> </property> </bean> <!-- +++++++++++++++++++++++++++++++++++++++++ --> <!-- 数据库关联设定(必须) --> <!--此bean告诉Spring去哪找数据库的配置信息,因为有此Bean才出现下面用${}标记来取变量的语句--> <!-- +++++++++++++++++++++++++++++++++++++++++ --> <!-- 这里定义了ibatis的配置文件所在的位置 --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>/WEB-INF/config/jdbc/jdbc.properties</value> </property> </bean> <!-- <bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">--> <bean id="ds0" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName0}" /> <property name="url" value="${jdbc.url0}" /> <property name="username" value="${jdbc.username0}" /> <property name="password" value="${jdbc.password0}" /> </bean> <bean id="ds1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName1}" /> <property name="url" value="${jdbc.url1}" /> <property name="username" value="${jdbc.username1}" /> <property name="password" value="${jdbc.password1}" /> </bean> <bean id="DataSource" class="net.uniuvo.webridger.dao.DynamicDataSource"> <property name= "targetDataSources"> <map key-type="java.lang.String"> <entry key="ds0" value-ref="ds0"/> <entry key="ds1" value-ref="ds1"/> </map> </property> <property name="defaultTargetDataSource" ref="ds0"/> </bean> <!--这里就声明了具体的事务 --> <bean id="attrSource" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource"> <property name="properties"> <props> <prop key="execute*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="select*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- 定义事务处理拦截器 --> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager"> <ref local="transactionManager" /> </property> <property name="transactionAttributeSource"> <ref local="attrSource" /> </property> </bean> <!-- 定义事务经理 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"> <ref local="DataSource" /> </property> </bean> <!-- 自动代理 (业务处理Bean的Id) --> <bean id="autoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="interceptorNames"> <list> <idref bean="transactionInterceptor" /> </list> </property> <property name="beanNames"> <list> <value>*Service</value> </list> </property> </bean> <!-- iBATIS相关设定 --> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="/WEB-INF/sqlMapConfig.xml" /> <property name="dataSource"> <ref bean="DataSource" /> </property> <property name="lobHandler"> <ref local="oracleLobHandler" /> </property> </bean> <!-- 定义DAO --> <!-- 检索用DAO --> <bean id="queryDAO" class="net.uniuvo.webridger.dao.QueryDAOiBatisImpl"> <property name="sqlMapClient"> <ref local="sqlMapClient" /> </property> </bean> <!-- 追加 更新 删除用DAO --> <bean id="updateDAO" class="net.uniuvo.webridger.dao.UpdateDAOiBatisImpl"> <property name="sqlMapClient"> <ref local="sqlMapClient" /> </property> </bean> <!--根据sqlMapClien创建一个SqlMapClient模版类--> <bean id="SqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate"> <property name="sqlMapClient"> <ref bean="sqlMapClient" /> </property> </bean> <bean id="nativeJdbcExtractor" lazy-init="true" class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" /> <bean id="oracleLobHandler" lazy-init="true" class="org.springframework.jdbc.support.lob.OracleLobHandler" > <property name="nativeJdbcExtractor"><ref local="nativeJdbcExtractor"/></property> </bean> <!-- 这里就是Facade了,注意,它有个parent属性,就是这个属性,使它的操作受到了事物管理的限制 <bean id="baseFacade" parent="baseTransactionProxy"> <property name="target"> <bean class="facade.BaseFacadeImpl"> 把DAO做为属性注入到Facade中去 <property name="proDao" ref="proDao" /> <property name="errDao" ref="errDao" /> <property name="userDao" ref="userDao" /> <property name="orderDao" ref="orderDao" /> </bean> </property> </bean> --> </beans> [color=red]sqlmapconfig.xml[/color] <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> <sqlMapConfig> <typeHandler jdbcType="BLOB" javaType="[B" callback="org.springframework.orm.ibatis.support.BlobByteArrayTypeHandler"/> <typeHandler jdbcType="CLOB" javaType="java.lang.String" callback="org.springframework.orm.ibatis.support.ClobStringTypeHandler" /> <sqlMap resource="../config/sql/sqlMap-mds.xml" /> <sqlMap resource="../config/sql/sqlMap-mds00.xml" /> <sqlMap resource="../config/sql/sqlMap-mds01.xml" /> <sqlMap resource="../config/sql/sqlMap-mds02.xml" /> <sqlMap resource="../config/sql/sqlMap-mds03.xml" /> <sqlMap resource="../config/sql/sqlMap-mds04.xml" /> <sqlMap resource="../config/sql/sqlMap-mds10.xml" /> <sqlMap resource="../config/sql/sqlMap-mds11.xml" /> <sqlMap resource="../config/sql/sqlMap-mds12.xml" /> <sqlMap resource="../config/sql/sqlMap-mds13.xml" /> <sqlMap resource="../config/sql/sqlMap-mds20.xml" /> <sqlMap resource="../config/sql/sqlMap-mds21.xml" /> <sqlMap resource="../config/sql/sqlMap-mds22.xml" /> <sqlMap resource="../config/sql/sqlMap-mds23.xml" /> <sqlMap resource="../config/sql/sqlMap-mds30.xml" /> <sqlMap resource="../config/sql/sqlMap-mds31.xml" /> <sqlMap resource="../config/sql/sqlMap-mds32.xml" /> <sqlMap resource="../config/sql/sqlMap-mds33.xml" /> <sqlMap resource="../config/sql/sqlMap-mds40.xml" /> </sqlMapConfig> sqlMap-mds40.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap > <select id="sql.mds40.001" parameterClass="cn.m_solution.mds.mds40.form.MDS40Form" resultClass="cn.m_solution.mds.mds40.form.MDS40Form"> select syr from vehicle where hpzl = #hpzl# and hphm = #hphm# </select> </sqlMap> MDS40T01Service package cn.m_solution.mds.mds40.service; import org.springframework.orm.ibatis.SqlMapClientTemplate; import cn.m_solution.mds.mds40.form.MDS40Form; public class MDS40T01Service { SqlMapClientTemplate sqlMapClientTemplate; public MDS40Form getStudent(){ MDS40Form form40 = new MDS40Form(); sqlMapClientTemplate.queryForObject("sql.mds40.001",form40); return form40; } /** * @return the sqlMapClientTemplate */ public SqlMapClientTemplate getSqlMapClientTemplate() { return sqlMapClientTemplate; } /** * @param sqlMapClientTemplate the sqlMapClientTemplate to set */ public void setSqlMapClientTemplate(SqlMapClientTemplate sqlMapClientTemplate) { this.sqlMapClientTemplate = sqlMapClientTemplate; } } test.java package cn.m_solution.mds.mds40.service; import org.springframework.jdbc.core.support.JdbcDaoSupport; public class test extends JdbcDaoSupport{ /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub MDS40T01Service s = new MDS40T01Service(); s.getStudent(); } }

java 空指针异常?好像逻辑有错

public class ProductsResource01 { private final Logger log = LoggerFactory.getLogger(this.getClass()); @Autowired private ProductsService productsService; public void getProductsList(){ List<Products> list = productsService.getAll(); for(Products a : list){ System.out.println(a); } } public static void main(String[] args) { ProductsResource01 p01 = new ProductsResource01(); p01.getProductsList(); } Bug信息: Exception in thread "main" java.lang.NullPointerException at cn.syy.otherUtils.ProductsResource01.getProductsList(ProductsResource01.java:18) at cn.syy.otherUtils.ProductsResource01.main(ProductsResource01.java:26)

java数据库,出现java.lang.ClassNotFoundException 问题

package S; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; public class JDBCS { String url = "jdbc:mysql://localhost:3307/ty10"; String name = "root"; String password = "mysql"; Connection conn = null; PreparedStatement pps=null; ResultSet rs = null; JDBCS() { try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(url,name,password); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } void update(String sql,String[] val){ try { pps = conn.prepareStatement(sql); for (int i = 0; val!=null && i < val.length; i++) { pps.setString(i+1, val[i]); } pps.executeUpdate(); }catch (SQLException e) { e.printStackTrace(); } } ArrayList<HashMap<String ,String>> queryToList(String sql ,String[] val){ rs=query(sql,val); ArrayList<HashMap<String ,String>> list = new ArrayList<HashMap<String,String>>(); try { ResultSetMetaData mt = rs.getMetaData();//结果集结构对象(有啥字段,类型,长度。。。) while(rs.next()){ HashMap<String ,String> map = new HashMap<String ,String>(); for (int i = 0; i < mt.getColumnCount(); i++) {//取所有字段 String name = mt.getColumnName( i+1 );//获取列名 map.put(name, rs.getString(name)); } list.add(map); } } catch (SQLException e) { e.printStackTrace(); } return list ; } ResultSet query(String sql ,String[] val){ try { pps = conn.prepareStatement(sql); for (int i = 0; val!=null && i < val.length; i++) { pps.setString(i+1, val[i]); } rs = pps.executeQuery(); return rs ; }catch (SQLException e) { e.printStackTrace(); } return null; } void close(){ try { rs.close(); } catch (SQLException e2) { e2.printStackTrace(); } try { pps.close(); } catch (SQLException e1) { e1.printStackTrace(); } try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } 运行后错误提示 java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at S.JDBCS.<init>(JDBCS.java:22) at S.student2.main(student2.java:9) Exception in thread "main" java.lang.NullPointerException at S.JDBCS.query(JDBCS.java:81) at S.student2.main(student2.java:10)

关于线程生产者消费者的问题

下面的程序运行的时候会一上来t2消费者线程抛异常Exception in thread "t2" java.lang.ArrayIndexOutOfBoundsException: -1 因为当t2进入等待状态的时候,t4获得所有权,马上t4又进入等待状态,唤醒之前的t2,当t2被唤醒再运行的时候已经是从bag.wait();的下一行运行,所以会抛异常。 请问怎么才能避免呢?我的bag.notify()的位置是不是放的不对呢? public class PC1 { public static final int limit=3; public static void main(String[] args) { List bag=new ArrayList(); Producer p=new Producer(bag); Consumer c=new Consumer(bag); Thread t1=new Thread(p,"t1");Thread t2=new Thread(c,"t2");Thread t3=new Thread(p,"t3");Thread t4=new Thread(c,"t4"); t2.start();t4.start(); t1.start();t3.start(); } } class Producer implements Runnable { private List bag; public Producer(List bag){ this.bag=bag; } @Override public void run() { synchronized(bag){ while(true){ if(bag.size()>=PC1.limit){ bag.notify(); try {bag.wait();} catch (InterruptedException e) {e.printStackTrace();} } int curr=bag.size(); bag.add(++curr); try {Thread.sleep(100);} catch (InterruptedException e) {e.printStackTrace();} System.out.println(Thread.currentThread().getName()+" produce "+curr); } } } } class Consumer implements Runnable { private List bag; public Consumer(List bag){ this.bag=bag; } @Override public void run() { synchronized(bag){ while(true){ if(bag.size()<=0){ bag.notify(); try {bag.wait();} catch (InterruptedException e) {e.printStackTrace();} } int curr=bag.size(); bag.remove(curr-1); try {Thread.sleep(100);} catch (InterruptedException e) {e.printStackTrace();} System.out.println(Thread.currentThread().getName()+" consume "+bag.size()); } } } }

java.lang.ClassCastException

![图片说明](https://img-ask.csdn.net/upload/201703/16/1489659004_806593.png) public class GroupFragment extends Fragment { private static RecyclerView recyclerView; public String json = null; private ArrayList<ItemObject> itemObjectArrayList; private LinearLayoutManager linearLayoutManager; private GroupAdapter groupAdapter; private View listTouchInterceptor; private View detailsLayout; private UnfoldableView unfoldableView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_group, null); recyclerView = (RecyclerView) view.findViewById(R.id.group_list_view); linearLayoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(linearLayoutManager); listTouchInterceptor = (View) view.findViewById(R.id.touch_interceptor_view); listTouchInterceptor.setClickable(false); detailsLayout = (View) view.findViewById(R.id.details_layout); detailsLayout.setVisibility(View.INVISIBLE); unfoldableView = (UnfoldableView) view.findViewById(R.id.unfoldable_view); Bitmap glance = BitmapFactory.decodeResource(getResources(), R.drawable.unfold_glance); unfoldableView.setFoldShading(new GlanceFoldShading(glance)); unfoldableView.setOnFoldingListener(new UnfoldableView.SimpleFoldingListener() { @Override public void onUnfolding(UnfoldableView unfoldableView) { listTouchInterceptor.setClickable(true); detailsLayout.setVisibility(View.VISIBLE); page_up.setVisibility(View.INVISIBLE); } @Override public void onUnfolded(UnfoldableView unfoldableView) { listTouchInterceptor.setClickable(false); } @Override public void onFoldingBack(UnfoldableView unfoldableView) { listTouchInterceptor.setClickable(true); } @Override public void onFoldedBack(UnfoldableView unfoldableView) { listTouchInterceptor.setClickable(false); detailsLayout.setVisibility(View.INVISIBLE); page_up.setVisibility(View.VISIBLE); } }); try { json = HttpUtil.getRequest("http://music.svner.com/cuiyunlong/feb_three_list.html"); } catch (Exception e) { e.printStackTrace(); } JSONObject jObject = null; int result = 0; try { jObject = new JSONObject(json); result = jObject.getInt("result"); } catch (JSONException e) { e.printStackTrace(); } if (result == 1) { JSONObject jsonObject; itemObjectArrayList = new ArrayList<ItemObject>(); try { jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray("data"); for (int i = 0; i < jsonArray.length(); i++) { jsonObject = jsonArray.getJSONObject(i); ItemObject itemObject = new ItemObject(); itemObject.group_image = jsonObject.getString("group_image"); itemObject.group_top = jsonObject.getString("group_top"); itemObject.group_bottom = jsonObject.getString("group_bottom"); itemObject.group_right = jsonObject.getString("group_right"); itemObjectArrayList.add(itemObject); } } catch (JSONException e) { e.printStackTrace(); } groupAdapter = new GroupAdapter(getActivity(), itemObjectArrayList); recyclerView.setAdapter(groupAdapter); } groupAdapter.setOnItemClickListener(new GroupAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { unfoldableView.unfold(view, detailsLayout); } }); public class ItemObject{ public String group_image; public String group_top; public String group_bottom; public String group_right; } } public class GroupAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private final Context context; private final ArrayList<GroupFragment.ItemObject> itemObjectArrayList; public GroupAdapter(Context context, ArrayList<GroupFragment.ItemObject> itemObjectArrayList) { this.context = context; this.itemObjectArrayList = itemObjectArrayList; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new GroupViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.group_list_item, null)); } @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { final GroupFragment.ItemObject itemObject = itemObjectArrayList.get(position%(itemObjectArrayList.size())); final GroupViewHolder groupViewHolder = (GroupViewHolder) holder; if (mOnItemClickListener != null){ groupViewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mOnItemClickListener.onItemClick(groupViewHolder.itemView, position); } }); } try { URL url = new URL(itemObject.group_image); Utils.onLoadImage(url, new Utils.OnLoadImageListener() { @Override public void OnLoadImage(Bitmap bitmap, String bitmapPath) { if (bitmap != null) { BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmap); groupViewHolder.group_image.setImageDrawable(bitmapDrawable); } } }); } catch (Exception e) { e.printStackTrace(); } groupViewHolder.group_top.setText(itemObject.group_top); groupViewHolder.group_bottom.setText(itemObject.group_bottom); groupViewHolder.group_right.setText(itemObject.group_right); } @Override public int getItemCount() { return itemObjectArrayList.size(); } public interface OnItemClickListener{ void onItemClick(View view, int position); } private OnItemClickListener mOnItemClickListener; public void setOnItemClickListener(OnItemClickListener mOnItemClickListener){ this.mOnItemClickListener = mOnItemClickListener; } } public class GroupViewHolder extends RecyclerView.ViewHolder { public ImageView group_image; public TextView group_top; public TextView group_bottom; public TextView group_right; public GroupViewHolder(View view) { super(view); group_image = (ImageView) view.findViewById(R.id.group_image); group_top = (TextView) view.findViewById(R.id.group_top); group_bottom = (TextView) view.findViewById(R.id.group_bottom); group_right = (TextView) view.findViewById(R.id.group_right); } } ![图片说明](https://img-ask.csdn.net/upload/201703/16/1489661697_445615.png) ![图片说明](https://img-ask.csdn.net/upload/201703/16/1489661954_171012.png)

使用代理的时候报ClassCastException错,完全摸不着头脑。

public abstract class Dog implements Eat { protected String name; protected int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } public interface Eat { void gotoEat(); void gotoEat(String food); void gotoEat(String food, int num); } public class BorderCollie extends Dog { @Override public void gotoEat() { System.out.println("什么都不喂我,只能吃草..."); } @Override public void gotoEat(String food) { System.out.println(food + "吃饱了,牧羊so easy!"); } @Override public void gotoEat(String food, int num) { System.out.println("足足吃了" + num + "份" + food + ",本边牧需要散步消化"); } } public class EatHandler implements InvocationHandler { private Object target = null; @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("gotoEat".equals(method.getName()) && args != null) { if(args.length == 2){ System.out.println("这里是调用方法名为:" + method.getName() + ";参数个数为:" + args.length); Class<?>[] parameterTypes = method.getParameterTypes(); List<String> argsType = Stream.of(parameterTypes).map(Class::getName).collect(Collectors.toList()); argsType.stream().forEach(System.out::println); } } System.out.println("先要洗爪..."); Object result = method.invoke(target, args); System.out.println("吃饱后要记得散步..."); return result; } public EatHandler(Object target) { this.target = target; } public void setTarget(Object target) { this.target = target; } public Object getTarget() { return target; } } @Test public void dogEat() { Dog borderCollie = new BorderCollie(); ClassLoader classLoader = BorderCollie.class.getClassLoader(); Class<?>[] interfaces = BorderCollie.class.getInterfaces(); EatHandler eatHandler = new EatHandler(borderCollie); Object proxyInstance = Proxy.newProxyInstance(classLoader, interfaces, eatHandler); BorderCollie obj = (BorderCollie) proxyInstance; System.out.println(proxyInstance.getClass().getName()); } 错误信息: java.lang.ClassCastException: com.sun.proxy.$Proxy4 cannot be cast to myproxy.BorderCollie at myproxy.EatTest.dogEat2(EatTest.java:39) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 我估计着是:BorderCollie obj = (BorderCollie) proxyInstance;这句话出错了,但是搞不懂为什么啊?

java.lang.ClassCastException: $Proxy71 cannot be cast to com.nfschina.dao.NewsDao

我被这个问题折腾了好半天了,还没找到合适的答案,下面是我jsp代码[code="java"] <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <%@ page import="com.test.dao.*,com.test.model.*, javax.naming.*,java.util.*"%> [code="java"][/code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <table width=80%> <tr> <td>id</td> <td>title</td> <td>content</td> <td>type</td> <td>pic</td> <td>createtime</td> </tr> <% try{ Properties props =new Properties(); props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); props.setProperty("java.naming.provider.url", "localhost:1099"); props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming"); InitialContext ctx=new InitialContext(); NewsDao newsdao=(NewsDao)ctx.lookup("NewsDaoImpl/remote"); News news1 =new News(); news1.setTitle("李永翠"); news1.setType((int)27); news1.setCreatetime(new Date()); news1.setContent("zhonguo "); news1.setPic("ag"); newsdao.insert(news1); List<News> newss=newsdao.getList(); for(News news:newss){ out.println("<tr><td>"+news.getId()+"</td><td>"+news.getTitle() +"</td><td>"+news.getContent()+"</td><td>"+news.getType()+ "</td><td>"+news.getPic()+"</td><td>"+news.getCreatetime()+"</td><tr>"); } }catch(Exception e){ e.printStackTrace();} %> </table> </body> </html> [/code]

SSM 遇到的java.lang.NullPointerException问题

报错 java.lang.NullPointerException ** at com.archives.controller.sysmanage.DepartmentController.doPageData(DepartmentController.java:38) ** at com.archives.controller.sy****smanage.DepartmentController.initHome(DepartmentController.java:32) 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:220) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) 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.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.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:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) mapper.xml 文件 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.archives.dao.UserDeptDao"> <resultMap id="userdeptMap" type="com.archives.entity.UserDept"> <id column="deptid" property="deptid"></id> <result column="deptname" property="deptname"/> <result column="telephone" property="telephone"/> <result column="fax" property="fax"/> <result column="managerid" property="managerid"/> <result column="remark" property="remark"/> <association property="userInfo" javaType="com.archives.entity.UserInfo"> <id column="loginid" property="loginid"></id> <result column="loginname" property="loginname"/> <result column="loginpwd" property="loginpwd"/> <result column="realname" property="realname"/> <result column="roleid" property="roleid"/> <result column="leveid" property="leveid"/> <result column="cardid" property="cardid"/> <result column="dutyid" property="dutyid"/> <result column="deptid" property="deptid"/> <result column="joindate" property="joindate"/> <result column="telephone" property="telephone"/> <result column="enduid" property="enduid"/> <result column="address" property="address"/> <result column="sex" property="sex"/> </association> </resultMap> <select id="selectUserDeptCount" parameterType="com.archives.model.A0104Model" resultType="Integer"> select count(*) as cnt from userinfo,dept and userinfo.deptid = dept.deptid <if test="loginname != null and loginname.trim() != '' "> and userinfo.loginname = #{loginname} </if> <if test="realname != null and realname.trim() != '' "> and userinfo.realname = #{realname} </if> <if test="deptname != null and deptname.trim() != '' "> and dept.deptname = #{deptname} </if> </select> <select id="selectUserDeptList" parameterType="com.archives.model.A0104Model" resultMap="userdeptMap"> select userinfo.loginid , userinfo.loginname , userinfo.realname , dept.deptname , dept.deptid from userinfo,dept where userinfo.deptid = dept.deptid limit #{offsetindex},#{pageCount} </select> </mapper> controller.java文件 package com.archives.controller.sysmanage; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.alibaba.fastjson.JSON; import com.archives.common.Constant; import com.archives.entity.Menu; import com.archives.entity.UserDept; import com.archives.entity.UserInfo; import com.archives.model.A0104Model; import com.archives.service.HomeService; import com.archives.service.UserDeptService; @Controller @RequestMapping("/department") public class DepartmentController { UserDeptService userdeptService; @RequestMapping("/init") public String initHome(HttpServletRequest request) { A0104Model model=new A0104Model(); model.setCurPage(1); model.setPageCount(Constant.PAGE_COUNT); 对应的错误行**doPageData(request,model);** return "department"; } private void doPageData(HttpServletRequest request, A0104Model model) { // TODO Auto-generated method stub int cnt = userdeptService.selectUserDeptCount(model); int totalPage = 0; if(cnt%Constant.PAGE_COUNT == 0) { totalPage = cnt/Constant.PAGE_COUNT; }else { totalPage = cnt/Constant.PAGE_COUNT + 1; } model.setTotalPage(totalPage); model.setOffsetindex((model.getCurPage() - 1) * Constant.PAGE_COUNT); model.setPageCount(Constant.PAGE_COUNT); 对应的错误行**List<UserDept> userdeptduiyList=userdeptService.selectUserDeptList(model);** request.setAttribute("userdeptList", userdeptList); request.setAttribute("model", model); } } model.java文件 package com.archives.model; public class A0104Model { private String loginname; private String realname; private String deptname; public String getLoginname() { return loginname; } public void setLoginname(String loginname) { this.loginname = loginname; } public String getRealname() { return realname; } public void setRealname(String realname) { this.realname = realname; } public String getDeptname() { return deptname; } public void setDeptname(String deptname) { this.deptname = deptname; } public int getCurPage() { return curPage; } public void setCurPage(int curPage) { this.curPage = curPage; } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getOffsetindex() { return offsetindex; } public void setOffsetindex(int offsetindex) { this.offsetindex = offsetindex; } public int getPageCount() { return pageCount; } public void setPageCount(int pageCount) { this.pageCount = pageCount; } private int curPage; private int totalPage; private int offsetindex; private int pageCount; } Dao package com.archives.dao; import java.util.List; import com.archives.entity.UserDept; import com.archives.model.A0104Model; public interface UserDeptDao { UserDeptDao getUserDeptByName(String loginname); int selectUserDeptCount(A0104Model model); List<UserDept> selectUserDeptList(A0104Model model); } service package com.archives.service; import java.util.List; import com.archives.entity.UserDept; import com.archives.model.A0104Model; public interface UserDeptService { int selectUserDeptCount(A0104Model model); List<UserDept> selectUserDeptList(A0104Model model); } serviceImpl package com.archives.service; import java.util.List; import com.archives.dao.UserDeptDao; import com.archives.entity.UserDept; import com.archives.model.A0104Model; public class UserDeptServiceImpl implements UserDeptService { UserDeptDao userdeptDao; @Override public int selectUserDeptCount(A0104Model model) { // TODO Auto-generated method stub int cnt=userdeptDao.selectUserDeptCount(model); return cnt; } @Override public List<UserDept> selectUserDeptList(A0104Model model) { // TODO Auto-generated method stub List<UserDept> userdeptList =userdeptDao.selectUserDeptList(model); return userdeptList; } } UserDept.java package com.archives.entity; public class UserDept { private int deptid; private String deptname; private String telephone; private String fax; private String managerid; private String remark; public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getFax() { return fax; } public void setFax(String fax) { this.fax = fax; } public String getManagerid() { return managerid; } public void setManagerid(String managerid) { this.managerid = managerid; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public int getDeptid() { return deptid; } public void setDeptid(int deptid) { this.deptid = deptid; } public String getDeptname() { return deptname; } public void setDeptname(String deptname) { this.deptname = deptname; } public String getLoginid() { return loginid; } public void setLoginid(String loginid) { this.loginid = loginid; } public String getLoginname() { return loginname; } public void setLoginname(String loginname) { this.loginname = loginname; } public String getRealname() { return realname; } public void setRealname(String realname) { this.realname = realname; } private String loginid; private String loginname; private String realname; }

IndexOutOfBoundsException数组越界的问题求解

D/AndroidRuntime( 7415): Shutting down VM --------- beginning of crash E/AndroidRuntime( 7415): FATAL EXCEPTION: main E/AndroidRuntime( 7415): Process: com.android.settings, PID: 7415 E/AndroidRuntime( 7415): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 E/AndroidRuntime( 7415): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) E/AndroidRuntime( 7415): at java.util.ArrayList.get(ArrayList.java:308) E/AndroidRuntime( 7415): at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:164) E/AndroidRuntime( 7415): at android.widget.ListView.dispatchDraw(ListView.java:3307) E/AndroidRuntime( 7415): at android.view.View.draw(View.java:15234) E/AndroidRuntime( 7415): at android.widget.AbsListView.draw(AbsListView.java:4110) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14167) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389) E/AndroidRuntime( 7415): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368) E/AndroidRuntime( 7415): at android.view.View.updateDisplayListIfDirty(View.java:14127) E/AndroidRuntime( 7415): at android.view.View.getDisplayList(View.java:14189) E/AndroidRuntime( 7415): at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273) E/AndroidRuntime( 7415): at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279) E/AndroidRuntime( 7415): at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:318) E/AndroidRuntime( 7415): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2530) E/AndroidRuntime( 7415): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2352) E/AndroidRuntime( 7415): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1982) E/AndroidRuntime( 7415): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061) E/AndroidRuntime( 7415): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885) E/AndroidRuntime( 7415): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767) E/AndroidRuntime( 7415): at android.view.Choreographer.doCallbacks(Choreographer.java:580) E/AndroidRuntime( 7415): at android.view.Choreographer.doFrame(Choreographer.java:550) E/AndroidRuntime( 7415): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) E/AndroidRuntime( 7415): at android.os.Handler.handleCallback(Handler.java:739) E/AndroidRuntime( 7415): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime( 7415): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime( 7415): at android.app.ActivityThread.main(ActivityThread.java:5258) E/AndroidRuntime( 7415): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 7415): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime( 7415): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) E/AndroidRuntime( 7415): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) W/ActivityManager( 3185): Force finishing activity 1 com.android.settings/.SubSettings 表示看不出是哪行的代码有问题呀,报的都是api的错。。有谁知道不?

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

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

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

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

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解!

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解! 目录 博客声明 大数据了解博主粉丝 博主的粉丝群体画像 粉丝群体性别比例、年龄分布 粉丝群体学历分布、职业分布、行业分布 国内、国外粉丝群体地域分布 博主的近期访问每日增量、粉丝每日增量 博客声明 因近期博主写专栏的文章越来越多,也越来越精细,逐步优化文章。因此,最近一段时间,订阅博主专栏的人数增长也非常快,并且专栏价

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

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

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

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

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

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

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

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

MySQL性能优化(五):为什么查询速度这么慢

前期回顾: MySQL性能优化(一):MySQL架构与核心问题 MySQL性能优化(二):选择优化的数据类型 MySQL性能优化(三):深入理解索引的这点事 MySQL性能优化(四):如何高效正确的使用索引 前面章节我们介绍了如何选择优化的数据类型、如何高效的使用索引,这些对于高性能的MySQL来说是必不可少的。但这些还完全不够,还需要合理的设计查询。如果查询写的很糟糕,即使表结构再合理、索引再...

用了这个 IDE 插件,5分钟解决前后端联调!

点击上方蓝色“程序猿DD”,选择“设为星标”回复“资源”获取独家整理的学习资料!作者 |李海庆我是一个 Web 开发前端工程师,受到疫情影响,今天是我在家办公的第78天。开发了两周,...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...

【高并发】高并发秒杀系统架构解密,不是所有的秒杀都是秒杀!

网上很多的文章和帖子中在介绍秒杀系统时,说是在下单时使用异步削峰来进行一些限流操作,那都是在扯淡! 因为下单操作在整个秒杀系统的流程中属于比较靠后的操作了,限流操作一定要前置处理,在秒杀业务后面的流程中做限流操作是没啥卵用的。

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

Java14 新特性解读

Java14 已于 2020 年 3 月 17 号发布,官方特性解读在这里:https://openjdk.java.net/projects/jdk/14/以下是个人对于特性的中文式...

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

疫情后北上广深租房价格跌了吗? | Alfred数据室

去年3月份我们发布了《北上广深租房图鉴》(点击阅读),细数了北上广深租房的各种因素对租房价格的影响。一年过去了,在面临新冠疫情的后续影响、城市尚未完全恢复正常运转、学校还没开学等情况下...

面试官给我挖坑:a[i][j] 和 a[j][i] 有什么区别?

点击上方“朱小厮的博客”,选择“设为星标”后台回复&#34;1024&#34;领取公众号专属资料本文以一个简单的程序开头——数组赋值:int LEN = 10000; int[][] ...

又一起程序员被抓事件

就在昨天互联网又发生一起让人心酸的程序员犯罪事件,著名的百度不限速下载软件 Pandownload PC 版作者被警方抓获。案件大致是这样的:软件的作者不仅非法盗取用户数据,还在QQ群进...

应聘3万的职位,有必要这么刁难我么。。。沙雕。。。

又一次被面试官带到坑里面了。面试官:springmvc用过么?我:用过啊,经常用呢面试官:springmvc中为什么需要用父子容器?我:嗯。。。没听明白你说的什么。面试官:就是contr...

太狠了,疫情期间面试,一个问题砍了我5000!

疫情期间找工作确实有点难度,想拿到满意的薪资,确实要点实力啊!面试官:Spring中的@Value用过么,介绍一下我:@Value可以标注在字段上面,可以将外部配置文件中的数据,比如可以...

Intellij IDEA 美化指南

经常有人问我,你的 IDEA 配色哪里搞的,我会告诉他我自己改的。作为生产力工具,不但要顺手而且更要顺眼。这样才能快乐编码,甚至降低 BUG 率。上次分享了一些 IDEA 有用的插件,反...

【相亲】96年程序员小哥第一次相亲,还没开始就结束了

颜值有点高,条件有点好

太厉害了,终于有人能把TCP/IP 协议讲的明明白白了

一图看完本文 一、 计算机网络体系结构分层 计算机网络体系结构分层 计算机网络体系结构分层 不难看出,TCP/IP 与 OSI 在分层模块上稍有区别。OSI 参考模型注重“通信协议必要的功能是什么”,而 TCP/IP 则更强调“在计算机上实现协议应该开发哪种程序”。 二、 TCP/IP 基础 1. TCP/IP 的具体含义 从字面意义上讲,有人可能会认为...

腾讯面试题: 百度搜索为什么那么快?

我还记得去年面腾讯时,面试官最后一个问题是:百度/google的搜索为什么那么快? 这个问题我懵了,我从来没想过,搜素引擎的原理是什么 然后我回答:百度爬取了各个网站的信息,然后进行排序,当输入关键词的时候进行文档比对……巴拉巴拉 面试官:这不是我想要的答案 我内心 这个问题我一直耿耿于怀,终于今天,我把他写出来,以后再问,我直接把这篇文章甩给他!!! 两个字:倒排,将贯穿整篇文章,也是面试官...

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问
相关内容推荐