Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cucumber.runtime.CucumberException: java.io.FileNotFoundException #866

Closed
Martin-Spamer opened this issue May 14, 2015 · 17 comments
Closed

Comments

@Martin-Spamer
Copy link

I've just updated a project from 1.1.8 to 1.2.2 and it is now generating a cucumber.runtime.CucumberException: java.io.FileNotFoundException.

The problem seems to be caused by an '%20' appearing in the path to maven artifact.

The only change is to the dependency & returning the project to 1.1.8 and it runs as expected.

Previously

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.1.8</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.1.8</version>
    </dependency>

Changed to

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.2</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.2</version>
    </dependency>
cucumber.runtime.CucumberException: java.io.FileNotFoundException: C:\Users\Martin%20Spamer\.m2\repository\info\cukes\cucumber-java\1.2.2\cucumber-java-1.2.2.jar (The system cannot find the path specified)
    at cucumber.runtime.io.ZipResourceIteratorFactory.createIterator(ZipResourceIteratorFactory.java:41)
    at cucumber.runtime.io.ZipThenFileResourceIteratorFactory.createIterator(ZipThenFileResourceIteratorFactory.java:21)
    at cucumber.runtime.io.DelegatingResourceIteratorFactory.createIterator(DelegatingResourceIteratorFactory.java:49)
    at cucumber.runtime.io.ClasspathResourceIterable.iterator(ClasspathResourceIterable.java:33)
    at cucumber.runtime.io.ResourceLoaderClassFinder.getDescendants(ResourceLoaderClassFinder.java:22)
    at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:28)
    at cucumber.runtime.Runtime.loadBackends(Runtime.java:97)
    at cucumber.runtime.Runtime.<init>(Runtime.java:64)
    at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:78)
    at cucumber.api.junit.Cucumber.<init>(Cucumber.java:58)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.io.FileNotFoundException: C:\Users\Martin%20Spamer\.m2\repository\info\cukes\cucumber-java\1.2.2\cucumber-java-1.2.2.jar (The system cannot find the path specified)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:215)
    at java.util.zip.ZipFile.<init>(ZipFile.java:145)
    at java.util.zip.ZipFile.<init>(ZipFile.java:116)
    at cucumber.runtime.io.ZipResourceIterator.<init>(ZipResourceIterator.java:20)
    at cucumber.runtime.io.ZipResourceIteratorFactory.createIterator(ZipResourceIteratorFactory.java:39)
    ... 27 more
@aslakhellesoy
Copy link
Contributor

I can confirm this is a regression. I'm working on a fix.

@brasmusson
Copy link
Contributor

@aslakhellesoy You probably know more than me about the fine details of url/uri/path-convertations in Java, however is seems to me that this stackoverflow answer have some relevant information for the fix in ZipResourceIteratorFactory.

@aslakhellesoy
Copy link
Contributor

Thanks for the SO tip @brasmusson - I switched to using URI.getSchemeSpecificPart() as well - I wasn't aware that URLDecoder.decode(path, "utf-8") was incorrect (although it would only trigger a bug if there is a + in the filename).

It should all be good now.

@Martin-Spamer - can you try 1.2.3-SNAPSHOT and confirm whether this solves your problem? Look here for details about how to use SNAPSHOT builds. (It's currently building so wait until that's done).

@Martin-Spamer
Copy link
Author

I can confirm that 1.2.3-SNAPSHOT from the sonatype repository fixes this.

Sorry for delay in responding I went offline shortly after reporting this.

Cheers.

Martin

@khairajpamnani
Copy link

Hi aslakhellesoy ,

is the issue raised by Martin resolved? I am still facing this issue if there is %20 in the path for jar. If there is no %20 in the path then it works fine.

Please suggest.

thanks!

@aslakhellesoy
Copy link
Contributor

@khairajpamnani it's in 1.2.3-SNAPSHOT as mentioned above.

@aslakhellesoy
Copy link
Contributor

@erwinc1 it is publicly available. See my message further up:

Look here for details about how to use SNAPSHOT builds

@khairajpamnani
Copy link

Can we have 1.2.3 version in MVN repository?

@aslakhellesoy
Copy link
Contributor

Yes, eventually.

@aslakhellesoy
Copy link
Contributor

@khairajpamnani @erwinc1 what's preventing you from using the snapshot maven repo?

@khairajpamnani
Copy link

I don't see 1.2.3 version in maven repository so how that will be downloaded through POM into my .m2 dir. I am not sure if maven also search sona repository for requested jar version.

Sorry if I ask anything incorrect here.

@aslakhellesoy
Copy link
Contributor

Please.

Read up on maven snapshots. Read all my comments in this issue. Follow the links. Read. Learn.

@aslakhellesoy
Copy link
Contributor

I've updated the docs a little. Is it clearer now @khairajpamnani @erwinc1. You'd use 1.2.3-SNAPSHOT in your pom.

@felipedamiani
Copy link

I had the same problem, the version 1.2.4-SNAPSHOT solved my issue. tks

@aslakhellesoy
Copy link
Contributor

1.2.3 was just released, so I recommend that.

https://github.com/cucumber/cucumber-jvm/blob/master/History.md

@felipedamiani
Copy link

Great! Thanks for the tip @aslakhellesoy

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants