Not able to find Properties file(FileNotfoundException) - java

I am running selenium script using ant task..it is working fine using command prompt..but from ant task, it is not working..How to solve this?
<testcase classname="junit.framework.TestSuite" name="com.openbravo.test.integration.erp.testsuites.regression.MRC0000_Logging" time="0.0010">
<error message="config/OpenbravoERPTest.properties (No such file or directory)" type="java.io.FileNotFoundException">java.io.FileNotFoundException: config/OpenbravoERPTest.properties (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 com.openbravo.test.integration.erp.testscripts.OpenbravoERPTest.loadProperties(OpenbravoERPTest.java:117)
at com.openbravo.test.integration.erp.testscripts.OpenbravoERPTest.setUpBeforeClass(OpenbravoERPTest.java:105)
at org.eclipse.ant.internal.launching.remote.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:30)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
</error>
</testcase>
<system-out><![CDATA[asd
]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>

Make sure that the directory containing your config directory is in the classpath.

The path name is relative: config/OpenbravoERPTest.properties
Are you sure that you're executing the script from command line in the right directory?

Related

Unable to load app.war!/WEB-INF/classes from jar files

I have a spring boot app which is giving the below error on creating Persistence EntityManager factory.
Persistence.createEntityManagerFactory
The war file is available under
/opt/test/app/app.war
and WEB-INF/classes also present in this war file.
But classloader is failing with the below error.
Is there any permission missing?
oggerName="org.hibernate.orm.url" threadName="main" txnId="" HHH10000002: File or directory named by URL [file:/opt/test/app/app.war!/WEB-INF/classes] could not be found. URL will be ignored
java.io.FileNotFoundException: /opt/test/app/app.war!/WEB-INF/classes (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:103)
at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.resolveJarFileReference(JarFileBasedArchiveDescriptor.java:165)
at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:51)
at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:47)
at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:75)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:98)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:199)
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:34)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:165)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:114)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:71)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
Docker file reference,
FROM alpine/jdk1.8:latest
RUN mkdir -p /opt/test/app
COPY app.war /opt/test/app/app.war
CMD java -jar /opt/test/app/app.war
In the pom.xml, change the packaging to jar

Issue in jar -xvf command

C:\Users\sunka\Desktop\CS DEPT\fall 2k16\information structures>jar
-xvf week2.zip
java.io.FileNotFoundException: week2.zip (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>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.tools.jar.Main.run(Main.java:307)
at sun.tools.jar.Main.main(Main.java:1288)
When I am trying to unzip using jar -xvf, I am getting file not found exception. I used the same command in my office, it was working. I made sure that zip file and jar file are present in the directory.
Check if you in same directory where you have zip file placed.
Because if JAVA path is set properly and your are giving right zip file name with correct path it works fine.

CHelper Codeforce/Topcoder plugin issue

I install the plugin CHelper for InelliJ IDEA (for MacOSX) and it doesn't work fine. I have a problem to compile a task problem, you can see the log in below.
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: /src/test/A - Maze.task (No such file or directory)
at net.egork.chelper.tester.NewTester.test(NewTester.java:41)
at net.egork.chelper.tester.NewTester.main(NewTester.java:23)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.io.FileNotFoundException: /src/test/A - Maze.task (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 net.egork.chelper.tester.NewTester.test(NewTester.java:39)
... 6 more
The Event Log : 20:12:53 Compilation completed successfully in 1 sec
My chelper.properties :
smartTesting=true
archiveDirectory=/src/archive
defaultDirectory=/src/test
extensionProposed=true
outputClass=java.io.PrintWriter
excludePackages=java.,javax.,com.sun.
outputDirectory=/src
author=
libraryMigrated=true
failOnIntegerOverflowForNewTasks=false
inputClass=java.util.Scanner
enableUnitTests=true
testDirectory=/src/test
Some Image to clarify my question/problem.
Can anyone help me to fix that issue in my config?
Thanks!
Check the output folder selected in your projects build path. Are these uncompiled files in your src folder in your build folder? I am betting they are not since most project builders will only copy over the compiled class files. If that is the case you will need to Google the Resource folder that Eclipse uses to copy them to instead.

running a jar example file with hadoop

Please go easy on me. I just started linux and hadoop at the same time. I have almost zero experience with linux and a complete beginner with hadoop.
I downloaded the file hadoop-1.1.1-bin.tar.gz from here:
http://www.motorlogy.com/apache/hadoop/common/hadoop-1.1.1/
I was able to unpack it.
I am following a tutorial that tells me to run:
bin/hadoop jar hadoop-*-examples.jar
I am getting this error:
agordon#Ubuntu32:/hadoop/hadoop-1.1.1$ bin/hadoop jar hadoop-*-examples-1.0.3.jar
Exception in thread "main" java.io.IOException: Error opening job jar: hadoop-*-examples-1.0.3.jar
at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
Caused by: java.io.FileNotFoundException: hadoop-*-examples-1.0.3.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.jar.JarFile.<init>(JarFile.java:152)
at java.util.jar.JarFile.<init>(JarFile.java:89)
at org.apache.hadoop.util.RunJar.main(RunJar.java:88)
What am i doing wrong? thank you for your guidance.
Instead of hadoop-*-examples.jar use the full name of the jar file.

can't build a ant target in TFS location

I have a ant target, xml file in my TFS project folder. the project folder is bound with TFS(Team Foundation Server). My problem is when ever i try to build the project by running the ant target in that TFS bound location it fails. it gives the following failure.
> ria_ant_build.xml:435: Error running C:\Program Files\Java\jdk1.6.0_20\bin\javac.exe compiler
at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.
java:508)
at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:61)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1153)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:930)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.6.0_20\bin\javac.exe": CreateProcess erro
r=87, The parameter is incorrect
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.
java:505)
... 19 more
Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 24 more
but when i copy the project to a different location and remove the read only attribute from the folder the ant target runs without any error and I'm getting a deploy-able artifact. but even when i remove the read only attribute from the TFS folder i could not build the ant target.It seems like the problem exist on the TFS location it self. :(
can some one suggest me a method to solve this problem. I have to stay in the TFS location you guys know the reason i assume :)
--
Thanks & Regards,
Rangana
From your question it's hard to figure out what really causes your problem.
Perhabs, your ant call length is too long and even longer than the max command prompt line (that's 8191 characters in the latest versions of Windows). As question Fail to launch application (CreateProcess error=87), can't use shorten classpath workaround says you may consider "to shorten folder names, reduce depth of folder trees, using parameter files, etc".
Try to run ant with the -debug option to see the specific command-line parameters of your build call inside the TFS workspace. In that way you can estimate the total length of the call.

Categories

Resources