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 class="Apple-style-span" style="font-family: monospace; font-size: medium; white-space: pre; ">Illegal character in <span class="Apple-style-span" style="font-family: arial; white-space: normal; font-size: small; "><span class="Apple-style-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><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">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>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">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 class="h5"><div>On Apr 17, 2010, at 1:50 PM, Chris Burrell wrote:</div>
<br></div></div><blockquote type="cite"><div><div></div><div class="h5"><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>