users@jaxb.java.net

Re: JAXB2 NullPointerException

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Thu, 27 Oct 2005 13:05:57 -0700

William Simons wrote:
> Hi all,
>
> I'm trying to get my JAXB2 project up and running in maven and am running
> into a bizarre problem that I can't get through. The schemas compile
> properly and my unit tests run when in ANT. However, in my maven project
> the tests fail with the exception below. The error occurs when I try to
> instantiate a JAXBContext using the String of the package name.

Looks like the issue is that the ClassLoader you are using (either JUnit
or Forehead) isn't defining packages.

I changed the code to work with those ClassLoaders, but I can't commit
right now as the CVS server is down.

> I'm hoping that its an environment issue and that maybe someone has seen
> something like this before.
>
> The JAXB 2 build I'm working with is the daily build from 2005-10-18.
>
> Thanks,
> Bill
>
>
>
> java.lang.NullPointerException
> at
> com.sun.xml.bind.v2.model.nav.ReflectionNavigator.getPackageName(ReflectionN
> avigator.java:459)
> at
> com.sun.xml.bind.v2.model.nav.ReflectionNavigator.getPackageName(ReflectionN
> avigator.java:22)
> at
> com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:20
> 0)
> at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.j
> ava:325)
> at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198)
> at
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
> at
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
> at
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
> 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:585)
> at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
> at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:358)
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:323)
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
> at
> org.chip.ping.phr.demo.ResponderConfigTest.testCredentials(ResponderConfigTe
> st.java:32)
> 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:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
> nner.java:325)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask
> .java:848)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.jav
> a:556)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.jav
> a:532)
> 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.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
> at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)
> 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
> 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:585)
> at com.werken.forehead.Forehead.run(Forehead.java:551)
> at com.werken.forehead.Forehead.main(Forehead.java:581)
> [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 0.657 sec
> [junit] [ERROR] TEST org.chip.ping.phr.demo.ResponderConfigTest FAILED
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com