解决eclipse遇到An internal error occurred during: “Building UI model”问题

尝试使用Spring Tools创建工程时遇到,An internal error occurred during: “Building UI model问题,这是因为STS版本与eclipse版本不匹配,以下两种解决方式可以处理:

方案一:在这里 “https://spring.io/tools/sts/legacy” 下载eclipse STS,下载前记得看一下eclipse版本

方案二:你不能在“eclipse Market Place”下载STS,因为eclipse会去找最新版本的STS,你可以点击Help->Install new software ,然后使用这个网址去下载 http://dist.springsource.com/release/TOOLS/update/e4.X/ (X替换为你的eclipse版本号)

解决启动Spring报java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy问题

这是JDK以特殊的方式告知你,在class path下找不到这个需要依赖的注解,很不幸的是他并不会告知你是哪个注解,或者是哪个类缺失。

可以检查一下依赖管理,尝试修复一下,maven工程使用mvn dependency:tree,gradle工程使用./gradlew dependencies

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
    at java.lang.Class.createAnnotationData(Class.java:3521)
    at java.lang.Class.annotationData(Class.java:3510)
    at java.lang.Class.getAnnotations(Class.java:3446)
    at org.junit.runner.Description.createSuiteDescription(Description.java:124)
    at org.junit.internal.runners.ErrorReportingRunner.getDescription(ErrorReportingRunner.java:28)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:85)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

git pull报错fatal: BUG: your vsnprintf is broken (returned -1)排查

今天Linux开发机上面,git pull时报错 fatal: BUG: your vsnprintf is broken (returned -1) ,后来换了个路径clone也是报“克隆成功,但是检出失败”

1、gdb跟踪观察,因为不是编译安装的,所以并没有看出什么效果

2、strace查看调用栈,本身无特别之处,无更细致的细节

30844 fstat(4, {st_mode=S_IFREG|0644, st_size=199262, ...}) = 0
30844 close(4)                          = 0
30844 setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
30844 rt_sigaction(SIGALRM, {SIG_IGN, [ALRM], SA_RESTORER|SA_RESTART, 0x7f3fcbd5f510}, {0x4fc5c0, [], SA_RESTORER|SA_RESTART, 0x7f3fcc0d07e0}, 8) = 0
30844 write(2, "fatal: BUG: your vsnprintf is br"..., 51) = 51
30844 close(3)                          = 0
30844 unlink("/xxxx/.git/index.lock") = 0
30844 write(2, "warning: \277\313\302\241\263\311\271\246\243\254\265\253\312\307\274\354\263\366\312\247\260\334\241"..., 118) = 118
30844 exit_group(128)                   = ?
30844 +++ exited with 128 +++

3、其他机器上执行,目前在windows的机器上是没问题的,另一台开发机上安装有1.7.1版本git,执行并无问题。

4、目前猜测可能和某些文件文件名或内容等,引起git这个bug,时间所限,先暂时使用git 1.7.1版本操作,后续将尝试导出不同版本内容观察git2.14.1是否还会出现这个特定问题

linux下添加环境变量

方案一:

首先使用ehco命令可以打印输出:

echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/home/xxx/bin

export 命令导入所需要新增的路径,同时:拼接上原有值

export PATH=/usr/bin/:$PATH

打印输出

echo $PATH
/usr/bin/:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/home/xxx/bin

方案二:

使用vim打开/etc/profile文件,在最后添加:export PATH="/usr/bin/:$PATH"保存退出,然后运行 source /etc/profile

记录gdb调试某一应用并执行不同命令

gdb调试某应用,可以直接使用sudo gdb /usr/local/bin/git,可以使用run方法执行特殊指令,比如run checkout -f HEAD

详情执行如下:

sudo gdb /usr/local/bin/git
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-92.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/bin/git...(no debugging symbols found)...done.
(gdb) run checkout -f HEAD
Starting program: /usr/local/bin/git checkout -f HEAD
[Thread debugging using libthread_db enabled]
fatal: BUG: your vsnprintf is broken (returned -1)

Program exited with code 0200.
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.209.el6_9.1.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt

修为

很多年前,我在看清末民初的历史时,非常轻视当时的一些读书人,因为我觉得他们很多人都是走八股文考科举的套路,脱离生产实践,可谓百无一用,后来渐渐发现,并不完全是这样

即使是在清末民初那个中国最颓丧的时代,一些传统知识分子也是很厉害的,因为学什么知识写什么文章都是其次,最重要的是儒家给读书人提出了一套自我完善的要求,让人不断地自我反省和修炼,以正言行强心智,只要人的自我修为到了,做其他的事情也是事半功倍的

Read more

解决Go文件在eclipse中执行报Executable file doesnt exist 问题

Go文件执行的时候报Executable file doesnt exist,但是如果你按照项目名称搜索的时候,比如我的项目名为main,那么我搜索main.exe,会发现其并没有在项目空间下的bin目录,而是在Go的bin目录下,eclipse会去项目空间下的bin目录中找,结果就导致此报错。

##解决方案
将GOBIN这个环境变量删掉~ 在命令行中go env查看go的环境变量,是否有设置GOBIN这个环境变量,如果有设置,那么将其删掉,并且重启,go env查看是否生效。

解决Mac下check gdb is codesigned – see taskgated(8)问题

刚刚安装的GDB调试的时候会报

Starting program: /Users/wangxinguo/C/DataStruct/3/a.out
Unable to find Mach task port for process-id 5222: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

这是因为没有特殊授权的情况下不允许gdb调试任何程序,所以可以按照如下过程解决
Read more