Coder Social home page Coder Social logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 30, 2024
I got same error in a likely setting.

Original comment by [email protected] on 9 Apr 2011 at 12:41

from onejar-maven-plugin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 30, 2024
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 [email protected] on 30 Sep 2011 at 6:27

from onejar-maven-plugin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 30, 2024
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 [email protected] on 2 Feb 2012 at 7:07

from onejar-maven-plugin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 30, 2024
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 [email protected] on 3 Feb 2012 at 5:19

from onejar-maven-plugin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 30, 2024
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 [email protected] on 20 Mar 2012 at 5:10

from onejar-maven-plugin.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 30, 2024
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

from onejar-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.