[jsword-devel] NullPointer in JSword, at runtime using the maven dependency

Chris Burrell christopher at burrell.me.uk
Sat Apr 17 10:50:23 MST 2010


Hi

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)

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?

2nd, when trying to use it to install some bible versions, I get a
ClassDefNotFoundError which is due to a NullPointerException in NetUtil
class.

It seems that we're not forming a proper URL from:
            URL index = ResourceUtil.getResource(ReadingsBookDriver.class,
"readings.txt"); //$NON-NLS-1$

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?

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...
Any ideas anyone?
Cheers,
Chris


Output from Maven:
[DEBUG] Collected project classpath
[D:\temp\release_final_test\step-dataloader\target\classes]
[DEBUG] Adding to classpath :
file:/D:/temp/release_final_test/step-dataloader/target/classes/
[DEBUG] Adding project dependency artifact: jsword to classpath
[DEBUG] Adding project dependency artifact: log4j to classpath
[DEBUG] Adding project dependency artifact: jsword-common to classpath
[DEBUG] Adding project dependency artifact: commons-codec to classpath
[DEBUG] Adding project dependency artifact: commons-httpclient to classpath
[DEBUG] Adding project dependency artifact: commons-logging to classpath
[DEBUG] Adding project dependency artifact: commons-net to classpath
[DEBUG] Adding project dependency artifact: oro to classpath
[DEBUG] Adding project dependency artifact: javatar to classpath
[DEBUG] Adding project dependency artifact: jdom to classpath
[DEBUG] Adding project dependency artifact: lucene-core to classpath
[DEBUG] Adding project dependency artifact: lucene-snowball to classpath
[DEBUG] Adding project dependency artifact: lucene-smartcn to classpath
[DEBUG] Adding project dependency artifact: lucene-analyzers to classpath
[DEBUG] Adding project dependency artifact: commons-dbutils to classpath
[DEBUG] Adding project dependency artifact: commons-io to classpath
[DEBUG] Adding project dependency artifact: commons-lang to classpath
[DEBUG] Adding project dependency artifact: opencsv to classpath
[DEBUG] Adding project dependency artifact: derbyclient to classpath
[DEBUG] Adding project dependency artifact: derby to classpath
[DEBUG] joining on thread
Thread[com.tyndalehouse.step.dataloader.Dataloader.main(),5,com.tyndalehouse.step.dataloader.Dataloader]
[DEBUG] Setting accessibility to true in order to invoke main().
Using connection string: jdbc:derby:C:\Documents and
Settings\CJBurrell/TyndaleStep/StepDB;create=true
0    [com.tyndalehouse.step.dataloader.Dataloader.main()] WARN
 com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller  - Creating
new installer for JSw
ord
Currently hardcoded installer host to:www.crosswire.org
Currently hardcoded property names for step
Setting to (www.crosswire.org via 10.154.1.44:8080)
Setting package and catalog directories
641  [com.tyndalehouse.step.dataloader.Dataloader.main()] INFO
 com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller  -
installing ESV
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] An exception occured while executing the Java class. null

[INFO]
------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: An exception occured
while executing the Java class. null
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception
occured while executing the Java class. null
        at
org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:338)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)
        at java.lang.Thread.run(Thread.java:619)
*Caused by: java.lang.ExceptionInInitializerError*
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.crosswire.jsword.book.Books.autoRegister(Books.java:426)
        at org.crosswire.jsword.book.Books.initialize(Books.java:407)
        at org.crosswire.jsword.book.Books.<init>(Books.java:59)
        at org.crosswire.jsword.book.Books.<clinit>(Books.java:473)
        at
com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller.installBible(JSwordModuleInstaller.java:46)
        at
com.tyndalehouse.step.dataloader.loaders.JSwordModuleInstaller.installDefaultModules(JSwordModuleInstaller.java:33)
        at
com.tyndalehouse.step.dataloader.Dataloader.main(Dataloader.java:33)
        ... 6 more
*Caused by: java.lang.NullPointerException*
        at
org.crosswire.common.util.NetUtil.getInputStream(NetUtil.java:415)
        at
org.crosswire.common.util.NetUtil.listByIndexFile(NetUtil.java:544)
        at *
org.crosswire.jsword.book.readings.ReadingsBookDriver.getInstalledReadingsSets(ReadingsBookDriver.java:91)
*
        at
org.crosswire.jsword.book.readings.ReadingsBookDriver.<init>(ReadingsBookDriver.java:50)
        at
org.crosswire.jsword.book.readings.ReadingsBookDriver.<clinit>(ReadingsBookDriver.java:119)


my dependencies:
<dependency> <groupId>org.crosswire</groupId>
<artifactId>jsword</artifactId> <version>1.6.1-SNAPSHOT</version>
</dependency>

My plugin to run the jar:

<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>com.tyndalehouse.step.dataloader.Dataloader</mainClass>
<systemProperties>
<systemProperty>
<key>db.location</key>
<value>${db.directory}</value>
</systemProperty>
<systemProperty>
<key>step.http.proxy</key>
<value>${step.http.proxy}</value>
</systemProperty>
<systemProperty>
<key>step.http.port</key>
<value>${step.http.port}</value>
</systemProperty>
</systemProperties>
<classpathScope>runtime</classpathScope>
</configuration>
</plugin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20100417/2eae118c/attachment.html>


More information about the jsword-devel mailing list