首页 新闻 会员 周边 捐助

java程序直接运行没有问题,但是debug就有错误,求大佬解救!

0
悬赏园豆:30 [待解决问题]

java程序直接运行没有问题,但是debug就有错误,
在eclipse中debug,程序报错而且程序启动不起来,debug报错如下:

2018-09-04 23:03:30.103 INFO 1196 --- [ main] com.trs.dataMigration.Application : Starting Application on DESKTOP-O3G834A with PID 1196 (started by ���S in E:\JavaTRS项目\dataMigrate)
2018-09-04 23:03:30.130 INFO 1196 --- [ main] com.trs.dataMigration.Application : No active profile set, falling back to default profiles: default
2018-09-04 23:03:30.335 INFO 1196 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5b6cb210: startup date [Tue Sep 04 23:03:30 CST 2018]; root of context hierarchy
2018-09-04 23:03:35.300 INFO 1196 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$54b7a4db] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-09-04 23:03:36.236 WARN 1196 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to create tempDir. java.io.tmpdir is set to C:\Users\���S\AppData\Local\Temp\
2018-09-04 23:03:36.261 ERROR 1196 --- [ main] o.s.boot.SpringApplication : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to create tempDir. java.io.tmpdir is set to C:\Users\���S\AppData\Local\Temp\
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-4.2.8.RELEASE.jar:4.2.8.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at com.trs.dataMigration.Application.main(Application.java:17) [classes/:na]
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to create tempDir. java.io.tmpdir is set to C:\Users\���S\AppData\Local\Temp\
at org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory.createTempDir(AbstractEmbeddedServletContainerFactory.java:183) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:156) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:160) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
... 8 common frames omitted
Caused by: java.io.IOException: 系统找不到指定的路径。
at java.io.WinNTFileSystem.createFileExclusively(Native Method) ~[na:1.7.0_67]
at java.io.File.createNewFile(File.java:1006) ~[na:1.7.0_67]
at java.io.File.createTempFile(File.java:1989) ~[na:1.7.0_67]
at java.io.File.createTempFile(File.java:2040) ~[na:1.7.0_67]
at org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory.createTempDir(AbstractEmbeddedServletContainerFactory.java:174) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
... 11 common frames omitted

 求大佬解救!!!

问题补充:

在eclipse中debug,报错而且程序无法启动;

但是在idea中debug,虽然报错但程序能启动成功!

idea中的报错(能启动成功!):

Connected to the target VM, address: '127.0.0.1:53907', transport: 'socket'
Capture agent: unable to read settings
java.io.FileNotFoundException: C:\Users\ÒãØS\AppData\Local\Temp\capture1.props (系统找不到指定的路径。)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at java.io.FileInputStream.<init>(FileInputStream.java:101)
    at java.io.FileReader.<init>(FileReader.java:58)
    at com.intellij.rt.debugger.agent.CaptureAgent.readSettings(CaptureAgent.java:93)
    at com.intellij.rt.debugger.agent.CaptureAgent.premain(CaptureAgent.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)
毅豐的主页 毅豐 | 初学一级 | 园豆:165
提问于:2018-09-04 23:07

好吧,我觉得这个问题就是因为电脑的本地账户是中文,导致文件路径乱码,debug出错!

毅豐 6年前
< >
分享
所有回答(4)
0

路径不要写中文,指不定会出啥问题。boot版本换成1.5.6试试?把中文路径改成英文试试?

山抹微云君^^ | 园豆:474 (菜鸟二级) | 2018-09-05 10:50

那个中文是我电脑本地账户名称

支持(0) 反对(0) 毅豐 | 园豆:165 (初学一级) | 2018-09-05 18:28
0

是不是 流没关。将代码try ..catch。。finally{}; fianlly里关流

^keepHungry$ | 园豆:516 (小虾三级) | 2018-09-05 18:14
1

根据报错提示,是路径有问题,既然电脑本地账户是中文名称,那我建议你把代码中的路径写成相对路径应该能解决上述问题。

Tracy21 | 园豆:214 (菜鸟二级) | 2018-09-13 13:01
0

这个问题我遇到过,eclipse debug路径不能带中文,会报乱码,识别不了。建议把项目放到全英文路径下,不要带特殊字符

韦艾薇薇 | 园豆:244 (菜鸟二级) | 2018-09-20 10:55

这个和项目路径没关系吧,我把项目路径改为全英文还是不行,这个是电脑本地账户是中文名称的原因。

支持(0) 反对(0) 毅豐 | 园豆:165 (初学一级) | 2018-09-21 09:48

@毅豐: 项目路径是你项目放在哪,你这个文件的绝对路径就是项目路径,你这路径看控制台你的项目不就是放在 c:/users/你的名字/.... 之类的吗? 很明显这个乱码就是你电脑的用户名啊,你的用户名就是中文,所以报错啊。你新建项目肯定是用的默认的项目路径 c:/users/你的名字/appdata...之类的,应该自己自定义一个

支持(0) 反对(0) 韦艾薇薇 | 园豆:244 (菜鸟二级) | 2018-09-21 21:26

@韦艾薇薇: 我的项目就放在我自定义的路径下,项目路径(E:\JavaTRSEclipse\dataMigrate),乱码的那个东西java.io.tmpdir我查了一下好像是系统临时文件,具体的不太清楚(网上好多东西都是一样滴,看不懂),能不能解释一下,谢谢啦!

支持(0) 反对(0) 毅豐 | 园豆:165 (初学一级) | 2018-09-21 22:19
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册