While doing I/O in Scala using Cygwin, I have copied data at this location:
/cygdrive/c/DataResearch/retail_db/order_items/part-00000
but when I am trying to access the file from the Scala prompt with the following command I get this error:
val orderItems = Source
.fromFile("/cygdrive/c/DataResearch/retail_db/order_items/part-00000")
Error:
java.i[![enter image description here][1]][1]o.FileNotFoundException: \c\DataResearch\retail_db\order_items\part-
00000
(The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at scala.io.Source$.fromFile(Source.scala:91)
at scala.io.Source$.fromFile(Source.scala:76)
at scala.io.Source$.fromFile(Source.scala:54)
What can I try to resolve this?
Related
Hi i have my project in VSC and when i try to run in the terminal the command line:
sonar-scanner.bat -D"sonar.projectKey=***" -D"sonar.sources=." -D"sonar.host.url=***" -D"sonar.login=***"
to analyse my code VSC terminal displays this error:
ERROR: Error during SonarScanner execution
org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.
at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:75)
at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:319)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:204)
at org.sonar.java.JavaFrontend.<init>(JavaFrontend.java:95)
at org.sonar.plugins.java.JavaSensor.execute(JavaSensor.java:112)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:81)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:392)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:388)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:357)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:135)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
I am not sure what i am doing wrong, i have my token, i select Other (for JS, TS, Go, Python, PHP, ...) > Windows and Execute the Scanner in the VSC terminal
The error indicates that you have not provided the java binaries during the sonar execution.
Add the below sonar.properties:
sonar.java.binaries= **/*.java
This will now scan your java binaries. This property is one of the required property if you are going to scan the java code.
When i try to read a file using scala it is not working , but in this location i have file
Is this permission issue
scala> val loc = "C:\\Users\\gvenk\\OneDrive\\Desktop\\Input\\accountdetails.txt"
loc: String = C:\Users\gvenk\OneDrive\Desktop\Input\accountdetails.txt
scala> Source.fromFile(loc, "UTF-8").getLines().toList
java.io.FileNotFoundException: C:\Users\gvenk\OneDrive\Desktop\Input\accountdetails.txt (The
system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStr
The solution is in the error message: The system cannot find the file specified. This means either the file doesn't exist or misspelled something.
I mm trying to integrate PowerShell with Jenkins. I am finding it hard to resolve this error as my PowerShell script job is failing as shown below.
[own-machine-powershell-job] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Windows\TEMP\hudson3566059468296731803.ps1'"
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "powershell.exe" (in directory "C:\jenkins\workspace\own-machine-powershell-job"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.(Proc.java:244)
at hudson.Proc$LocalProc.(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
at hudson.remoting.UserRequest.perform(UserRequest.java:120)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:62)
at java.lang.Thread.run(Unknown Source)
at ......remote call to Powershell-Job(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
at hudson.remoting.Channel.call(Channel.java:781)
at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.(Proc.java:244)
at hudson.Proc$LocalProc.(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
at hudson.remoting.UserRequest.perform(UserRequest.java:120)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:62)
at java.lang.Thread.run(Unknown Source)
Build step 'Windows PowerShell' marked build as failure
Finished: FAILURE
My recommendation is to check this locally before trying in jenkins.
If you tried to use the plugin or to execute an external file try to re-check the file path:
The system cannot find the file specified FATAL: command execution failed java.io.IOException: Cannot run program "powershell.exe"
The powershell exe path is wrong.
I got it resolved finally.
Basically, in my system environment variables, powershell.exe path was incorrect which I corrected it. Then ran my Jenkins job, but still the same error.
So, I restarted my system, then ran my Jenkins Powershell Job successfully.
Thanks
Not sure if this will help anyone else but gonna write it down just for posterity. Make sure your slave is running and connected. I saw this error when my Windows Jenkins slave had been disconnected, but I hadn't set a "restrict where this build can run" so it was running on my master (a Linux machine). Obviously it couldn't find a powershell.exe on there. :D
Hello i am trying to do POS tag for a certain sentence using Stanford Pos Tagger. I am using Python 3.4 nltk 3.1 on windows7
Following is the code i used:
import nltk
from nltk.tag.stanford import POSTagger
import os
java_path = r"C:\Program Files\Java\jre1.8.0_66\bin\java.exe"
os.environ['JAVAHOME'] = java_path
St=POSTagger(r"C:\Python34\Scripts\stanford-postagger-2015-12-09\models\english-bidirectional-distsim.tagger",r"C:\Python34\Scripts\stanford-postagger-2015-12-09\stanford-postagger.jar")
tokens = nltk.tokenize.word_tokenize("Sample for tagging a sentence.")
print(St.tag(tokens))
Yet, i am getting the following error:
Traceback (most recent call last):
Loading default properties from tagger C:\Python34\Scripts\stanford-postagger-2015-12-09\models\english-bidirectional-distsim.tagger
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at edu.stanford.nlp.io.IOUtils.<clinit>(IOUtils.java:42)
at edu.stanford.nlp.tagger.maxent.TaggerConfig.<init>(TaggerConfig.java:146)
at edu.stanford.nlp.tagger.maxent.TaggerConfig.<init>(TaggerConfig.java:128)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.main(MaxentTagger.java:1836)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
File "C:\Users\workspace\src\chunking.py", line 15, in <module>
print(St.tag(tokens))
File "C:\Python34\lib\site-packages\nltk\tag\stanford.py", line 59, in tag
return self.tag_sents([tokens])[0]
File "C:\Python34\lib\site-packages\nltk\tag\stanford.py", line 81, in tag_sents stdout=PIPE, stderr=PIPE)
File "C:\Python34\lib\site-packages\nltk\internals.py", line 160, in java raise OSError('Java command failed!')
OSError: Java command failed!
Please can anyone help me solve the error?
Try adding two more jar files two your build path. You will find these files in the lib folder of the downloaded package slf4j-api.jar and slf4j-simple.jar.
Have a look into this tutorial
I have recently configured my tomcat 6.0 with "serve modules without publishing" option, in order to avoid the end of the http session when I perform a hot code replacement. Since then I'm having the next error when starting the server:
GRAVE: WSSERVLET11: failed to parse runtime descriptor: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'K' (code 75) in prolog; expected '<'
at [row,col,system-id]: [1,1,"jndi:/localhost/projectX/WEB-INF/wsdl/.svn/prop-base/WSprojectXService_schema1.xsd.svn-base"]
XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'K' (code 75) in prolog; expected '<'
at [row,col,system-id]: [1,1,"jndi:/localhost/projectX/WEB-INF/wsdl/.svn/prop-base/WSprojectXService_schema1.xsd.svn-base"]
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:246)
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:70)
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:85)
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:75)
at com.sun.xml.ws.server.SDDocumentImpl.create(SDDocumentImpl.java:77)
at com.sun.xml.ws.server.EndpointFactory.categoriseMetadata(EndpointFactory.java:413)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:139)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:318)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:337)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:239)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:131)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:90)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'K' (code 75) in prolog; expected '<'
at [row,col,system-id]: [1,1,"jndi:/localhost/projectX/WEB-INF/wsdl/.svn/prop-base/WSprojectXService_schema1.xsd.svn-base"]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:60)
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:51)
... 25 more
This error never happened before without the "serve modules without publishing" option. It seems is trying to parse a svn inner file, and it's getting a parsing exception.
Thanks in advance.
The file
.svn/prop-base/WSprojectXService_schema1.xsd.svn-base
should not be exported to tomcat.
Upgrade to latest versions of subversion. It only has a .svn folder (in the oldest parent folder) and not one for each subfolder (which is why you're exporting the .svn subfolder).
You can try to tell eclipse not to export .svn subfolders but I do not know how to do that ...
Victor.