Details
Description
If I run this code I get an error:
LoginApplicationCallParameter lCallParam = new
LoginApplicationCallParameter();
lCallParam.setPassword("tim");
lCallParam.setUserName("tim");
LoginApplicationResponseParameter lResponseParam = new
LoginApplicationResponseParameter();
lResponseParam.setApplicationDate(new Date());
lResponseParam.setSecurityToken("fhkjhgkjdfhgkjhdfgkjdhfk");
lResponseParam.setUserName("tim");
IBindingFactory lBindingFactory1 =
BindingDirectory.getFactory(LoginApplicationCallParameter.class);
IMarshallingContext lMarshallContext1 =
lBindingFactory1.createMarshallingContext();
lMarshallContext1.setIndent(2);
lMarshallContext1.marshalDocument(lCallParam, "UTF-8", null, new
FileOutputStream("/home/tjs/LoginCall.xml"));
IBindingFactory lBindingFactory2 =
BindingDirectory.getFactory(LoginApplicationResponseParameter.class);
IMarshallingContext lMarshallContext2 =
lBindingFactory2.createMarshallingContext();
lMarshallContext2.setIndent(2);
lMarshallContext2.marshalDocument(lCallParam, "UTF-8", null,
new FileOutputStream("/home/tjs/LoginResponse.xml"));
The important thing to note is that both lMarshallContexts are passed the lCallParameter, where the second one should have been passed
lResponseParameter (and if you do it works fine) So in the second case, I'm trying to marshall lCallParameter given a factory from
LoginApplicationResponseParameter. The error is:
java.lang.NullPointerException
at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at
org.jibx.runtime.impl.MarshallingContext.getMarshaller(MarshallingContext.java:876)
at
com.comany.gateway.base.param.classes.LoginApplicationCallParameter.marshal(LoginApplicationCallParameter.java)
at
org.jibx.runtime.impl.MarshallingContext.marshalRoot(MarshallingContext.java:919)
at
org.jibx.runtime.impl.MarshallingContext.marshalDocument(MarshallingContext.java:967)
at com.company.webservices.test.BindingTest.testBinding(BindingTest.java:69)
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 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.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)