[ 
http://jira.codehaus.org/browse/JIBX-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=258073#action_258073
 ] 

Johann Burkard commented on JIBX-422:
-------------------------------------

Don,

thanks for your answer.

Sorry, I can't attach any code since it's my employer's.

But I tried JiBX 1.2.3, the result was

{code}
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.jibx:maven-jibx-plugin:1.2.3:bind (default) on project XYZ: null
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:203)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at 
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:451)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:188)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:134)
        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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException
        at 
org.jibx.maven.AbstractBaseBindingMojo.compile(AbstractBaseBindingMojo.java:155)
        at 
org.jibx.maven.AbstractBaseBindingMojo.execute(AbstractBaseBindingMojo.java:122)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
        ... 19 more
Caused by: java.lang.NullPointerException
        at 
org.jibx.binding.classes.MungedClass.checkDirectory(MungedClass.java:238)
        at org.jibx.binding.classes.BoundClass.getInstance(BoundClass.java:405)
        at org.jibx.binding.classes.BoundClass.getInstance(BoundClass.java:443)
{code}

I had looked into the code before and I thought the problem was that in 
ClassFile#writeFile, you never check that the parent directory of m_file 
actually exists.

When I patched ClassFile as follows, the problem went away:

{code}
    public void writeFile() throws IOException {
        if (m_isModified) {
                if (!m_file.getParentFile().exists()) {
                        m_file.getParentFile().mkdirs();
                }
            OutputStream os = new FileOutputStream(m_file);
            writeFile(os);
        }
    }
{code}

> NullPointerExceptions and wrong paths when using the JiBX Maven plugin
> ----------------------------------------------------------------------
>
>                 Key: JIBX-422
>                 URL: http://jira.codehaus.org/browse/JIBX-422
>             Project: JiBX
>          Issue Type: Bug
>          Components: maven plugin
>    Affects Versions: JiBX 1.2.2, JiBX 1.2.3
>         Environment: Ubuntu Linux, Maven 3 something
>            Reporter: Johann Burkard
>            Assignee: Don Corley
>
> I have been trying to get the Maven-JiBX plugin to work on a project I work 
> on. The binding files are in src/main/binding
> With maven-jibx-plugin 1.2.3, jibx-run 1.2.2 and jibx-extras 1.2.2 in the 
> dependencies, I get:
> {code}
> Caused by: java.lang.NullPointerException
>       at 
> org.jibx.binding.classes.MungedClass.checkDirectory(MungedClass.java:238)
>       at org.jibx.binding.classes.BoundClass.getInstance(BoundClass.java:405)
>       at org.jibx.binding.classes.BoundClass.getInstance(BoundClass.java:443)
>       at org.jibx.binding.def.ObjectBinding.<init>(ObjectBinding.java:294)
> {code}
> With maven-jibx-plugin 1.2.2, jibx-run 1.2.2 and jibx-extras 1.2.2 in the 
> dependencies, I get:
> {code}
> Caused by: java.io.FileNotFoundException: 
> .../.hudson/jobs/<jobname>/workspace/<project>/target/classes/config/<project>/bindings/<project>/JiBX_binding_<project>_request_commonFactory.class
>  (No such file or directory)
>       at java.io.FileOutputStream.open(Native Method)
>       at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
>       at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
>       at org.jibx.binding.classes.ClassFile.writeFile(ClassFile.java:1999)
>       at 
> org.jibx.binding.classes.MungedClass.writeChanges(MungedClass.java:424)
> {code}
> Note that /target/classes/config? Shouldn't that be /target/classes?
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to