Hi DM<div><br></div><div>I don't think we'll be able to fix this in the POM. This is a bug by the fact we're running tests for e.g. within Maven and depends on the users' maven repository. I'll raise the bug and close it as won't fix with a note that it should be fixed in maven-3</div>
<div>Cheers,</div><div><br></div><div>Chris<br><br><div class="gmail_quote">On 22 April 2010 11:33, DM Smith <span dir="ltr"><<a href="mailto:dmsmith@crosswire.org">dmsmith@crosswire.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><br><div><div class="im"><div>On Apr 21, 2010, at 6:54 PM, Chris Burrell wrote:</div><br><blockquote type="cite">After some hunting and some testing, I found that this is in fact not anything to do with jsword, common or the TyndaleStep code.<div>
<br></div><div>Maven internally uses different Class realms, presumably to separate the different contexts in which it runs things. As a result it deals with its own ClassLoaders. Apparently Plexus which it relies on uses <span style="font-family:arial, FreeSans, Helvetica, sans-serif;font-size:14px;color:rgb(51, 51, 51);line-height:20px"><tt>File.toURL()</tt> instead of <tt>File.toURI().toURL()</tt> when populating the class realms.</span></div>
<div><span style="font-family:arial, FreeSans, Helvetica, sans-serif;font-size:14px;color:rgb(51, 51, 51);line-height:20px"><br></span></div><div><span style="font-family:arial, FreeSans, Helvetica, sans-serif;font-size:14px;color:rgb(51, 51, 51);line-height:20px">This is documented here: <span style="font-family:arial;line-height:normal;font-size:small"><a href="http://jira.codehaus.org/browse/MNG-3607" target="_blank">http://jira.codehaus.org/browse/MNG-3607</a> and apparently gets fixed in maven 3 alpha!</span></span></div>
</blockquote><div><br></div></div>Whew! That makes me feel better. BTW, a significant Java difference between a URI and an URL: A URI does not have to describe something that exists but a URL always resolves it's target, going out on the network/filesystem to ensure that the object exists. Thus, using URIs is much faster.</div>
<div><br></div><div><div class="im"><br><blockquote type="cite">
<div><span style="font-family:arial, FreeSans, Helvetica, sans-serif;font-size:14px;color:rgb(51, 51, 51);line-height:20px"><span style="font-family:arial;line-height:normal;font-size:small"><br>
</span></span></div><div><span style="font-family:arial, FreeSans, Helvetica, sans-serif;font-size:14px;color:rgb(51, 51, 51);line-height:20px"><span style="font-family:arial;line-height:normal;font-size:small">Do you still want me to raise a defect? The easiest workaround (but affects most maven developers) is to change the settings.xml to specify the local repository as c:\docume~1\username\... The other work around would be to do a nasty url.getExternalForm().replace("%20", " "), but then all the resources across the whole of JSword would take a hit, for no other reason than it doesn't work during dev.</span></span></div>
</blockquote><div><br></div></div>If the defect is expressed in JSwords poms and can be fixed then then yes, with a patch to those pom or xml files. Otherwise, it is just a learning experience for maven users on Windows. But, we may want to open an issue, describe the work around and resolve it as "Won't Fix."</div>
<div><br></div><div>I don't think that we want to have a bug work around in the code when we don't have to.</div><div><div></div><div class="h5"><div><br><blockquote type="cite">
<div><br></div><div><span style="font-family:arial, FreeSans, Helvetica, sans-serif;font-size:14px;color:rgb(51, 51, 51);line-height:20px"><span style="font-family:arial;line-height:normal;font-size:small">Chris</span></span></div>
<div><a href="http://jira.codehaus.org/browse/MNG-3607" target="_blank"></a><br><br><div class="gmail_quote">On 20 April 2010 01:25, DM Smith <span dir="ltr"><<a href="mailto:dmsmith@crosswire.org" target="_blank">dmsmith@crosswire.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div>On Apr 18, 2010, at 12:31 PM, Chris Burrell wrote:</div>
<br><blockquote type="cite">Ok, so here's an answer to this weird problem... As DM said, it seemed to be a classpath issue, but then since NetUtils is being executed, at least part of the jar file is being found. And the maven output shows it's on the path.<div>
<br></div><div>But here's what is happening:<div><div>- My Maven repository is located on Windows under c:\Documents and Settings\username\.m2</div><div><br></div><div>The following method in NetUtils returns a null because a URISyntaxException is being caught</div>
<div><div> public static URI toURI(URL url) {</div><div> try {</div><div> return new URI(url.toExternalForm());</div><div> } catch (URISyntaxException e) {</div><div> return null;</div>
<div> }</div><div> }</div></div><div><br></div><div>Now the reason for that is "<span style="font-family:monospace;font-size:medium;white-space:pre">Illegal character in <span style="font-family:arial;white-space:normal;font-size:small"><span style="font-family:monospace;font-size:medium;white-space:pre">opaque part at index 22: jar:file:/C:/Documents and</span>"</span></span></div>
<div><br></div><div>That character is a space character. It seems the toExternalForm() method doesn't like the space. Perhaps because the space should probably be a %20? (haven't tried that).</div></div></div></blockquote>
<div><br></div></div>Hmm. Not sure what the problem is. According to Java 1.5 the proper way to convert a URL to a URI is to call url.toURI(). This is just a wrapper for new URI(url.toString()); In both Java 1.5 and Java 1.4.2, url.toString() is just a wrapper to url.toExternalForm(), and url.toExternalForm() merely calls handler.toExternalForm(this).</div>
<div><br></div><div>The documentation clearly states that some URLs cannot be encoded via toExternalForm. And it seems that we've clearly hit that.</div><div><br></div><div>What frustrates me is that it appears that Java is returning an URL from the class loader that is not URL encoded.</div>
<div><br></div><div>From the RFC for URIs it says the proper way to do URL encoding is to construct an URL from parts. Each part can be encoded.</div><div><br></div><div><div><blockquote type="cite"><div><div><div>
<br></div><div>
My quick workaround is to do as suggested on this post: <a href="http://www.mail-archive.com/users@maven.apache.org/msg84160.html" target="_blank">http://www.mail-archive.com/users@maven.apache.org/msg84160.html</a> and rewrite my Maven settings.xml so that the local repository is at c:\Docume~1\username\.m2</div>
<div><br></div><div>A better solution would be to do the following to test whether we can pass a URL encoded form to the URL object above (I assume that will have quite a lot of impact so we'd need to test this quite a bit)</div>
<div><br></div><div>Also perhaps some logging of the exception would be nice.</div><div>I assume people will have the same problem if they happen to install Bible Desktop at c:\bible desktop\ because of the space (but again haven't tested)</div>
<div><br></div><div>Happy to try and create a patch for it, or not.</div></div></div></blockquote><div><br></div></div>Yes please. Also create an issue in <a href="http://www.crosswire.org/bugs" target="_blank">www.crosswire.org/bugs</a> under JSword and attach your patches to it.</div>
<div><br></div><div>Many thanks.</div><div><div></div><div><div><br></div><div><br><blockquote type="cite"><div><div><div>Cheers</div><div>Chris :)</div><div><br></div><div><br></div><div><br></div><div><br><br>
<div class="gmail_quote">On 18 April 2010 01:43, DM Smith <span dir="ltr"><<a href="mailto:dmsmith@crosswire.org" target="_blank">dmsmith@crosswire.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I'm not to familiar with maven, but I don't think I checked in the latest poms.<div>
<br></div><div>I'm not clear as to why it would get a ClassDefNotFoundError. That sounds like a class path error.</div><div><br><div>-- DM</div><div><br><div><div><div></div><div><div>On Apr 17, 2010, at 1:50 PM, Chris Burrell wrote:</div>
<br></div></div><blockquote type="cite"><div><div></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Hi<div><br></div><div>I'm trying to get my project to compile/run against the JSword POM. I'm hitting a couple of issues (which might be related)</div>
<div><br></div><div>1st: mvn clean install fails to retrieve a dependency, which is not very helpful. However it does seem to build common and JSword properly. I posted a message recently on this, but there was no feedback?</div>
<div><br></div><div>2nd, when trying to use it to install some bible versions, I get a ClassDefNotFoundError which is due to a NullPointerException in NetUtil class.</div><div><br></div><div>It seems that we're not forming a proper URL from:</div>
<div> URL index = ResourceUtil.getResource(ReadingsBookDriver.class, "readings.txt"); //$NON-NLS-1$</div><div><br></div><div>I'm not familiar with what the correct behaviour should be. I've checked that JAR that the Maven plugin builds, and readings.txt does indeed exist. Does anyone have any ideas?</div>
<div><br></div><div>This only happens through Maven when I run my packaged jar. When I run this through Eclipse it seems fine, which sounded to me like it be a dependency issue, but I can't figure our what the problem is...</div>
<div>Any ideas anyone?</div><div>Cheers,</div><div>Chris</div><div><br></div><div><br></div><div>Output from Maven:</div><div><div>[DEBUG] Collected project classpath [D:\temp\release_final_test\step-dataloader\target\classes]</div>
<div>[DEBUG] Adding to classpath : file:/D:/temp/release_final_test/step-dataloader/target/classes/</div><div>[DEBUG] Adding project dependency artifact: jsword to classpath</div><div>[DEBUG] Adding project dependency artifact: log4j to classpath</div>
<div>[DEBUG] Adding project dependency artifact: jsword-common to classpath</div><div>[DEBUG] Adding project dependency artifact: commons-codec to classpath</div><div>[DEBUG] Adding project dependency artifact: commons-httpclient to classpath</div>
<div>[DEBUG] Adding project dependency artifact: commons-logging to classpath</div><div>[DEBUG] Adding project dependency artifact: commons-net to classpath</div><div>[DEBUG] Adding project dependency artifact: oro to classpath</div>
<div>[DEBUG] Adding project dependency artifact: javatar to classpath</div><div>[DEBUG] Adding project dependency artifact: jdom to classpath</div><div>[DEBUG] Adding project dependency artifact: lucene-core to classpath</div>
<div>[DEBUG] Adding project dependency artifact: lucene-snowball to classpath</div><div>[DEBUG] Adding project dependency artifact: lucene-smartcn to classpath</div><div>[DEBUG] Adding project dependency artifact: lucene-analyzers to classpath</div>
<div>[DEBUG] Adding project dependency artifact: commons-dbutils to classpath</div><div>[DEBUG] Adding project dependency artifact: commons-io to classpath</div><div>[DEBUG] Adding project dependency artifact: commons-lang to classpath</div>
<div>[DEBUG] Adding project dependency artifact: opencsv to classpath</div><div>[DEBUG] Adding project dependency artifact: derbyclient to classpath</div><div>[DEBUG] Adding project dependency artifact: derby to classpath</div>
<div>[DEBUG] joining on thread Thread[com.tyndalehouse.step.dataloader.Dataloader.main(),5,com.tyndalehouse.step.dataloader.Dataloader]</div><div>[DEBUG] Setting accessibility to true in order to invoke main().</div><div>
Using connection string: jdbc:derby:C:\Documents and Settings\CJBurrell/TyndaleStep/StepDB;create=true</div><div>0 [com.tyndalehouse.step.dataloader.Dataloader.main()] WARN com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller - Creating new installer for JSw</div>
<div>ord</div><div>Currently hardcoded installer host to:<a href="http://www.crosswire.org/" style="color:rgb(0, 0, 204)" target="_blank">www.crosswire.org</a></div><div>Currently hardcoded property names for step</div>
<div>Setting to (<a href="http://www.crosswire.org/" style="color:rgb(0, 0, 204)" target="_blank">www.crosswire.org</a> via <a href="http://10.154.1.44:8080/" style="color:rgb(0, 0, 204)" target="_blank">10.154.1.44:8080</a>)</div>
<div>Setting package and catalog directories</div><div>641 [com.tyndalehouse.step.dataloader.Dataloader.main()] INFO com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller - installing ESV</div><div>[INFO] ------------------------------------------------------------------------</div>
<div>[ERROR] BUILD ERROR</div><div>[INFO] ------------------------------------------------------------------------</div><div>[INFO] An exception occured while executing the Java class. null</div><div><br></div><div>[INFO] ------------------------------------------------------------------------</div>
<div>[DEBUG] Trace</div><div>org.apache.maven.lifecycle.LifecycleExecutionException: An exception occured while executing the Java class. null</div><div> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)</div>
<div> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)</div><div> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)</div>
<div> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)</div><div> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)</div>
<div> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)</div><div> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)</div><div> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)</div>
<div> at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)</div><div> at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)</div><div> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div>
<div> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</div><div> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</div><div> at java.lang.reflect.Method.invoke(Method.java:597)</div>
<div> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)</div><div> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)</div><div> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)</div>
<div> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)</div><div>Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null</div><div> at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:338)</div>
<div> at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)</div><div> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)</div>
<div> ... 17 more</div><div>Caused by: java.lang.reflect.InvocationTargetException</div><div> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div><div> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</div>
<div> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</div><div> at java.lang.reflect.Method.invoke(Method.java:597)</div><div> at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)</div>
<div> at java.lang.Thread.run(Thread.java:619)</div><div><b>Caused by: java.lang.ExceptionInInitializerError</b></div><div> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div><div> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</div>
<div> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</div><div> at java.lang.reflect.Method.invoke(Method.java:597)</div><div> at org.crosswire.jsword.book.Books.autoRegister(Books.java:426)</div>
<div> at org.crosswire.jsword.book.Books.initialize(Books.java:407)</div><div> at org.crosswire.jsword.book.Books.<init>(Books.java:59)</div><div> at org.crosswire.jsword.book.Books.<clinit>(Books.java:473)</div>
<div> at com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller.installBible(JSwordModuleInstaller.java:46)</div><div> at com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller.installDefaultModules(JSwordModuleInstaller.java:33)</div>
<div> at com.tyndalehouse.step.dataloader.Dataloader.main(Dataloader.java:33)</div><div> ... 6 more</div><div><b>Caused by: java.lang.NullPointerException</b></div><div> at org.crosswire.common.util.NetUtil.getInputStream(NetUtil.java:415)</div>
<div> at org.crosswire.common.util.NetUtil.listByIndexFile(NetUtil.java:544)</div><div> at <b>org.crosswire.jsword.book.readings.ReadingsBookDriver.getInstalledReadingsSets(ReadingsBookDriver.java:91)</b></div>
<div> at org.crosswire.jsword.book.readings.ReadingsBookDriver.<init>(ReadingsBookDriver.java:50)</div><div> at org.crosswire.jsword.book.readings.ReadingsBookDriver.<clinit>(ReadingsBookDriver.java:119)</div>
</div><div><br></div><div><br></div><div>my dependencies:</div><div><div><span style="white-space:pre"><dependency>
                                <groupId>org.crosswire</groupId>
                                <artifactId>jsword</artifactId>
                                <version>1.6.1-SNAPSHOT</version>
</dependency></span></div></div><div><br></div><div>My plugin to run the jar:</div><div><br></div><div><div><span style="white-space:pre">                </span><plugins></div><div><span style="white-space:pre">                        </span><plugin></div>
<div><span style="white-space:pre">                                </span><groupId>org.codehaus.mojo</groupId></div><div><span style="white-space:pre">                                </span><artifactId>exec-maven-plugin</artifactId></div><div><span style="white-space:pre">                                </span><configuration></div>
<div><span style="white-space:pre">                                        </span><mainClass>com.tyndalehouse.step.dataloader.Dataloader</mainClass></div><div><span style="white-space:pre">                                        </span><systemProperties></div><div><span style="white-space:pre">                                                </span><systemProperty></div>
<div><span style="white-space:pre">                                                        </span><key>db.location</key></div><div><span style="white-space:pre">                                                        </span><value>${db.directory}</value></div><div><span style="white-space:pre">                                                </span></systemProperty></div>
<div><span style="white-space:pre">                                                </span><systemProperty></div><div><span style="white-space:pre">                                                        </span><key>step.http.proxy</key></div><div><span style="white-space:pre">                                                        </span><value>${step.http.proxy}</value></div>
<div><span style="white-space:pre">                                                </span></systemProperty></div><div><span style="white-space:pre">                                                </span><systemProperty></div><div><span style="white-space:pre">                                                        </span><key>step.http.port</key></div>
<div><span style="white-space:pre">                                                        </span><value>${step.http.port}</value></div><div><span style="white-space:pre">                                                </span></systemProperty></div><div><span style="white-space:pre">                                        </span></systemProperties></div>
<div><span style="white-space:pre">                                        </span><classpathScope>runtime</classpathScope></div><div><span style="white-space:pre">                                </span></configuration></div><div><span style="white-space:pre">                        </span></plugin></div>
</div><div><br></div><div><br></div></span></div></div>
_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div></div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div>