Hi! I would really appreciate if someone could help me on this.
I'm running this simple Dynamic Client:
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
public class DynamicClientTest {
public static void main(String args[]) {
ClassLoader
classLoader=DynamicClientTest.class.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
JaxWsDynamicClientFactory dcf =
JaxWsDynamicClientFactory.newInstance();
Client client =
dcf.createClient("http://localhost:8088/proxy/ChargingStationNmsServices?wsdl",
classLoader);
Object satelliteState;
try {
satelliteState =
Thread.currentThread().getContextClassLoader().loadClass("com.mobie.common.webservice.SatelliteState").newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
And I get the following exception:
Jun 29, 2011 12:52:17 PM org.apache.cxf.jaxb.JAXBUtils
logGeneratedClassNames
INFO: Created classes: com.mobie.nms.webservice.AuthorizationCardRequest,
com.mobie.nms.webservice.AuthorizationCardResponse,
com.mobie.nms.webservice.ChargeFinalizedRequest,
com.mobie.nms.webservice.ChargeFinalizedResponse,
com.mobie.nms.webservice.ChargeInitializedRequest,
com.mobie.nms.webservice.ChargeInitializedResponse,
com.mobie.nms.webservice.InstallStationRequest,
com.mobie.nms.webservice.InstallStationResponse,
com.mobie.nms.webservice.ObjectFactory,
com.mobie.nms.webservice.OfflineChargesRequest,
com.mobie.nms.webservice.OfflineChargesResponse,
com.mobie.nms.webservice.OfflineStatusChangesRequest,
com.mobie.nms.webservice.OfflineStatusChangesResponse,
com.mobie.nms.webservice.ReportAlarmRequest,
com.mobie.nms.webservice.ReportAlarmResponse,
com.mobie.nms.webservice.ReportFirmwareUpdateStatusRequest,
com.mobie.nms.webservice.ReportFirmwareUpdateStatusResponse,
com.mobie.nms.webservice.StatusChangedRequest,
com.mobie.nms.webservice.StatusChangedResponse,
com.mobie.common.webservice.Alarm,
com.mobie.common.webservice.ChargeFinalized,
com.mobie.common.webservice.ChargeInitialized,
com.mobie.common.webservice.ChargingStationDetails,
com.mobie.common.webservice.ChargingStationState,
com.mobie.common.webservice.ObjectFactory,
com.mobie.common.webservice.OfflineChargeTransaction,
com.mobie.common.webservice.ResponseError,
com.mobie.common.webservice.SatelliteDetails,
com.mobie.common.webservice.SatelliteState
java.lang.ClassNotFoundException:
com.mobie.common.webservice.SatelliteState
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at DynamicClientTest.main(DynamicClientTest.java:25)
I works for some classes. However I cannot get an instance of
SatelliteState and some methods are missing on the ChargingStationState
instance.
As you can see the "com.mobie.common.webservice.SatelliteState" is being
created as it is included in the the generated class names but I cannot
instantiate it. Does anyone know what's happening and any workaround?
Thanks in advanced,
--
Pedro Alípio
<[email protected]>