在本文中,我们将为您详细介绍蚂蚁复制任务:由于java.io.FileNotFoundException而无法复制的相关知识,此外,我们还会提供一些关于Centos7Jetty7项目部署java.io
在本文中,我们将为您详细介绍蚂蚁复制任务:由于java.io.FileNotFoundException而无法复制的相关知识,此外,我们还会提供一些关于Centos7 Jetty7 项目部署 java.io.FileNotFoundException、com.jcraft.jsch.JSchException: java.io.FileNotFoundException: file:\D:\development\ideaProjects\s...、Error: java.io.FileNotFoundException: Path is not a file: /g6/hadoop/20190326、FileNotFoundException,该文件存在Java的有用信息。
本文目录一览:- 蚂蚁复制任务:由于java.io.FileNotFoundException而无法复制
- Centos7 Jetty7 项目部署 java.io.FileNotFoundException
- com.jcraft.jsch.JSchException: java.io.FileNotFoundException: file:\D:\development\ideaProjects\s...
- Error: java.io.FileNotFoundException: Path is not a file: /g6/hadoop/20190326
- FileNotFoundException,该文件存在Java
蚂蚁复制任务:由于java.io.FileNotFoundException而无法复制
我正在尝试在Ant中编译Flex应用程序(这里没有问题,我可以做得很好)。当我尝试将项目的内容发布到Windows网络驱动器(系统上称为“
Z:\”)时,我收到Java / Ant抛出的以下 LAME 异常:
BUILD FAILED
C:\workspace\bkeller\build.xml:42: Failed to copy C:\workspace\bkeller\web\assets\text\biography.html to Z:\web\bkeller\assets\text\biography.html due to java.io.FileNotFoundException Z:\web\bkeller\assets\text\biography.html (The system cannot find the file specified)
哪种烂。我找不到任何解决这个问题的方法,而对于我的项目来说,使它正常工作至关重要。我知道我对网络驱动器具有读/写/执行权限,通过Windows资源管理器就可以在驱动器上创建/编辑/删除文件。
Z盘是通过网络安装到virtualbox的,可以访问主机操作系统Ubuntu。我仔细检查了它是否具有写权限。有任何想法吗?
Centos7 Jetty7 项目部署 java.io.FileNotFoundException
出现 java.io.FileNotFoundException: /usr/jetty/jetty7.4.5/webapps/test.war
由于 在 start.ini 文件中
etc/jetty-deploy.xml
etc/jetty-webapps.xml
etc/jetty-contexts.xml
etc/jetty-testrealm.xml
etc/jetty-plus.xml
加载了 etc/jetty-contexts.xml 文件
2. jetty-contexts.xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Add a ContextProvider to the deployment manager -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This scans the webapps directory for war files and directories -->
<!-- to deploy. -->
<!-- This configuration must be used with jetty-deploy.xml, which -->
<!-- creates the deployment manager instance -->
<!-- =============================================================== -->
<Configure id="Server">
<Ref id="DeploymentManager">
<Call name="addAppProvider">
<Arg>
<New>
<Set name="monitoredDirName"><Property name="jetty.home" default="." />/contexts</Set>
<Set name="scanInterval">1</Set>
</New>
</Arg>
</Call>
</Ref>
</Configure>
启动日志记录
2015-10-10 01:09:50.222:INFO::Deployment monitor /usr/jetty/jetty7.4.5/contexts at interval 1
2015-10-10 01:09:50.223:INFO::Deployable added: /usr/jetty/jetty7.4.5/contexts/test.xml
文件里 指定加载 contexts 目录下文件
test.xml 里面包含 test.war 的信息。
删掉即可
com.jcraft.jsch.JSchException: java.io.FileNotFoundException: file:\D:\development\ideaProjects\s...
com.jcraft.jsch.JSchException: java.io.FileNotFoundException: file:\D:\development\ideaProjects\salary-card\target\salary-card-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes!\keystore\login_id_rsa (文件名、目录名或卷标语法不正确。)
Caused by: java.io.FileNotFoundException: file:\D:\development\ideaProjects\salary-card\target\salary-card-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes!\keystore\login_id_rsa (文件名、目录名或卷标语法不正确。)
问题:
资源未获取到,开发环境没问题,测试环境有问题;
原因:
经排查,发现是因为在打完 jar 包后运行,jar 包中无法获取对应目录的资源文件;
这主要是因为 jar 包是一个单独的文件而不是文件夹,不能通过 “file:\D:\development\ideaProjects\salary-card\target\salary-card-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes!\keystore\login_id_rsa” 定位 jar 包内的资源。
解决:
所以综上所述,我们在通过 jar 包来访问的话,不要使用 getResource 或 getFile 方法来访问了,使用 resource.getInputStream() 或 getResourceAsStream() 方法,通过流的形式来访问资源是可以的;
例:
InputStream is=this.getClass().getResourceAsStream("keystore/login_id_rsa");
BufferedReader br=new BufferedReader(new InputStreamReader(is));
String s="";
while((s=br.readLine())!=null)
System.out.println(s);
或
Resource resource = new ClassPathResource("keystore/login_id_rsa");
InputStream inputStream = resource.getInputStream();
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[100];
int rc = 0;
while ((rc = inputStream.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc);
}
Error: java.io.FileNotFoundException: Path is not a file: /g6/hadoop/20190326
跑 mapreduce 时,有报错 Error: java.io.FileNotFoundException: Path is not a file: /g6/hadoop/20190326,以下是报错内容
19/03/26 21:28:08 INFO mapreduce.Job: map 0% reduce 0%
19/03/26 21:28:12 INFO mapreduce.Job: Task Id : attempt_1552051424310_0114_m_000000_0, Status : FAILED
Error: java.io.FileNotFoundException: Path is not a file: /g6/hadoop/20190326
at org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:70)
at org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:56)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsUpdateTimes(FSNamesystem.java:1934)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsInt(FSNamesystem.java:1875)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1855)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1827)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getBlockLocations(NameNodeRpcServer.java:566)
at org.apache.hadoop.hdfs.server.namenode.AuthorizationProviderProxyClientProtocol.getBlockLocations(AuthorizationProviderPro
执行的命令是
process_data=20190326
hadoop jar hadoop_train-1.0.jar com.g609.hadoop.etl.driver.LogETLDriver /g6/hadoop/$process_data/ /g6/hadoop/access/output/$process_data
经过分析最终发现因为在输入路径 /g6/hadoop/$process_data/ 最后又加了一个 / 把这个斜线去掉在执行就可以了
FileNotFoundException,该文件存在Java
我有一个非常奇怪的问题,我正在尝试使用一些Java代码和JLayer播放一些MP3。我有一个方法设置来生成文件路径,但这给我带来了很多痛苦。这是return语句(以及该方法涉及的所有代码):
private static String findSoundFile(String numSeq)
{
return "file:///Users/user/Desktop/FinishedPhone/" + numSeq + ".mp3"
}
我有一组大约150个mp3文件,它们分别名为1.mp3、2.mp3等。它们最多可达156个(之间缺少一些文件)。根据用户输入的3位数代码,它会播放一种声音。这段代码可以
完美地
工作在1-99之间,直到100停止工作为止。当用户输入100或110或您输入的内容时,Java会抛出FileNotFoundException。我向你保证,文件在那里。这是使用findSoundFile返回的文件路径的代码:
public static void processNumberSequence(String numSeq) throws IOException
{
if (numSeq != "")
{
String soundLoc = findSoundFile(numSeq);
File file = new File(soundLoc);
System.out.println("System can read: " + file.canRead());
System.out.println(soundLoc);
SoundPlayer soundToPlay = new SoundPlayer(soundLoc);
soundToPlay.play();
}
}
当我填写numSeq应该填写的空间时,它变得很奇怪,像这样:
private static String findSoundFile(String numSeq)
{
return "file:///Users/user/Desktop/FinishedPhone/110.mp3";
}
上面的代码工作正常,可以播放声音而不会挂断。任何想法将不胜感激,请问是否有任何混淆。
堆栈跟踪:
java.io.FileNotFoundException: /Users/user/Desktop/FinishedPhone/111.mp3 (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.io.FileInputStream.<init>(FileInputStream.java:79)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at java.net.URL.openStream(URL.java:1010)
at SoundPlayer.play(SoundPlayer.java:26)
at SerialProcessor.processNumberSequence(SerialProcessor.java:37)
at SerialTest.serialEvent(SerialTest.java:98)
at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
at gnu.io.RXTXPort.eventLoop(Native Method)
at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)
文件之一的ls -l:
-rw-r--rw- 1 user staff 432923 Feb 27 14:15 /Users/user/Desktop/FinishedPhone/111.mp3
ls -l表示100以下:
-rw-r--rw- 1 user staff 480570 Feb 25 20:43 /Users/user/Desktop/FinishedPhone/99.mp3
我们今天的关于蚂蚁复制任务:由于java.io.FileNotFoundException而无法复制的分享就到这里,谢谢您的阅读,如果想了解更多关于Centos7 Jetty7 项目部署 java.io.FileNotFoundException、com.jcraft.jsch.JSchException: java.io.FileNotFoundException: file:\D:\development\ideaProjects\s...、Error: java.io.FileNotFoundException: Path is not a file: /g6/hadoop/20190326、FileNotFoundException,该文件存在Java的相关信息,可以在本站进行搜索。
本文标签: