Open GoogleCodeExporter opened 9 years ago
I got same error in a likely setting.
Original comment by jinfan.d...@gmail.com
on 9 Apr 2011 at 12:41
I am not using the maven plugin but just the Command Line approach document at
http://one-jar.sourceforge.net/index.php?page=getting-started&file=quickstart
and I also cannot load my log4j.xml from within the One Jar.
I get:
log4j:ERROR Could not parse url
[jar:file:/AppLink.jar!/main/StubMsgSvc.jar!/log4j.xml].
java.io.FileNotFoundException: \FOpenLink.jar (The system cannot find the file
specified) .....
Original comment by johngfer...@gmail.com
on 30 Sep 2011 at 6:27
The only non-announcement post to this project's Google Group was about this
issue, too:
https://groups.google.com/group/onejar/browse_thread/thread/cfc13effd6bfb9ef
>>>>>
I have a maven build using one-jar to create an executable test JAR.
The JAR runs just fine, but during the execution of my main class I
need to load my TestNG xml from the root of the JAR, but this fails.
This mechanism works with an executable zip on another project. I
would prefer to use one-jar so that I don't have to manually manage
the dependencies.
I've confirmed that files exist in the myProject.jar and the paths
are:
/com/address/MyMain
/myFile.xml
I added the following to the MyMain class:
...
System.out.println("This is the path: " +
MyMain.class.getClassLoader().getResource("myFile.xml").toString());
ArrayList<String> suites = new ArrayList<String>();
String xmlPath =
MyMain.class.getClassLoader().getResource("myFile.xml").toString();
suites.add(xmlPath)
testng.setTestSuites(suites);
...
When I run the JAR I get this as an output:
This is the path: jar:file:/myProject.one-jar.jar!/main/
myProject.jar!/myFile.xml
java.io.FileNotFoundException: jar:file:/myProject.one-jar.jar!/
main/myProject.jar!/myFile.xml (No such file or directory)
I tried other paths but cannot find one that works.
Any idea how I can get the path for the xml file?
Original comment by edbran...@gmail.com
on 2 Feb 2012 at 7:07
You may have to use the One-Jar-Expand mechanism (documented at
http://one-jar.sourceforge.net) to expand the XML file into the filesystem
(somewhere), then load it from there as a File resource.
Best guess as to cause: something in testng is not using a URL which delegates
its handlers, hence it cannot understand the "jar" protocol.
Original comment by simontu...@gmail.com
on 3 Feb 2012 at 5:19
The root-cause of this issue is that Jar-URLs don't survive being converted to
a String and then back to a URL again. Somewhere there's a class that needs an
actual reference to the resource (Jar) and that reference is likely not
populated after being constructed back from a String again....
Original comment by joh...@gmail.com
on 20 Mar 2012 at 5:10
Any direction on this? I'm getting the same issue and put the following into my
maven configuration. It put log4j.xml in the Manifest but I'm not getting any
different reaction.
<manifestEntries>
<One-Jar-Expand>log4j.xml</One-Jar-Expand>
</manifestEntries>
Original comment by eabrand
on 23 May 2012 at 7:54
Original issue reported on code.google.com by
prabava...@gmail.com
on 8 Feb 2011 at 2:55