You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "David Jencks (JIRA)" <xm...@xml.apache.org> on 2005/05/04 19:26:04 UTC

[jira] Commented: (XMLBEANS-151) XMLBean Ant task fails with NullPointerException when run from within Maven

     [ http://issues.apache.org/jira/browse/XMLBEANS-151?page=comments#action_64491 ]
     
David Jencks commented on XMLBEANS-151:
---------------------------------------

This is a duplicate of http://issues.apache.org/jira/browse/XMLBEANS-116 and has already been fixed in svn.

> XMLBean Ant task fails with NullPointerException when run from within Maven
> ---------------------------------------------------------------------------
>
>          Key: XMLBEANS-151
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-151
>      Project: XMLBeans
>         Type: Bug
>   Components: Compiler
>     Versions: Version 2 Beta 1
>  Environment: Windows XP, JDK 1.4.2_06, but I suspect this is not relevant
>     Reporter: Ian Springer

>
> When I execute the XMLBean Ant task from within a Maven goal, it always fails with the following stack trace:
> java.lang.ExceptionInInitializerError
>         at org.apache.xmlbeans.impl.tool.XMLBean.execute(XMLBean.java:294)
>         at org.apache.tools.ant.Task.perform(Task.java:341)
>         at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
>         at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
>         at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
>         at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
>         at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
>         at com.werken.werkz.Goal.fire(Goal.java:639)
>         at com.werken.werkz.Goal.attain(Goal.java:575)
>         at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
>         at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
>         at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
>         at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
>         at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
>         at com.werken.werkz.jelly.PostGoalTag$1.firePostGoal(PostGoalTag.java:87)
>         at com.werken.werkz.Goal.firePostGoalCallbacks(Goal.java:710)
>         at com.werken.werkz.Goal.fire(Goal.java:654)
>         at com.werken.werkz.Goal.attain(Goal.java:575)
>         at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
>         at com.werken.werkz.Goal.attain(Goal.java:573)
>         at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
>         at com.werken.werkz.Goal.attain(Goal.java:573)
>         at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
>         at com.werken.werkz.Goal.attain(Goal.java:573)
>         at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
>         at com.werken.werkz.Goal.attain(Goal.java:573)
>         at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
>         at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
>         at org.apache.maven.cli.App.doMain(App.java:488)
>         at org.apache.maven.cli.App.main(App.java:1239)
>         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:324)
>         at com.werken.forehead.Forehead.run(Forehead.java:551)
>         at com.werken.forehead.Forehead.main(Forehead.java:581)
> Caused by: java.lang.ExceptionInInitializerError
>         at org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java:1063)
>         at org.apache.xmlbeans.impl.tool.XMLBean.execute(XMLBean.java:238)
>         ... 35 more
> Caused by: java.lang.NullPointerException
>         at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<clinit>(SchemaTypeSystemImpl.java:150)
>         ... 37 more
> I attached to the JVM and found that the following line is causing the NPE:
> ("org." + "apache." + "xmlbeans").equals(SchemaTypeSystem.class.getPackage().getName())     ?
> Specifically, SchemaTypeSystem.class.getPackage() is returning null. The JavaDocs for java.lang.Class#getPackage() say that it "[returns] null if no package information is available from the archive or codebase." I think it's returning null in this case because of how the classloaders are set up by Maven. To verify that it has something to do with running inside Maven, I ran the Ant task with the same exact arguments from within vanilla Ant, and it worked fine.
> Note, I tried setting the fork attribute on the task to both "true" and "false", but I get the NPE either way.
> Note, the XMLBean Ant task with the same parameters works fine when using XMLBeans v1.0.4.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org