蚂蚁1.9.4将不干净,并建立使用Java 8的Netbeans 8.0.2项目;给出空指针异常 [英] Ant 1.9.4 won't clean and build Netbeans 8.0.2 project using Java 8; gives null pointer exception

查看:320
本文介绍了蚂蚁1.9.4将不干净,并建立使用Java 8的Netbeans 8.0.2项目;给出空指针异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的code没有错误。如果让我选择F6(运行)它执行罚款。如果我清洁它,没有错误。但是,如果我清理并生成我得到这些错误,因为在Netbeans的8.0.2的bug(S)和/或蚂蚁1.9.4的。在完全不能接受的解决办法是建立一个新的项目,所有的文件拷贝到其中。这工作了一段时间。然后,我必须再次做到这一点。

修改

我用蒂卡-APP-1.9.jar 的库文件。这是45MB。如果我删除它,而是使用蒂卡的解析器,1.10.jar 蒂卡核-1.10.jar 作为库文件,我没有得到这个错误,但我的程序则不能正确处理 .PDF 文件。而伴随着巨大的图书馆,该方案已成功编译数十次并运行作为独立(即外Netbeans的)很多倍。

编辑END

编辑2

确定。我删除取代了两个较小的库文件与蒂卡-APP-1.10.jar ,干净,共建合作。

END修改

请提供一些深入了解为什么发生和如何修复和prevent或以其他方式对其进行调试。我有超过3000行调试输出,但底线,调试是否被选中与否始终是这些:

  C:\\用户\\多夫\\谷歌驱动器\\的NetBeansProjects \\查找\\ nbproject文件\\ build-impl.xml中:994:执行此线出现以下错误:
C:\\用户\\多夫\\谷歌驱动器\\的NetBeansProjects \\查找\\ nbproject文件\\ build-impl.xml中:838:
显示java.lang.NullPointerException
    在org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:439)
    在org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)

下面是我的项目:

在这里输入的形象描述 href=\"http://i.stack.imgur.com/FqbNZ.png\" rel=\"nofollow\">

我还没有与的build.xml 混乱或任何其他生成的文件。

我已经重新启动Netbeans的8.0.2,并寻找可能被运行的JVM实例。有没有。

这里的蚂蚁屏幕:

在这里输入的形象描述

下面是更多的堆栈跟踪:

 在org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:519)
    在org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:480)
    在org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:443)
    在org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:409)
    在org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:384)
    在org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:322)
    在org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs.execute(CopyLibs.java:206)
    在org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    在sun.reflect.GeneratedMethodAccessor61.invoke(来源不明)
    在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    在java.lang.reflect.Method.invoke(Method.java:497)
    在org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    在org.apache.tools.ant.Task.perform(Task.java:348)
    在org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    在org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    在sun.reflect.GeneratedMethodAccessor61.invoke(来源不明)
    在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    在java.lang.reflect.Method.invoke(Method.java:497)
    在org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    在org.apache.tools.ant.Task.perform(Task.java:348)
    在org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    在org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    在sun.reflect.GeneratedMethodAccessor61.invoke(来源不明)
    在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    在java.lang.reflect.Method.invoke(Method.java:497)
    在org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    在org.apache.tools.ant.Task.perform(Task.java:348)
    在org.apache.tools.ant.Target.execute(Target.java:435)
    在org.apache.tools.ant.Target.performTasks(Target.java:456)
    在org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    在org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    在org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    在org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    在org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    在org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    在org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
构建失败(总时间:4秒)

请注意这些行后面的构建失败行:

 无法加载类型mavenrepository类(org.apache.tools.ant.taskdefs.repository.MavenRepository)
未能加载类型jdepend依赖类(jdepend / XMLUI / JDepend)
未能加载类型图像的依赖类(使用javax /媒体/ JAI / PlanarImage)
未能加载类型mavenrepository类(org.apache.tools.ant.taskdefs.repository.MavenRepository)
未能加载类型jdepend依赖类(jdepend / XMLUI / JDepend)
未能加载类型图像的依赖类(使用javax /媒体/ JAI / PlanarImage)


解决方案

检查有关 ResourceUtils ,似乎异常在副本任务(可能是一个拷贝发生你的库Jar文件),试图回落至另一个副本机制之前,记录错误特别是当。

同时检查蚂蚁1.9.5,看来这个问题是固定的,的发行说明的Bug提这个57533 NullPointerException异常FileUtil.rename / ResourceUtils.copyFile()如果copyUsingFileChannels失败)。

所以,我会尝试升级到1.9.5蚂蚁,看问题是否得到解决。

My code has no errors. If I choose F6 (Run) it executes fine. If I Clean it, there are no errors. But if I clean and build, I get these errors because of bug(s) in Netbeans 8.0.2 and/or Ant 1.9.4. The completely unacceptable workaround is to create a new project and copy all the files into it. This works for awhile. Then I have to do it again.

EDIT

I use tika-app-1.9.jar as library file. It is 45MB. If I remove it and instead use tika-parsers-1.10.jar and tika-core-1.10.jar as library files, I don't get this error BUT my program then can't properly process .PDF files. And with the huge library, the program has compiled successfully dozens of times and run as standalone (i.e., outside Netbeans) many more times.

END OF EDIT

EDIT 2

OK. I deleted replaced the two smaller library files with tika-app-1.10.jar and clean and build WORKED.

ONCE.

END EDIT

Please offer some insight into why it's happening and how to fix and prevent it or otherwise debug it. I have over 3000 lines of debug output but the bottom line, whether debug is selected or not is always these:

C:\Users\Dov\Google Drive\NetBeansProjects\Find\nbproject\build-impl.xml:994: The following error occurred while executing this line:
C:\Users\Dov\Google Drive\NetBeansProjects\Find\nbproject\build-impl.xml:838: 
java.lang.NullPointerException
    at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:439)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)

Here's my project:

I haven't messed with build.xml or any other generated files.

I've restarted Netbeans 8.0.2 and looked for instances of JVM that might be running. There aren't.

Here's the Ant screen:

Here's more of the stack trace:

    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:519)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:480)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:443)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:409)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:384)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:322)
    at org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs.execute(CopyLibs.java:206)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 4 seconds)

Please note these lines that FOLLOW the BUILD FAILED line:

Could not load class (org.apache.tools.ant.taskdefs.repository.MavenRepository) for type mavenrepository
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (javax/media/jai/PlanarImage) for type image
Could not load class (org.apache.tools.ant.taskdefs.repository.MavenRepository) for type mavenrepository
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (javax/media/jai/PlanarImage) for type image

解决方案

Checking the related ResourceUtils, it seems the exception is occurring in a copy task (probably the one copying your library Jar file), specifically when trying to log an error before falling back to another copy mechanism.

Meanwhile checking Ant 1.9.5, it seems the problem was fixed, and the release notes mention this in Bug 57533 (NullPointerException FileUtil.rename / ResourceUtils.copyFile() if copyUsingFileChannels failed).

Therefore, I would try to upgrade to Ant 1.9.5 to see if the problem is resolved.

这篇关于蚂蚁1.9.4将不干净,并建立使用Java 8的Netbeans 8.0.2项目;给出空指针异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆