随笔 - 607,  文章 - 173,  评论 - 2,  阅读 - 21万
1    常规错误解决
  • can not infer arguments

泛型参数不匹配,经排查,定义的是String类型,传入的是Int类型,导致报错

 

  • Could not retrieve connection info from pool

报这个问题,是因为连接池溢出。

如果想从根上解决这个问题,需要运行完关闭连接池即可。

preparement.close();

 conn.close();

 

  • is not a functional interface 

非集合对象使用lambda表达式,有时报错也提示为 java:不是语句

 

  • javax.naming.NamingException: No naming context bound to this class loader

我遇到这个问题的时候用的是tomcat7+jdk1.6,好像说的是tomcat7和jdk1.6不匹配。于是我又使用tomcat6和jdk1.6进行搭配,奇迹般的好用了

 

 

  • overridden method does not

原因:接口和实现类 抛出的异常,属于不同的不同包下的同名类。

 

  • Setting property 'source' to 'org.eclipse.jst.jee.server

https://blog.csdn.net/z69183787/article/details/19911935

这篇的大哥讲的非常好,但是我用他的方法没有解决问题。

 

最终用另一种方法解决了问题:

参考我的上一篇文章。

http://www.cnblogs.com/1446358788-qq/articles/8933592.html

 

  • Type mismatch: cannot convert from LinkedList to List

1  Type mismatch: cannot convert from LinkedList to List//导入的包不对,应导入java.util.List

2  Type mismatch: cannot convert from ArrayList to List//导入的包不对,应导入java.util.List

 

 

 

 

2    系统性bug(系统本身缺陷)
2.1  Calendar 的 bug

今天做项目发现了Calendar的bug,关于月份相加,2017/11/30到2018/11/29,算出13个月,如下:

复制代码
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;


public class Test {
    private  Date startDate ;
    private  Date endDate ;
    
    public static void main(String[] args) throws ParseException {
        
        Test aa = new Test();
        aa.aa();
    }
    
    
    
    
    
    
    public void aa() throws ParseException{
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
//        startDate = sdf.parse("2017/11/14"); 
//        endDate = sdf.parse("2018/11/13");
        startDate = sdf.parse("2017/11/30"); 
        endDate = sdf.parse("2018/11/29");
        
        Calendar startCalendar = Calendar.getInstance();
         
         
         
          /* 257*/        Calendar endCalendar = Calendar.getInstance();
          /* 258*/        int reverse = 1;
          /* 259*/        if(startDate.after(endDate))
                          {/* 260*/            startCalendar.setTime(endDate);
          /* 261*/            endCalendar.setTime(startDate);
          /* 262*/            reverse = -1;
                          } else
                          {/* 264*/            startCalendar.setTime(startDate);
          /* 265*/            endCalendar.setTime(endDate);
                          }


          /* 269*/        startCalendar.set(11, 0);
          /* 270*/        startCalendar.set(12, 0);
          /* 271*/        startCalendar.set(13, 0);
          /* 272*/        startCalendar.set(14, 0);
          /* 273*/        endCalendar.set(11, 0);
          /* 274*/        endCalendar.set(12, 0);
          /* 275*/        endCalendar.set(13, 0);
          /* 276*/        endCalendar.set(14, 0);

//          /* 278*/        if(startCalendar.equals(endCalendar))/* 278*/            return 0;

          /* 280*/        int x = 0;
          /* 281*/        startCalendar.add(2, 1);
          /* 282*/        for(; startCalendar.before(endCalendar); startCalendar.add(2, 1))

          /* 284*/            x++;

          /* 286*/        System.out.println((x + (!true && !startCalendar.equals(endCalendar) ? 0 : 1)) * reverse) ;
    }

}
复制代码

 

posted on   菜鸟乙  阅读(1034)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示